@iservice-dev/is-wp-plugin-kit 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,13 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
3
4
  import { copy } from '../utils.js';
4
5
 
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+
5
8
  import { createRequire } from 'module';
6
9
  const require = createRequire(import.meta.url);
7
- const selfPkg = require('../package.json');
10
+ const selfPkg = require('../../package.json');
8
11
 
9
12
  const toolkitVersion = `^${selfPkg.version}`;
10
13
 
@@ -127,7 +130,6 @@ export default wpPluginKitVite({
127
130
  'includes/lib/Admin',
128
131
  'includes/lib/Core',
129
132
  'includes/lib/Frontend',
130
- 'languages',
131
133
  ];
132
134
 
133
135
  // Ordner die kein .gitkeep brauchen (bekommen andere Dateien)
@@ -31,4 +31,3 @@ is-wp-plugin-kit – available commands:
31
31
  compile-mo → Convert .po → .mo
32
32
  `);
33
33
  }
34
-
package/bin/utils.js CHANGED
@@ -7,20 +7,28 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
7
  /**
8
8
  * Safely copy a file from the files directory to the current working directory
9
9
  * @param {string} file - The filename to copy
10
+ * @param {string} destPath - Optional: custom destination path relative to cwd
10
11
  */
11
- export function copy(file) {
12
+ export function copy(file, destPath) {
12
13
  try {
13
14
  const src = path.resolve(__dirname, '../files', file);
14
- const dest = path.resolve(
15
- process.cwd(),
16
- file.replace(/^gitignore$/, '.gitignore')
17
- );
15
+ const dest = destPath
16
+ ? path.resolve(process.cwd(), destPath)
17
+ : path.resolve(
18
+ process.cwd(),
19
+ file.replace(/^gitignore$/, '.gitignore')
20
+ );
18
21
 
19
22
  if (!fs.existsSync(src)) {
20
23
  console.error(`Error: Source file ${file} not found.`);
21
24
  process.exit(1);
22
25
  }
23
26
 
27
+ const destDir = path.dirname(dest);
28
+ if (!fs.existsSync(destDir)) {
29
+ fs.mkdirSync(destDir, { recursive: true });
30
+ }
31
+
24
32
  fs.copyFileSync(src, dest);
25
33
  console.log(`✓ Copied ${file}`);
26
34
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iservice-dev/is-wp-plugin-kit",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "A toolkit for WordPress plugin development with Vite, TypeScript, and modern build tools",
5
5
  "type": "module",
6
6
  "main": "vite/index.js",