@zidanpro/create-nui-fivem 2.0.0 → 2.0.1
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/index.js +13 -11
- package/package.json +2 -2
package/bin/index.js
CHANGED
|
@@ -3,19 +3,21 @@
|
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const arg = process.argv[2];
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
process.
|
|
12
|
-
}
|
|
8
|
+
// kalau tidak ada project name → pakai folder sekarang
|
|
9
|
+
const targetDir = arg
|
|
10
|
+
? path.resolve(process.cwd(), arg)
|
|
11
|
+
: process.cwd();
|
|
13
12
|
|
|
14
13
|
const templateDir = path.join(__dirname, "../template");
|
|
15
|
-
const targetDir = path.resolve(process.cwd(), projectName);
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
15
|
+
// kalau pakai nama folder → buat folder (kalau belum ada)
|
|
16
|
+
if (arg && !fs.existsSync(targetDir)) {
|
|
17
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// copy template ke target
|
|
21
|
+
fs.cpSync(templateDir, targetDir, { recursive: true });
|
|
20
22
|
|
|
21
|
-
console.log(
|
|
23
|
+
console.log(`✅ Template installed at: ${targetDir}`);
|
package/package.json
CHANGED