create-umi 4.0.5 → 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,117 +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
- // test ignore prompts
21
- if (!args.default) {
22
- const response = await (0, utils_1.prompts)([
23
- {
24
- type: 'select',
25
- name: 'appTemplate',
26
- message: 'Pick Umi App Template',
27
- choices: [
28
- { title: 'Simple App', value: 'app' },
29
- { title: 'Ant Design Pro', value: 'max' },
30
- { title: 'Vue Simple App', value: 'vue-app' },
31
- ],
32
- initial: 0,
33
- },
34
- {
35
- type: 'select',
36
- name: 'npmClient',
37
- message: 'Pick Npm Client',
38
- choices: [
39
- { title: 'npm', value: 'npm' },
40
- { title: 'cnpm', value: 'cnpm' },
41
- { title: 'tnpm', value: 'tnpm' },
42
- { title: 'yarn', value: 'yarn' },
43
- { title: 'pnpm', value: 'pnpm' },
44
- ],
45
- initial: 4,
46
- },
47
- {
48
- type: 'select',
49
- name: 'registry',
50
- message: 'Pick Npm Registry',
51
- choices: [
52
- {
53
- title: 'npm',
54
- value: 'https://registry.npmjs.org/',
55
- selected: true,
56
- },
57
- { title: 'taobao', value: 'https://registry.npmmirror.com' },
58
- ],
59
- },
60
- ], {
61
- onCancel() {
62
- process.exit(1);
63
- },
64
- });
65
- npmClient = response.npmClient;
66
- registry = response.registry;
67
- appTemplate = response.appTemplate;
68
- }
69
- const pluginPrompts = [
70
- {
71
- name: 'name',
72
- type: 'text',
73
- message: `What's the plugin name?`,
74
- default: name,
75
- },
76
- {
77
- name: 'description',
78
- type: 'text',
79
- message: `What's your plugin used for?`,
80
- },
81
- {
82
- name: 'mail',
83
- type: 'text',
84
- message: `What's your email?`,
85
- },
86
- {
87
- name: 'author',
88
- type: 'text',
89
- message: `What's your name?`,
90
- },
91
- {
92
- name: 'org',
93
- type: 'text',
94
- message: `Which organization is your plugin stored under github?`,
95
- },
96
- ];
97
- const target = name ? (0, path_1.join)(cwd, name) : cwd;
98
- const templateName = args.plugin ? 'plugin' : appTemplate;
99
- const version = require('../package').version;
100
- const generator = new utils_1.BaseGenerator({
101
- path: (0, path_1.join)(__dirname, '..', 'templates', templateName),
102
- target,
103
- data: args.default
104
- ? testData
105
- : {
106
- version: version.includes('-canary.') ? version : `^${version}`,
107
- npmClient,
108
- registry,
109
- },
110
- 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
+ }
111
90
  });
112
- await generator.run();
113
- if (!args.default) {
114
- // install
115
- (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?`
116
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
+ }
117
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.5",
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.5"
28
+ "@umijs/utils": "4.0.8"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "private": true,
3
+ "author":"{{{ author }}}",
3
4
  "scripts": {
4
5
  "dev": "umi dev",
5
6
  "build": "umi build",
@@ -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
  }
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "private": true,
3
+ "author":"{{{ author }}}",
3
4
  "scripts": {
4
5
  "dev": "max dev",
5
6
  "build": "max build",
7
+ "format": "prettier --cache --write .",
6
8
  "prepare": "husky install",
7
9
  "postinstall": "max setup",
8
10
  "setup": "max setup",
@@ -19,7 +21,7 @@
19
21
  "@types/react-dom": "^18.0.0",
20
22
  "husky": "^8.0.1",
21
23
  "lint-staged": "^13.0.3",
22
- "prettier": "^2",
24
+ "prettier": "^2.7.1",
23
25
  "prettier-plugin-organize-imports": "^2",
24
26
  "prettier-plugin-packagejson": "^2",
25
27
  "typescript": "^4.1.2"
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "{{{ name }}}",
3
+ "author":"{{{ author }}}",
3
4
  "version": "0.0.1",
4
5
  "description": "{{{ description }}}",
5
6
  "main": "lib/index.js",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "private": true,
3
+ "author":"{{{ author }}}",
3
4
  "scripts": {
4
5
  "dev": "umi dev",
5
6
  "build": "umi build",
@@ -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
- });