create-umi 4.0.7 → 4.0.8
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/create-umi.js +1 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +20 -24
- package/dist/index.d.ts +0 -0
- package/dist/index.js +139 -116
- package/package.json +4 -4
- package/templates/max/.lintstagedrc.tpl +4 -4
- package/templates/max/package.json.tpl +2 -1
- package/templates/vue-app/src/layouts/index.vue +9 -9
- package/templates/vue-app/src/pages/docs.vue +1 -1
- package/templates/vue-app/src/pages/index.vue +1 -3
- package/dist/index.test.d.ts +0 -1
- package/dist/index.test.js +0 -44
package/bin/create-umi.js
CHANGED
package/dist/cli.d.ts
CHANGED
|
File without changes
|
package/dist/cli.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
boolean: ['version'],
|
|
1
|
+
// cli.ts
|
|
2
|
+
var import_utils = require("@umijs/utils");
|
|
3
|
+
var args = (0, import_utils.yParser)(process.argv.slice(2), {
|
|
4
|
+
alias: {
|
|
5
|
+
version: ["v"],
|
|
6
|
+
help: ["h"]
|
|
7
|
+
},
|
|
8
|
+
boolean: ["version"]
|
|
10
9
|
});
|
|
11
10
|
if (args.version && !args._[0]) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.error(`Create failed, ${err.message}`);
|
|
25
|
-
console.error(err);
|
|
26
|
-
});
|
|
11
|
+
args._[0] = "version";
|
|
12
|
+
const local = (0, import_utils.isLocalDev)() ? import_utils.chalk.cyan("@local") : "";
|
|
13
|
+
const { name, version } = require("../package.json");
|
|
14
|
+
console.log(`${name}@${version}${local}`);
|
|
15
|
+
} else {
|
|
16
|
+
require("./").default({
|
|
17
|
+
cwd: process.cwd(),
|
|
18
|
+
args
|
|
19
|
+
}).catch((err) => {
|
|
20
|
+
console.error(`Create failed, ${err.message}`);
|
|
21
|
+
console.error(err);
|
|
22
|
+
});
|
|
27
23
|
}
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -1,120 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
mail: 'xiaohuoni@gmail.com',
|
|
9
|
-
author: 'xiaohuoni',
|
|
10
|
-
org: 'umijs',
|
|
11
|
-
version: require('../package').version,
|
|
12
|
-
npmClient: 'pnpm',
|
|
13
|
-
registry: 'https://registry.npmjs.org/',
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
8
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
message: `Which organization is your plugin stored under github?`,
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
const target = name ? (0, path_1.join)(cwd, name) : cwd;
|
|
100
|
-
const templateName = args.plugin ? 'plugin' : appTemplate;
|
|
101
|
-
const version = require('../package').version;
|
|
102
|
-
const generator = new utils_1.BaseGenerator({
|
|
103
|
-
path: (0, path_1.join)(__dirname, '..', 'templates', templateName),
|
|
104
|
-
target,
|
|
105
|
-
data: args.default
|
|
106
|
-
? testData
|
|
107
|
-
: {
|
|
108
|
-
version: version.includes('-canary.') ? version : `^${version}`,
|
|
109
|
-
npmClient,
|
|
110
|
-
registry,
|
|
111
|
-
author,
|
|
112
|
-
},
|
|
113
|
-
questions: args.default ? [] : args.plugin ? pluginPrompts : [],
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// index.ts
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
default: () => src_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
var import_utils = require("@umijs/utils");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
var testData = {
|
|
28
|
+
name: "umi-plugin-demo",
|
|
29
|
+
description: "nothing",
|
|
30
|
+
mail: "xiaohuoni@gmail.com",
|
|
31
|
+
author: "xiaohuoni",
|
|
32
|
+
org: "umijs",
|
|
33
|
+
version: require("../package").version,
|
|
34
|
+
npmClient: "pnpm",
|
|
35
|
+
registry: "https://registry.npmjs.org/"
|
|
36
|
+
};
|
|
37
|
+
var src_default = async ({
|
|
38
|
+
cwd,
|
|
39
|
+
args
|
|
40
|
+
}) => {
|
|
41
|
+
const [name] = args._;
|
|
42
|
+
let npmClient = "pnpm";
|
|
43
|
+
let registry = "https://registry.npmjs.org/";
|
|
44
|
+
let appTemplate = "app";
|
|
45
|
+
const { username, email } = await (0, import_utils.getGitInfo)();
|
|
46
|
+
let author = email && username ? `${username} <${email}>` : "";
|
|
47
|
+
if (!args.default) {
|
|
48
|
+
const response = await (0, import_utils.prompts)([
|
|
49
|
+
{
|
|
50
|
+
type: "select",
|
|
51
|
+
name: "appTemplate",
|
|
52
|
+
message: "Pick Umi App Template",
|
|
53
|
+
choices: [
|
|
54
|
+
{ title: "Simple App", value: "app" },
|
|
55
|
+
{ title: "Ant Design Pro", value: "max" },
|
|
56
|
+
{ title: "Vue Simple App", value: "vue-app" }
|
|
57
|
+
],
|
|
58
|
+
initial: 0
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: "select",
|
|
62
|
+
name: "npmClient",
|
|
63
|
+
message: "Pick Npm Client",
|
|
64
|
+
choices: [
|
|
65
|
+
{ title: "npm", value: "npm" },
|
|
66
|
+
{ title: "cnpm", value: "cnpm" },
|
|
67
|
+
{ title: "tnpm", value: "tnpm" },
|
|
68
|
+
{ title: "yarn", value: "yarn" },
|
|
69
|
+
{ title: "pnpm", value: "pnpm" }
|
|
70
|
+
],
|
|
71
|
+
initial: 4
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: "select",
|
|
75
|
+
name: "registry",
|
|
76
|
+
message: "Pick Npm Registry",
|
|
77
|
+
choices: [
|
|
78
|
+
{
|
|
79
|
+
title: "npm",
|
|
80
|
+
value: "https://registry.npmjs.org/",
|
|
81
|
+
selected: true
|
|
82
|
+
},
|
|
83
|
+
{ title: "taobao", value: "https://registry.npmmirror.com" }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
], {
|
|
87
|
+
onCancel() {
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
114
90
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
91
|
+
npmClient = response.npmClient;
|
|
92
|
+
registry = response.registry;
|
|
93
|
+
appTemplate = response.appTemplate;
|
|
94
|
+
}
|
|
95
|
+
const pluginPrompts = [
|
|
96
|
+
{
|
|
97
|
+
name: "name",
|
|
98
|
+
type: "text",
|
|
99
|
+
message: `What's the plugin name?`,
|
|
100
|
+
default: name
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "description",
|
|
104
|
+
type: "text",
|
|
105
|
+
message: `What's your plugin used for?`
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "mail",
|
|
109
|
+
type: "text",
|
|
110
|
+
message: `What's your email?`
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "author",
|
|
114
|
+
type: "text",
|
|
115
|
+
message: `What's your name?`
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "org",
|
|
119
|
+
type: "text",
|
|
120
|
+
message: `Which organization is your plugin stored under github?`
|
|
119
121
|
}
|
|
122
|
+
];
|
|
123
|
+
const target = name ? (0, import_path.join)(cwd, name) : cwd;
|
|
124
|
+
const templateName = args.plugin ? "plugin" : appTemplate;
|
|
125
|
+
const version = require("../package").version;
|
|
126
|
+
const generator = new import_utils.BaseGenerator({
|
|
127
|
+
path: (0, import_path.join)(__dirname, "..", "templates", templateName),
|
|
128
|
+
target,
|
|
129
|
+
data: args.default ? testData : {
|
|
130
|
+
version: version.includes("-canary.") ? version : `^${version}`,
|
|
131
|
+
npmClient,
|
|
132
|
+
registry,
|
|
133
|
+
author
|
|
134
|
+
},
|
|
135
|
+
questions: args.default ? [] : args.plugin ? pluginPrompts : []
|
|
136
|
+
});
|
|
137
|
+
await generator.run();
|
|
138
|
+
if (!args.default) {
|
|
139
|
+
(0, import_utils.installWithNpmClient)({ npmClient, cwd: target });
|
|
140
|
+
}
|
|
120
141
|
};
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
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,13 +19,13 @@
|
|
|
19
19
|
"templates"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "pnpm
|
|
22
|
+
"build": "pnpm father build",
|
|
23
23
|
"build:deps": "umi-scripts bundleDeps",
|
|
24
|
-
"dev": "pnpm
|
|
24
|
+
"dev": "pnpm father dev",
|
|
25
25
|
"test": "umi-scripts jest-turbo"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@umijs/utils": "4.0.
|
|
28
|
+
"@umijs/utils": "4.0.8"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"*.{md,json}": [
|
|
3
|
-
"prettier --write"
|
|
3
|
+
"prettier --cache --write"
|
|
4
4
|
],
|
|
5
5
|
"*.{js,jsx}": [
|
|
6
6
|
"max lint --fix --eslint-only",
|
|
7
|
-
"prettier --write"
|
|
7
|
+
"prettier --cache --write"
|
|
8
8
|
],
|
|
9
9
|
"*.{css,less}": [
|
|
10
10
|
"max lint --fix --stylelint-only",
|
|
11
|
-
"prettier --write"
|
|
11
|
+
"prettier --cache --write"
|
|
12
12
|
],
|
|
13
13
|
"*.ts?(x)": [
|
|
14
14
|
"max lint --fix --eslint-only",
|
|
15
|
-
"prettier --parser=typescript --write"
|
|
15
|
+
"prettier --cache --parser=typescript --write"
|
|
16
16
|
]
|
|
17
17
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "max dev",
|
|
6
6
|
"build": "max build",
|
|
7
|
+
"format": "prettier --cache --write .",
|
|
7
8
|
"prepare": "husky install",
|
|
8
9
|
"postinstall": "max setup",
|
|
9
10
|
"setup": "max setup",
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"@types/react-dom": "^18.0.0",
|
|
21
22
|
"husky": "^8.0.1",
|
|
22
23
|
"lint-staged": "^13.0.3",
|
|
23
|
-
"prettier": "^2",
|
|
24
|
+
"prettier": "^2.7.1",
|
|
24
25
|
"prettier-plugin-organize-imports": "^2",
|
|
25
26
|
"prettier-plugin-packagejson": "^2",
|
|
26
27
|
"typescript": "^4.1.2"
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
</template>
|
|
17
17
|
<style lang="less">
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
li {
|
|
25
|
-
margin-right: 1em;
|
|
26
|
-
}
|
|
18
|
+
.navs {
|
|
19
|
+
ul {
|
|
20
|
+
padding: 0;
|
|
21
|
+
list-style: none;
|
|
22
|
+
display: flex;
|
|
27
23
|
}
|
|
24
|
+
li {
|
|
25
|
+
margin-right: 1em;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
28
|
</style>
|
package/dist/index.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.test.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("@umijs/utils");
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const index_1 = __importDefault(require("./index"));
|
|
10
|
-
const fixtures = (0, path_1.join)(__dirname, '..', 'fixtures');
|
|
11
|
-
let oldCwd = process.cwd();
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
oldCwd = process.cwd();
|
|
14
|
-
});
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
process.chdir(oldCwd);
|
|
17
|
-
});
|
|
18
|
-
test('generate app', async () => {
|
|
19
|
-
const cwd = (0, path_1.join)(fixtures, 'app');
|
|
20
|
-
await (0, index_1.default)({
|
|
21
|
-
cwd,
|
|
22
|
-
args: {
|
|
23
|
-
_: [],
|
|
24
|
-
$0: '',
|
|
25
|
-
default: true,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
expect((0, fs_1.existsSync)((0, path_1.join)(cwd, 'src', 'pages', 'index.tsx'))).toEqual(true);
|
|
29
|
-
utils_1.rimraf.sync(cwd);
|
|
30
|
-
});
|
|
31
|
-
test('generate plugin', async () => {
|
|
32
|
-
const cwd = (0, path_1.join)(fixtures, 'plugin');
|
|
33
|
-
await (0, index_1.default)({
|
|
34
|
-
cwd,
|
|
35
|
-
args: {
|
|
36
|
-
plugin: true,
|
|
37
|
-
_: [],
|
|
38
|
-
$0: '',
|
|
39
|
-
default: true,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
expect((0, fs_1.existsSync)((0, path_1.join)(cwd, 'src', 'index.ts'))).toEqual(true);
|
|
43
|
-
utils_1.rimraf.sync(cwd);
|
|
44
|
-
});
|