create-umi 4.0.6 → 4.0.9
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.js +20 -24
- package/dist/index.d.ts +8 -2
- package/dist/index.js +204 -116
- package/package.json +4 -4
- package/templates/app/.npmrc.tpl +1 -0
- package/templates/max/.lintstagedrc.tpl +4 -4
- package/templates/max/.npmrc.tpl +1 -0
- package/templates/max/package.json.tpl +5 -4
- package/templates/plugin/.npmrc.tpl +1 -0
- package/templates/vue-app/.npmrc.tpl +1 -0
- 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.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
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { yParser } from '@umijs/utils';
|
|
2
|
-
|
|
2
|
+
interface IArgs extends yParser.Arguments {
|
|
3
|
+
default?: boolean;
|
|
4
|
+
plugin?: boolean;
|
|
5
|
+
git?: boolean;
|
|
6
|
+
install?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: ({ cwd, args }: {
|
|
3
9
|
cwd: string;
|
|
4
|
-
args:
|
|
10
|
+
args: IArgs;
|
|
5
11
|
}) => Promise<void>;
|
|
6
12
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,120 +1,208 @@
|
|
|
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
|
-
name: 'org',
|
|
95
|
-
type: 'text',
|
|
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_fs = require("fs");
|
|
27
|
+
var import_path = require("path");
|
|
28
|
+
var testData = {
|
|
29
|
+
name: "umi-plugin-demo",
|
|
30
|
+
description: "nothing",
|
|
31
|
+
mail: "xiaohuoni@gmail.com",
|
|
32
|
+
author: "xiaohuoni",
|
|
33
|
+
org: "umijs",
|
|
34
|
+
version: require("../package").version,
|
|
35
|
+
npmClient: "pnpm",
|
|
36
|
+
registry: "https://registry.npmjs.org/"
|
|
37
|
+
};
|
|
38
|
+
var src_default = async ({ cwd, args }) => {
|
|
39
|
+
const [name] = args._;
|
|
40
|
+
let npmClient = "pnpm";
|
|
41
|
+
let registry = "https://registry.npmjs.org/";
|
|
42
|
+
let appTemplate = "app";
|
|
43
|
+
const { username, email } = await (0, import_utils.getGitInfo)();
|
|
44
|
+
let author = email && username ? `${username} <${email}>` : "";
|
|
45
|
+
if (!args.default) {
|
|
46
|
+
const response = await (0, import_utils.prompts)([
|
|
47
|
+
{
|
|
48
|
+
type: "select",
|
|
49
|
+
name: "appTemplate",
|
|
50
|
+
message: "Pick Umi App Template",
|
|
51
|
+
choices: [
|
|
52
|
+
{ title: "Simple App", value: "app" },
|
|
53
|
+
{ title: "Ant Design Pro", value: "max" },
|
|
54
|
+
{ title: "Vue Simple App", value: "vue-app" }
|
|
55
|
+
],
|
|
56
|
+
initial: 0
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: "select",
|
|
60
|
+
name: "npmClient",
|
|
61
|
+
message: "Pick Npm Client",
|
|
62
|
+
choices: [
|
|
63
|
+
{ title: "npm", value: "npm" },
|
|
64
|
+
{ title: "cnpm", value: "cnpm" },
|
|
65
|
+
{ title: "tnpm", value: "tnpm" },
|
|
66
|
+
{ title: "yarn", value: "yarn" },
|
|
67
|
+
{ title: "pnpm", value: "pnpm" }
|
|
68
|
+
],
|
|
69
|
+
initial: 4
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: "select",
|
|
73
|
+
name: "registry",
|
|
74
|
+
message: "Pick Npm Registry",
|
|
75
|
+
choices: [
|
|
76
|
+
{
|
|
77
|
+
title: "npm",
|
|
78
|
+
value: "https://registry.npmjs.org/",
|
|
79
|
+
selected: true
|
|
80
|
+
},
|
|
81
|
+
{ title: "taobao", value: "https://registry.npmmirror.com" }
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
], {
|
|
85
|
+
onCancel() {
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
114
88
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
89
|
+
npmClient = response.npmClient;
|
|
90
|
+
registry = response.registry;
|
|
91
|
+
appTemplate = response.appTemplate;
|
|
92
|
+
}
|
|
93
|
+
const pluginPrompts = [
|
|
94
|
+
{
|
|
95
|
+
name: "name",
|
|
96
|
+
type: "text",
|
|
97
|
+
message: `What's the plugin name?`,
|
|
98
|
+
default: name
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "description",
|
|
102
|
+
type: "text",
|
|
103
|
+
message: `What's your plugin used for?`
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "mail",
|
|
107
|
+
type: "text",
|
|
108
|
+
message: `What's your email?`
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "author",
|
|
112
|
+
type: "text",
|
|
113
|
+
message: `What's your name?`
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "org",
|
|
117
|
+
type: "text",
|
|
118
|
+
message: `Which organization is your plugin stored under github?`
|
|
119
119
|
}
|
|
120
|
+
];
|
|
121
|
+
const target = name ? (0, import_path.join)(cwd, name) : cwd;
|
|
122
|
+
const templateName = args.plugin ? "plugin" : appTemplate;
|
|
123
|
+
const version = require("../package").version;
|
|
124
|
+
const monorepoRoot = await detectMonorepoRoot({ target });
|
|
125
|
+
const inMonorepo = !!monorepoRoot;
|
|
126
|
+
const projectRoot = inMonorepo ? monorepoRoot : target;
|
|
127
|
+
const shouldInitGit = args.git !== false;
|
|
128
|
+
const withHusky = shouldInitGit && !inMonorepo;
|
|
129
|
+
const generator = new import_utils.BaseGenerator({
|
|
130
|
+
path: (0, import_path.join)(__dirname, "..", "templates", templateName),
|
|
131
|
+
target,
|
|
132
|
+
data: args.default ? testData : {
|
|
133
|
+
version: version.includes("-canary.") ? version : `^${version}`,
|
|
134
|
+
npmClient,
|
|
135
|
+
registry,
|
|
136
|
+
author,
|
|
137
|
+
withHusky,
|
|
138
|
+
extraNpmrc: npmClient === "pnpm" ? `strict-peer-dependencies=false` : ""
|
|
139
|
+
},
|
|
140
|
+
questions: args.default ? [] : args.plugin ? pluginPrompts : []
|
|
141
|
+
});
|
|
142
|
+
await generator.run();
|
|
143
|
+
const context = {
|
|
144
|
+
inMonorepo,
|
|
145
|
+
target,
|
|
146
|
+
projectRoot
|
|
147
|
+
};
|
|
148
|
+
if (!withHusky) {
|
|
149
|
+
await removeHusky(context);
|
|
150
|
+
}
|
|
151
|
+
if (inMonorepo) {
|
|
152
|
+
await moveNpmrc(context);
|
|
153
|
+
}
|
|
154
|
+
if (shouldInitGit) {
|
|
155
|
+
await initGit(context);
|
|
156
|
+
} else {
|
|
157
|
+
import_utils.logger.info(`Skip Git init`);
|
|
158
|
+
}
|
|
159
|
+
if (!args.default && args.install !== false) {
|
|
160
|
+
(0, import_utils.installWithNpmClient)({ npmClient, cwd: target });
|
|
161
|
+
} else {
|
|
162
|
+
import_utils.logger.info(`Skip install deps`);
|
|
163
|
+
}
|
|
120
164
|
};
|
|
165
|
+
async function detectMonorepoRoot(opts) {
|
|
166
|
+
const { target } = opts;
|
|
167
|
+
const rootPkg = await import_utils.pkgUp.pkgUp({ cwd: (0, import_path.dirname)(target) });
|
|
168
|
+
if (!rootPkg) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
const rootDir = (0, import_path.dirname)(rootPkg);
|
|
172
|
+
if ((0, import_utils.tryPaths)([
|
|
173
|
+
(0, import_path.join)(rootDir, "lerna.json"),
|
|
174
|
+
(0, import_path.join)(rootDir, "pnpm-workspace.yaml")
|
|
175
|
+
])) {
|
|
176
|
+
return rootDir;
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
async function moveNpmrc(opts) {
|
|
181
|
+
const { target, projectRoot } = opts;
|
|
182
|
+
const sourceNpmrc = (0, import_path.join)(target, "./.npmrc");
|
|
183
|
+
const targetNpmrc = (0, import_path.join)(projectRoot, "./.npmrc");
|
|
184
|
+
if (!(0, import_fs.existsSync)(targetNpmrc)) {
|
|
185
|
+
await import_utils.fsExtra.copyFile(sourceNpmrc, targetNpmrc);
|
|
186
|
+
}
|
|
187
|
+
await import_utils.fsExtra.remove(sourceNpmrc);
|
|
188
|
+
}
|
|
189
|
+
async function initGit(opts) {
|
|
190
|
+
const { projectRoot } = opts;
|
|
191
|
+
const isGit = (0, import_fs.existsSync)((0, import_path.join)(projectRoot, ".git"));
|
|
192
|
+
if (isGit)
|
|
193
|
+
return;
|
|
194
|
+
try {
|
|
195
|
+
await import_utils.execa.execa("git", ["init"], { cwd: projectRoot });
|
|
196
|
+
import_utils.logger.ready(`Git initialized successfully`);
|
|
197
|
+
} catch {
|
|
198
|
+
import_utils.logger.error(`Initial the git repo failed`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function removeHusky(opts) {
|
|
202
|
+
const dir = (0, import_path.join)(opts.target, "./.husky");
|
|
203
|
+
if ((0, import_fs.existsSync)(dir)) {
|
|
204
|
+
await import_utils.fsExtra.remove(dir);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
208
|
+
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.9",
|
|
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": "
|
|
22
|
+
"build": "umi-scripts father build",
|
|
23
23
|
"build:deps": "umi-scripts bundleDeps",
|
|
24
|
-
"dev": "
|
|
24
|
+
"dev": "umi-scripts father dev",
|
|
25
25
|
"test": "umi-scripts jest-turbo"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@umijs/utils": "4.0.
|
|
28
|
+
"@umijs/utils": "4.0.9"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
package/templates/app/.npmrc.tpl
CHANGED
|
@@ -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
|
}
|
package/templates/max/.npmrc.tpl
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "max dev",
|
|
6
6
|
"build": "max build",
|
|
7
|
-
"
|
|
7
|
+
"format": "prettier --cache --write .",{{#withHusky}}
|
|
8
|
+
"prepare": "husky install",{{/withHusky}}
|
|
8
9
|
"postinstall": "max setup",
|
|
9
10
|
"setup": "max setup",
|
|
10
11
|
"start": "npm run dev"
|
|
@@ -17,10 +18,10 @@
|
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"@types/react": "^18.0.0",
|
|
20
|
-
"@types/react-dom": "^18.0.0",
|
|
21
|
-
"husky": "^8.0.1",
|
|
21
|
+
"@types/react-dom": "^18.0.0",{{#withHusky}}
|
|
22
|
+
"husky": "^8.0.1",{{/withHusky}}
|
|
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
|
-
});
|