@zidanpro/create-nui-fivem 2.0.0 ā 3.0.0
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 +31 -11
- package/package.json +6 -3
package/bin/index.js
CHANGED
|
@@ -2,20 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const ora = require("ora");
|
|
5
6
|
|
|
6
7
|
const projectName = process.argv[2];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.log("npx create-nui-fivem my-project");
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
8
|
+
const targetDir = projectName
|
|
9
|
+
? path.resolve(process.cwd(), projectName)
|
|
10
|
+
: process.cwd();
|
|
13
11
|
|
|
14
12
|
const templateDir = path.join(__dirname, "../template");
|
|
15
|
-
const targetDir = path.resolve(process.cwd(), projectName);
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 });
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
// done
|
|
30
|
+
spinner.succeed("ā
Project created successfully!");
|
|
31
|
+
|
|
32
|
+
console.log("\nš Next steps:");
|
|
33
|
+
console.log(` cd ${projectName || "."}`);
|
|
34
|
+
console.log(" npm install");
|
|
35
|
+
console.log(" npm run dev\n");
|
|
36
|
+
|
|
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.0",
|
|
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"
|
|
18
|
-
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"ora": "^9.4.0"
|
|
20
|
+
}
|
|
21
|
+
}
|