create-umi 4.3.1 → 4.3.3
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/index.js +20 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -50,12 +50,26 @@ var src_default = async ({
|
|
|
50
50
|
const { username, email } = await (0, import_utils.getGitInfo)();
|
|
51
51
|
const author = email && username ? `${username} <${email}>` : "";
|
|
52
52
|
let pluginName = `umi-plugin-${name || "demo"}`;
|
|
53
|
-
|
|
53
|
+
let target = name ? (0, import_path.join)(cwd, name) : cwd;
|
|
54
54
|
const { isCancel, text, select, intro, outro } = import_utils.clackPrompts;
|
|
55
55
|
const exitPrompt = () => {
|
|
56
56
|
outro(import_utils.chalk.red("Exit create-umi"));
|
|
57
57
|
process.exit(1);
|
|
58
58
|
};
|
|
59
|
+
const setName = async () => {
|
|
60
|
+
name = await text({
|
|
61
|
+
message: "What's the target folder name?",
|
|
62
|
+
initialValue: name || "my-app",
|
|
63
|
+
validate: (value) => {
|
|
64
|
+
if (!value.length) {
|
|
65
|
+
return "Please input project name";
|
|
66
|
+
}
|
|
67
|
+
if (value != "." && import_utils.fsExtra.existsSync((0, import_path.join)(cwd, value))) {
|
|
68
|
+
return `Folder ${value} already exists`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
59
73
|
const selectAppTemplate = async () => {
|
|
60
74
|
appTemplate = await select({
|
|
61
75
|
message: "Pick Umi App Template",
|
|
@@ -108,6 +122,11 @@ var src_default = async ({
|
|
|
108
122
|
};
|
|
109
123
|
const internalTemplatePrompts = async () => {
|
|
110
124
|
intro(import_utils.chalk.bgHex("#19BDD2")(" create-umi "));
|
|
125
|
+
await setName();
|
|
126
|
+
if (isCancel(name)) {
|
|
127
|
+
exitPrompt();
|
|
128
|
+
}
|
|
129
|
+
target = (0, import_path.join)(cwd, name);
|
|
111
130
|
await selectAppTemplate();
|
|
112
131
|
if (isCancel(appTemplate)) {
|
|
113
132
|
exitPrompt();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-umi",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "create-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/create-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"templates"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@umijs/utils": "4.3.
|
|
22
|
+
"@umijs/utils": "4.3.3"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|