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