cordova-react-vite 2.0.0 → 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/execute.js +25 -21
- package/package.json +2 -2
package/execute.js
CHANGED
|
@@ -2,32 +2,37 @@
|
|
|
2
2
|
const { execSync } = require("child_process");
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const inquirer = require("inquirer");
|
|
6
5
|
|
|
7
6
|
function run(cmd, cwd = process.cwd()) {
|
|
8
7
|
console.log(`▶ ${cmd}`);
|
|
9
8
|
execSync(cmd, { stdio: "inherit", cwd, shell: true });
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
function toKebab(str) {
|
|
12
|
+
return str.toLowerCase().replace(/\s+/g, "-");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function toCamel(str) {
|
|
16
|
+
return str.replace(/\s+/g, "").toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function reverseDomain(domain, appName) {
|
|
20
|
+
const parts = domain.split(".").reverse();
|
|
21
|
+
return [...parts, toCamel(appName)].join(".");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function main() {
|
|
25
|
+
const args = process.argv.slice(2);
|
|
26
|
+
if (args.length < 2) {
|
|
27
|
+
console.error("❌ دستور اشتباه!\nمثال: cordova-react-vite Boxit Tracker boxitsoft.ir");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
+
const domain = args[args.length - 1];
|
|
32
|
+
const appNameParts = args.slice(0, -1);
|
|
33
|
+
const displayName = appNameParts.join(" ");
|
|
34
|
+
const npmName = toKebab(displayName);
|
|
35
|
+
const cordovaId = reverseDomain(domain, displayName);
|
|
31
36
|
const cordovaName = displayName;
|
|
32
37
|
|
|
33
38
|
const rootPath = path.join(process.cwd(), npmName);
|
|
@@ -77,8 +82,7 @@ async function main() {
|
|
|
77
82
|
"start": "cd react && npm run dev"
|
|
78
83
|
},
|
|
79
84
|
devDependencies: {
|
|
80
|
-
rimraf: "^5.0.0"
|
|
81
|
-
inquirer: "^9.2.0"
|
|
85
|
+
rimraf: "^5.0.0"
|
|
82
86
|
}
|
|
83
87
|
};
|
|
84
88
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-react-vite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "CLI to create a full React + Vite + Cordova project with Android platform",
|
|
5
5
|
"main": "execute.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cordova-react-vite": "execute.js"
|
|
8
8
|
},
|
|
9
9
|
"keywords": ["cordova", "react", "vite", "android", "cli"],
|
|
10
|
-
"author": "
|
|
10
|
+
"author": "mohammad shadrif feiz",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {},
|
|
13
13
|
"devDependencies": {}
|