@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.
- package/bin/commands/init.js +4 -2
- package/bin/is-wp-plugin-kit.js +0 -1
- package/bin/utils.js +13 -5
- package/package.json +1 -1
package/bin/commands/init.js
CHANGED
|
@@ -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('
|
|
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)
|
package/bin/is-wp-plugin-kit.js
CHANGED
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 =
|
|
15
|
-
process.cwd(),
|
|
16
|
-
|
|
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