create-weapp-vite 1.0.23 → 1.0.24
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/dist/cli.cjs +21 -5
- package/dist/cli.d.cts +2 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +10 -5
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
8
12
|
var __copyProps = (to, from, except, desc) => {
|
|
9
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
14
|
for (let key of __getOwnPropNames(from))
|
|
@@ -21,25 +25,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
29
|
|
|
25
30
|
// src/cli.ts
|
|
31
|
+
var cli_exports = {};
|
|
32
|
+
__export(cli_exports, {
|
|
33
|
+
run: () => run
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(cli_exports);
|
|
26
36
|
var import_node_path = __toESM(require("path"), 1);
|
|
27
37
|
var import_node_process = __toESM(require("process"), 1);
|
|
28
38
|
var import_prompts = require("@inquirer/prompts");
|
|
29
39
|
var import_init = require("@weapp-core/init");
|
|
30
40
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
31
41
|
var cwd = import_node_process.default.cwd();
|
|
32
|
-
async function
|
|
33
|
-
const
|
|
42
|
+
async function run() {
|
|
43
|
+
const [argTarget, argTemplate] = import_node_process.default.argv.slice(2);
|
|
44
|
+
const isArgMode = Boolean(argTarget);
|
|
45
|
+
const targetDir = isArgMode ? argTarget : await (0, import_prompts.input)({ message: "\u521B\u5EFA\u5E94\u7528\u7684\u76EE\u5F55", default: "my-app" });
|
|
34
46
|
const dir = import_node_path.default.resolve(cwd, targetDir);
|
|
35
47
|
const existed = await import_fs_extra.default.exists(dir);
|
|
36
48
|
if (existed) {
|
|
37
|
-
const isOverwrite = await (0, import_prompts.confirm)({ message: "\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F", default: false });
|
|
49
|
+
const isOverwrite = isArgMode ? true : await (0, import_prompts.confirm)({ message: "\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F", default: false });
|
|
38
50
|
if (!isOverwrite) {
|
|
39
51
|
return;
|
|
40
52
|
}
|
|
41
53
|
}
|
|
42
|
-
const templateName = await (0, import_prompts.select)({
|
|
54
|
+
const templateName = isArgMode ? argTemplate ?? import_init.TemplateName.default : await (0, import_prompts.select)({
|
|
43
55
|
message: "\u9009\u62E9\u6A21\u677F",
|
|
44
56
|
choices: [
|
|
45
57
|
{
|
|
@@ -63,9 +75,13 @@ async function main() {
|
|
|
63
75
|
});
|
|
64
76
|
await (0, import_init.createProject)(targetDir, templateName);
|
|
65
77
|
}
|
|
66
|
-
|
|
78
|
+
run().catch(
|
|
67
79
|
(err) => {
|
|
68
80
|
console.error("\u2717 \u521B\u5EFA\u5931\u8D25:", err.message || err);
|
|
69
81
|
console.log("\u2717 \u53D6\u6D88\u521B\u5EFA");
|
|
70
82
|
}
|
|
71
83
|
);
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
run
|
|
87
|
+
});
|
package/dist/cli.d.cts
CHANGED
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -5,17 +5,19 @@ import { confirm, input, select } from "@inquirer/prompts";
|
|
|
5
5
|
import { createProject, TemplateName } from "@weapp-core/init";
|
|
6
6
|
import fs from "fs-extra";
|
|
7
7
|
var cwd = process.cwd();
|
|
8
|
-
async function
|
|
9
|
-
const
|
|
8
|
+
async function run() {
|
|
9
|
+
const [argTarget, argTemplate] = process.argv.slice(2);
|
|
10
|
+
const isArgMode = Boolean(argTarget);
|
|
11
|
+
const targetDir = isArgMode ? argTarget : await input({ message: "\u521B\u5EFA\u5E94\u7528\u7684\u76EE\u5F55", default: "my-app" });
|
|
10
12
|
const dir = path.resolve(cwd, targetDir);
|
|
11
13
|
const existed = await fs.exists(dir);
|
|
12
14
|
if (existed) {
|
|
13
|
-
const isOverwrite = await confirm({ message: "\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F", default: false });
|
|
15
|
+
const isOverwrite = isArgMode ? true : await confirm({ message: "\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6\uFF1F", default: false });
|
|
14
16
|
if (!isOverwrite) {
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
|
-
const templateName = await select({
|
|
20
|
+
const templateName = isArgMode ? argTemplate ?? TemplateName.default : await select({
|
|
19
21
|
message: "\u9009\u62E9\u6A21\u677F",
|
|
20
22
|
choices: [
|
|
21
23
|
{
|
|
@@ -39,9 +41,12 @@ async function main() {
|
|
|
39
41
|
});
|
|
40
42
|
await createProject(targetDir, templateName);
|
|
41
43
|
}
|
|
42
|
-
|
|
44
|
+
run().catch(
|
|
43
45
|
(err) => {
|
|
44
46
|
console.error("\u2717 \u521B\u5EFA\u5931\u8D25:", err.message || err);
|
|
45
47
|
console.log("\u2717 \u53D6\u6D88\u521B\u5EFA");
|
|
46
48
|
}
|
|
47
49
|
);
|
|
50
|
+
export {
|
|
51
|
+
run
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.24",
|
|
5
5
|
"description": "create-weapp-vite",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@inquirer/prompts": "^7.10.1",
|
|
36
36
|
"fs-extra": "^11.3.2",
|
|
37
|
-
"@weapp-core/init": "3.0.
|
|
37
|
+
"@weapp-core/init": "3.0.4"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "tsup --watch --sourcemap",
|