cordova-react-vite 1.0.0 → 2.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/execute.js +21 -25
- package/package.json +1 -1
package/execute.js
CHANGED
|
@@ -2,37 +2,32 @@
|
|
|
2
2
|
const { execSync } = require("child_process");
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const inquirer = require("inquirer");
|
|
5
6
|
|
|
6
7
|
function run(cmd, cwd = process.cwd()) {
|
|
7
8
|
console.log(`▶ ${cmd}`);
|
|
8
9
|
execSync(cmd, { stdio: "inherit", cwd, shell: true });
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (args.length < 2) {
|
|
27
|
-
console.error("❌ دستور اشتباه!\nمثال: cordova-react-vite Boxit Tracker boxitsoft.ir");
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
12
|
+
async function main() {
|
|
13
|
+
const answers = await inquirer.prompt([
|
|
14
|
+
{
|
|
15
|
+
type: "input",
|
|
16
|
+
name: "cordovaId",
|
|
17
|
+
message: "نام Package ID برای Cordova (مثال: com.example.name) چیه؟",
|
|
18
|
+
validate: input => input ? true : "نمیشه خالی باشه!"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: "input",
|
|
22
|
+
name: "rootName",
|
|
23
|
+
message: "نام فولدر اصلی و package.json (kebab-case) چیه؟",
|
|
24
|
+
validate: input => input ? true : "نمیشه خالی باشه!"
|
|
25
|
+
}
|
|
26
|
+
]);
|
|
30
27
|
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const npmName = toKebab(displayName);
|
|
35
|
-
const cordovaId = reverseDomain(domain, displayName);
|
|
28
|
+
const { cordovaId, rootName } = answers;
|
|
29
|
+
const displayName = rootName; // برای نمایش در Cordova
|
|
30
|
+
const npmName = rootName; // از کاربر گرفته شده، هیچ تبدیل خودکاری انجام نمیشود
|
|
36
31
|
const cordovaName = displayName;
|
|
37
32
|
|
|
38
33
|
const rootPath = path.join(process.cwd(), npmName);
|
|
@@ -82,7 +77,8 @@ function main() {
|
|
|
82
77
|
"start": "cd react && npm run dev"
|
|
83
78
|
},
|
|
84
79
|
devDependencies: {
|
|
85
|
-
rimraf: "^5.0.0"
|
|
80
|
+
rimraf: "^5.0.0",
|
|
81
|
+
inquirer: "^9.2.0"
|
|
86
82
|
}
|
|
87
83
|
};
|
|
88
84
|
|