@zidanpro/create-nui-fivem 3.0.1 ā 4.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 +18 -14
- package/package.json +4 -1
package/bin/index.js
CHANGED
|
@@ -4,38 +4,42 @@ const fs = require("fs");
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const ora = require("ora").default;
|
|
6
6
|
|
|
7
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
8
|
+
|
|
7
9
|
const projectName = process.argv[2];
|
|
10
|
+
|
|
8
11
|
const targetDir = projectName
|
|
9
12
|
? path.resolve(process.cwd(), projectName)
|
|
10
13
|
: process.cwd();
|
|
11
14
|
|
|
12
15
|
const templateDir = path.join(__dirname, "../template");
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
const spinner = ora("š
|
|
17
|
+
(async () => {
|
|
18
|
+
const spinner = ora("š Starting project creation...").start();
|
|
19
|
+
|
|
20
|
+
await sleep(800);
|
|
16
21
|
|
|
17
|
-
try {
|
|
18
|
-
// step 1
|
|
19
22
|
spinner.text = "š Preparing folder...";
|
|
20
|
-
|
|
23
|
+
await sleep(800);
|
|
24
|
+
|
|
21
25
|
if (projectName && !fs.existsSync(targetDir)) {
|
|
22
26
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
23
27
|
}
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
spinner.text = "š¦ Copying template files...";
|
|
30
|
+
await sleep(1200);
|
|
31
|
+
|
|
27
32
|
fs.cpSync(templateDir, targetDir, { recursive: true });
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
spinner.text = "⨠Finalizing setup...";
|
|
35
|
+
await sleep(700);
|
|
36
|
+
|
|
30
37
|
spinner.succeed("ā
Project created successfully!");
|
|
31
38
|
|
|
39
|
+
await sleep(300);
|
|
40
|
+
|
|
32
41
|
console.log("\nš Next steps:");
|
|
33
42
|
console.log(` cd ${projectName || "."}`);
|
|
34
43
|
console.log(" npm install");
|
|
35
44
|
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
|
-
}
|
|
45
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zidanpro/create-nui-fivem",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "FiveM React Boilerplate Generator",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-nui-fivem": "./bin/index.js"
|
|
7
7
|
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
8
11
|
"files": [
|
|
9
12
|
"bin",
|
|
10
13
|
"template"
|