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 CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ process.env.FS_LOGGER = 'none';
3
4
  require('../dist/cli');
package/dist/cli.d.ts CHANGED
File without changes
package/dist/cli.js CHANGED
@@ -1,27 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("@umijs/utils");
4
- const args = (0, utils_1.yParser)(process.argv.slice(2), {
5
- alias: {
6
- version: ['v'],
7
- help: ['h'],
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
- args._[0] = 'version';
13
- const local = (0, utils_1.isLocalDev)() ? utils_1.chalk.cyan('@local') : '';
14
- const { name, version } = require('../package.json');
15
- console.log(`${name}@${version}${local}`);
16
- }
17
- else {
18
- require('./')
19
- .default({
20
- cwd: process.cwd(),
21
- args,
22
- })
23
- .catch((err) => {
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("@umijs/utils");
4
- const path_1 = require("path");
5
- const testData = {
6
- name: 'umi-plugin-demo',
7
- description: 'nothing',
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
- exports.default = async ({ cwd, args, }) => {
16
- const [name] = args._;
17
- let npmClient = 'pnpm';
18
- let registry = 'https://registry.npmjs.org/';
19
- let appTemplate = 'app';
20
- const { username, email } = await (0, utils_1.getGitInfo)();
21
- let author = email && username ? `${username} <${email}>` : '';
22
- // test ignore prompts
23
- if (!args.default) {
24
- const response = await (0, utils_1.prompts)([
25
- {
26
- type: 'select',
27
- name: 'appTemplate',
28
- message: 'Pick Umi App Template',
29
- choices: [
30
- { title: 'Simple App', value: 'app' },
31
- { title: 'Ant Design Pro', value: 'max' },
32
- { title: 'Vue Simple App', value: 'vue-app' },
33
- ],
34
- initial: 0,
35
- },
36
- {
37
- type: 'select',
38
- name: 'npmClient',
39
- message: 'Pick Npm Client',
40
- choices: [
41
- { title: 'npm', value: 'npm' },
42
- { title: 'cnpm', value: 'cnpm' },
43
- { title: 'tnpm', value: 'tnpm' },
44
- { title: 'yarn', value: 'yarn' },
45
- { title: 'pnpm', value: 'pnpm' },
46
- ],
47
- initial: 4,
48
- },
49
- {
50
- type: 'select',
51
- name: 'registry',
52
- message: 'Pick Npm Registry',
53
- choices: [
54
- {
55
- title: 'npm',
56
- value: 'https://registry.npmjs.org/',
57
- selected: true,
58
- },
59
- { title: 'taobao', value: 'https://registry.npmmirror.com' },
60
- ],
61
- },
62
- ], {
63
- onCancel() {
64
- process.exit(1);
65
- },
66
- });
67
- npmClient = response.npmClient;
68
- registry = response.registry;
69
- appTemplate = response.appTemplate;
70
- }
71
- const pluginPrompts = [
72
- {
73
- name: 'name',
74
- type: 'text',
75
- message: `What's the plugin name?`,
76
- default: name,
77
- },
78
- {
79
- name: 'description',
80
- type: 'text',
81
- message: `What's your plugin used for?`,
82
- },
83
- {
84
- name: 'mail',
85
- type: 'text',
86
- message: `What's your email?`,
87
- },
88
- {
89
- name: 'author',
90
- type: 'text',
91
- message: `What's your name?`,
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_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
- await generator.run();
116
- if (!args.default) {
117
- // install
118
- (0, utils_1.installWithNpmClient)({ npmClient, cwd: target });
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.7",
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 tsc",
22
+ "build": "pnpm father build",
23
23
  "build:deps": "umi-scripts bundleDeps",
24
- "dev": "pnpm build --watch",
24
+ "dev": "pnpm father dev",
25
25
  "test": "umi-scripts jest-turbo"
26
26
  },
27
27
  "dependencies": {
28
- "@umijs/utils": "4.0.7"
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
- .navs {
19
- ul {
20
- padding: 0;
21
- list-style: none;
22
- display: flex;
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>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div>
2
+ <div>
3
3
  <p>This is umi docs.</p>
4
4
  </div>
5
5
  </template>
@@ -4,8 +4,6 @@
4
4
  <p>
5
5
  <img src="../assets/yay.jpg" width="388" />
6
6
  </p>
7
- <p>
8
- To get started, edit <code>pages/index.vue</code> and save to reload.
9
- </p>
7
+ <p>To get started, edit <code>pages/index.vue</code> and save to reload.</p>
10
8
  </div>
11
9
  </template>
@@ -1 +0,0 @@
1
- export {};
@@ -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
- });