@zidanpro/create-nui-fivem 2.0.1 → 3.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 +30 -12
- package/package.json +5 -2
package/bin/index.js
CHANGED
|
@@ -2,22 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const ora = require("ora").default;
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const targetDir = arg
|
|
10
|
-
? path.resolve(process.cwd(), arg)
|
|
7
|
+
const projectName = process.argv[2];
|
|
8
|
+
const targetDir = projectName
|
|
9
|
+
? path.resolve(process.cwd(), projectName)
|
|
11
10
|
: process.cwd();
|
|
12
11
|
|
|
13
12
|
const templateDir = path.join(__dirname, "../template");
|
|
14
13
|
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
// 🎬 START LOADING
|
|
15
|
+
const spinner = ora("🚀 Creating project...").start();
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// step 1
|
|
19
|
+
spinner.text = "📁 Preparing folder...";
|
|
20
|
+
|
|
21
|
+
if (projectName && !fs.existsSync(targetDir)) {
|
|
22
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// step 2
|
|
26
|
+
spinner.text = "📦 Copying template...";
|
|
27
|
+
fs.cpSync(templateDir, targetDir, { recursive: true });
|
|
28
|
+
|
|
29
|
+
// done
|
|
30
|
+
spinner.succeed("✅ Project created successfully!");
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
console.log("\n🚀 Next steps:");
|
|
33
|
+
console.log(` cd ${projectName || "."}`);
|
|
34
|
+
console.log(" npm install");
|
|
35
|
+
console.log(" npm run dev\n");
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
} catch (err) {
|
|
38
|
+
spinner.fail("❌ Failed to create project");
|
|
39
|
+
console.error(err);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zidanpro/create-nui-fivem",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "FiveM React Boilerplate Generator",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-nui-fivem": "./bin/index.js"
|
|
@@ -14,5 +14,8 @@
|
|
|
14
14
|
"react",
|
|
15
15
|
"vite"
|
|
16
16
|
],
|
|
17
|
-
"license": "MIT"
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"ora": "^9.4.0"
|
|
20
|
+
}
|
|
18
21
|
}
|