create-umi 0.26.0 → 4.0.0-beta.13
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/README.md +2 -89
- package/bin/create-umi.js +3 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +31 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +105 -0
- package/package.json +18 -40
- package/templates/app/.gitignore.tpl +8 -0
- package/templates/app/.npmrc.tpl +1 -0
- package/templates/app/.umirc.ts.tpl +3 -0
- package/templates/app/layouts/index.tsx +22 -0
- package/templates/app/package.json.tpl +17 -0
- package/templates/app/pages/index.tsx +5 -0
- package/templates/app/pages/users/foo.tsx +3 -0
- package/templates/app/pages/users.tsx +9 -0
- package/templates/plugin/.fatherrc.ts +5 -0
- package/templates/plugin/.gitignore.tpl +2 -0
- package/templates/plugin/.npmrc.tpl +1 -0
- package/templates/plugin/README.md.tpl +38 -0
- package/templates/plugin/package.json.tpl +24 -0
- package/templates/plugin/src/index.ts.tpl +5 -0
- package/CHANGELOG.md +0 -44
- package/cli.js +0 -37
- package/index.js +0 -3
- package/lib/BasicGenerator.js +0 -70
- package/lib/generators/ant-design-pro/.babelrc +0 -10
- package/lib/generators/ant-design-pro/README.md +0 -57
- package/lib/generators/ant-design-pro/filterPkg.js +0 -15
- package/lib/generators/ant-design-pro/index.js +0 -232
- package/lib/generators/ant-design-pro/meta.json +0 -3
- package/lib/generators/app/index.js +0 -69
- package/lib/generators/app/meta.json +0 -3
- package/lib/generators/app/templates/.editorconfig +0 -16
- package/lib/generators/app/templates/.env +0 -2
- package/lib/generators/app/templates/.eslintrc +0 -3
- package/lib/generators/app/templates/.prettierignore +0 -7
- package/lib/generators/app/templates/.prettierrc +0 -11
- package/lib/generators/app/templates/.umirc.js +0 -37
- package/lib/generators/app/templates/.umirc.ts +0 -40
- package/lib/generators/app/templates/_gitignore +0 -18
- package/lib/generators/app/templates/mock/.gitkeep +0 -0
- package/lib/generators/app/templates/package.json +0 -60
- package/lib/generators/app/templates/src/app.js +0 -8
- package/lib/generators/app/templates/src/app.ts +0 -8
- package/lib/generators/app/templates/src/assets/welcomeImgs/0.jpg +0 -0
- package/lib/generators/app/templates/src/assets/welcomeImgs/1.jpg +0 -0
- package/lib/generators/app/templates/src/global.css +0 -7
- package/lib/generators/app/templates/src/layouts/__tests__/index.test.js +0 -14
- package/lib/generators/app/templates/src/layouts/__tests__/index.test.tsx +0 -16
- package/lib/generators/app/templates/src/layouts/index.css +0 -15
- package/lib/generators/app/templates/src/layouts/index.js +0 -12
- package/lib/generators/app/templates/src/layouts/index.tsx +0 -13
- package/lib/generators/app/templates/src/locales/en-US.js +0 -3
- package/lib/generators/app/templates/src/locales/en-US.ts +0 -3
- package/lib/generators/app/templates/src/models/.gitkeep +0 -0
- package/lib/generators/app/templates/src/pages/__tests__/__mocks__/umi-plugin-locale.js +0 -1
- package/lib/generators/app/templates/src/pages/__tests__/__mocks__/umi-plugin-locale.ts +0 -1
- package/lib/generators/app/templates/src/pages/__tests__/index.test.js +0 -19
- package/lib/generators/app/templates/src/pages/__tests__/index.test.tsx +0 -21
- package/lib/generators/app/templates/src/pages/index.css +0 -23
- package/lib/generators/app/templates/src/pages/index.js +0 -18
- package/lib/generators/app/templates/src/pages/index.tsx +0 -19
- package/lib/generators/app/templates/tsconfig.json +0 -18
- package/lib/generators/app/templates/typings.d.ts +0 -2
- package/lib/generators/app/templates/webpack.config.js +0 -12
- package/lib/generators/plugin/index.js +0 -81
- package/lib/generators/plugin/meta.json +0 -3
- package/lib/generators/plugin/templates/.editorconfig +0 -16
- package/lib/generators/plugin/templates/.fatherrc.js +0 -35
- package/lib/generators/plugin/templates/.fatherrc.ts +0 -35
- package/lib/generators/plugin/templates/.gitignore +0 -8
- package/lib/generators/plugin/templates/.prettierignore +0 -8
- package/lib/generators/plugin/templates/.prettierrc +0 -14
- package/lib/generators/plugin/templates/CONTRIBUTING.md +0 -40
- package/lib/generators/plugin/templates/README.md +0 -51
- package/lib/generators/plugin/templates/example/.gitignore +0 -5
- package/lib/generators/plugin/templates/example/.umirc.js +0 -8
- package/lib/generators/plugin/templates/example/.umirc.ts +0 -8
- package/lib/generators/plugin/templates/example/app.jsx +0 -3
- package/lib/generators/plugin/templates/example/app.tsx +0 -3
- package/lib/generators/plugin/templates/example/package.json +0 -3
- package/lib/generators/plugin/templates/example/pages/index.css +0 -17
- package/lib/generators/plugin/templates/example/pages/index.jsx +0 -8
- package/lib/generators/plugin/templates/example/pages/index.tsx +0 -8
- package/lib/generators/plugin/templates/example/tsconfig.json +0 -37
- package/lib/generators/plugin/templates/example/typing.d.ts +0 -2
- package/lib/generators/plugin/templates/jest.config.js +0 -8
- package/lib/generators/plugin/templates/package.json +0 -65
- package/lib/generators/plugin/templates/src/index.js +0 -26
- package/lib/generators/plugin/templates/src/index.ts +0 -29
- package/lib/generators/plugin/templates/test/fixtures/normal/.umirc.js +0 -4
- package/lib/generators/plugin/templates/test/fixtures/normal/.umirc.ts +0 -4
- package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.css +0 -4
- package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.jsx +0 -10
- package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.tsx +0 -11
- package/lib/generators/plugin/templates/test/fixtures/normal/test.js +0 -10
- package/lib/generators/plugin/templates/test/fixtures/normal/test.ts +0 -10
- package/lib/generators/plugin/templates/test/index.e2e.js +0 -5
- package/lib/generators/plugin/templates/test/index.e2e.ts +0 -5
- package/lib/generators/plugin/templates/tsconfig.json +0 -23
- package/lib/generators/plugin/templates/ui/index.jsx +0 -28
- package/lib/generators/plugin/templates/ui/index.tsx +0 -29
- package/lib/run.js +0 -76
package/README.md
CHANGED
|
@@ -1,90 +1,3 @@
|
|
|
1
|
-
# create-umi
|
|
1
|
+
# @umijs/create-umi
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://codecov.io/gh/umijs/create-umi) [](https://npmjs.org/package/create-umi) [](https://circleci.com/gh/umijs/create-umi/tree/master) [](https://npmjs.org/package/create-umi) [](https://github.com/umijs/create-umi)
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
$ yarn create umi [appName]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Boilerplates
|
|
14
|
-
|
|
15
|
-
- `ant-design-pro` - Create project with a layout-only ant-design-pro boilerplate, use together with umi block.
|
|
16
|
-
- `app` - Create project with a simple boilerplate, support typescript.
|
|
17
|
-
- `plugin` - Create a umi plugin.
|
|
18
|
-
|
|
19
|
-
## Usage Example
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
$ yarn create umi
|
|
23
|
-
|
|
24
|
-
? Select the boilerplate type (Use arrow keys)
|
|
25
|
-
ant-design-pro - Create project with a layout-only ant-design-pro boilerplate, use together with umi block.
|
|
26
|
-
❯ app - Create project with a simple boilerplate, support typescript.
|
|
27
|
-
plugin - Create a umi plugin.
|
|
28
|
-
|
|
29
|
-
? Do you want to use typescript? (y/N)
|
|
30
|
-
|
|
31
|
-
? What functionality do you want to enable? (Press <space> to select, <a> to toggle all, <i> to invert selection)
|
|
32
|
-
❯◯ antd
|
|
33
|
-
◯ dva
|
|
34
|
-
◯ code splitting
|
|
35
|
-
◯ dll
|
|
36
|
-
|
|
37
|
-
create abc/package.json
|
|
38
|
-
create abc/.gitignore
|
|
39
|
-
create abc/.editorconfig
|
|
40
|
-
create abc/.env
|
|
41
|
-
create abc/.eslintrc
|
|
42
|
-
create abc/.prettierignore
|
|
43
|
-
create abc/.prettierrc
|
|
44
|
-
create abc/.umirc.js
|
|
45
|
-
create abc/mock/.gitkeep
|
|
46
|
-
create abc/src/assets/yay.jpg
|
|
47
|
-
create abc/src/global.css
|
|
48
|
-
create abc/src/layouts/index.css
|
|
49
|
-
create abc/src/layouts/index.tsx
|
|
50
|
-
create abc/src/pages/index.css
|
|
51
|
-
create abc/src/pages/index.tsx
|
|
52
|
-
create abc/tsconfig.json
|
|
53
|
-
create abc/typings.d.ts
|
|
54
|
-
📋 Copied to clipboard, just use Ctrl+V
|
|
55
|
-
✨ File Generate Done
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## FAQ
|
|
59
|
-
|
|
60
|
-
### `yarn create umi` command failed
|
|
61
|
-
|
|
62
|
-
这个问题基本上都是因为没有添加 yarn global module 的路径到 PATH 环境变量引起的。
|
|
63
|
-
|
|
64
|
-
先执行 `yarn global bin` 拿到路径,然后添加到 PATH 环境变量里。
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
$ yarn global bin
|
|
68
|
-
/usr/local/bin
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
你也可以尝试用 npm,
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
$ npm create umi
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
或者手动安装 create-umi,并执行他,
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
$ npm install create-umi -g
|
|
81
|
-
$ create-umi
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Questions & Suggestions
|
|
85
|
-
|
|
86
|
-
Please open an issue [here](https://github.com/umijs/umi/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).
|
|
87
|
-
|
|
88
|
-
## LICENSE
|
|
89
|
-
|
|
90
|
-
MIT
|
|
3
|
+
See our website [umijs](https://umijs.org) for more information.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@umijs/utils");
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const args = (0, utils_1.yParser)(process.argv.slice(2), {
|
|
7
|
+
alias: {
|
|
8
|
+
version: ['v'],
|
|
9
|
+
help: ['h'],
|
|
10
|
+
},
|
|
11
|
+
boolean: ['version'],
|
|
12
|
+
});
|
|
13
|
+
if (args.version && !args._[0]) {
|
|
14
|
+
args._[0] = 'version';
|
|
15
|
+
const local = (0, fs_1.existsSync)((0, path_1.join)(__dirname, '../.local'))
|
|
16
|
+
? utils_1.chalk.cyan('@local')
|
|
17
|
+
: '';
|
|
18
|
+
const { name, version } = require('../package.json');
|
|
19
|
+
console.log(`${name}@${version}${local}`);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
require('./')
|
|
23
|
+
.default({
|
|
24
|
+
cwd: process.cwd(),
|
|
25
|
+
args,
|
|
26
|
+
})
|
|
27
|
+
.catch((err) => {
|
|
28
|
+
console.error(`Create failed, ${err.message}`);
|
|
29
|
+
console.error(err);
|
|
30
|
+
});
|
|
31
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const utils_1 = require("@umijs/utils");
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const testData = {
|
|
15
|
+
name: 'umi-plugin-demo',
|
|
16
|
+
description: 'nothing',
|
|
17
|
+
mail: 'xiaohuoni@gmail.com',
|
|
18
|
+
author: 'xiaohuoni',
|
|
19
|
+
org: 'umijs',
|
|
20
|
+
version: require('../package').version,
|
|
21
|
+
npmClient: 'pnpm',
|
|
22
|
+
registry: 'https://registry.npmjs.org/',
|
|
23
|
+
};
|
|
24
|
+
exports.default = ({ cwd, args, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const [_, name] = args._;
|
|
26
|
+
let npmClient = 'pnpm';
|
|
27
|
+
let registry = 'https://registry.npmjs.org/';
|
|
28
|
+
// test ignore prompts
|
|
29
|
+
if (!args.default) {
|
|
30
|
+
const response = yield (0, utils_1.prompts)([
|
|
31
|
+
{
|
|
32
|
+
type: 'select',
|
|
33
|
+
name: 'npmClient',
|
|
34
|
+
message: 'Pick Npm Client',
|
|
35
|
+
choices: [
|
|
36
|
+
{ title: 'npm', value: 'npm' },
|
|
37
|
+
{ title: 'cnpm', value: 'cnpm' },
|
|
38
|
+
{ title: 'tnpm', value: 'tnpm' },
|
|
39
|
+
{ title: 'yarn', value: 'yarn' },
|
|
40
|
+
{ title: 'pnpm', value: 'pnpm', selected: true },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'select',
|
|
45
|
+
name: 'registry',
|
|
46
|
+
message: 'Pick Bpm Registry',
|
|
47
|
+
choices: [
|
|
48
|
+
{
|
|
49
|
+
title: 'npm',
|
|
50
|
+
value: 'https://registry.npmjs.org/',
|
|
51
|
+
selected: true,
|
|
52
|
+
},
|
|
53
|
+
{ title: 'taobao', value: 'https://registry.npmmirror.com' },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
]);
|
|
57
|
+
npmClient = response.npmClient;
|
|
58
|
+
registry = response.registry;
|
|
59
|
+
}
|
|
60
|
+
const pluginPrompts = [
|
|
61
|
+
{
|
|
62
|
+
name: 'name',
|
|
63
|
+
type: 'text',
|
|
64
|
+
message: `What's the plugin name?`,
|
|
65
|
+
default: name,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'description',
|
|
69
|
+
type: 'text',
|
|
70
|
+
message: `What's your plugin used for?`,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'mail',
|
|
74
|
+
type: 'text',
|
|
75
|
+
message: `What's your email?`,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'author',
|
|
79
|
+
type: 'text',
|
|
80
|
+
message: `What's your name?`,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'org',
|
|
84
|
+
type: 'text',
|
|
85
|
+
message: `Which organization is your plugin stored under github?`,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
const generator = new utils_1.BaseGenerator({
|
|
89
|
+
path: (0, path_1.join)(__dirname, '..', 'templates', args.plugin ? 'plugin' : 'app'),
|
|
90
|
+
target: name ? (0, path_1.join)(cwd, name) : cwd,
|
|
91
|
+
data: args.default
|
|
92
|
+
? testData
|
|
93
|
+
: {
|
|
94
|
+
version: require('../package').version,
|
|
95
|
+
npmClient,
|
|
96
|
+
registry,
|
|
97
|
+
},
|
|
98
|
+
questions: args.default ? [] : args.plugin ? pluginPrompts : [],
|
|
99
|
+
});
|
|
100
|
+
yield generator.run();
|
|
101
|
+
if (!args.default) {
|
|
102
|
+
// install
|
|
103
|
+
(0, utils_1.installWithNpmClient)({ npmClient });
|
|
104
|
+
}
|
|
105
|
+
});
|
package/package.json
CHANGED
|
@@ -1,55 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-umi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"homepage": "https://github.com/umijs/create-umi",
|
|
6
|
-
"bugs":
|
|
7
|
-
"url": "https://github.com/umijs/create-umi/issues"
|
|
8
|
-
},
|
|
3
|
+
"version": "4.0.0-beta.13",
|
|
4
|
+
"description": "create-umi",
|
|
5
|
+
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/create-umi#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
9
7
|
"repository": {
|
|
10
8
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/umijs/
|
|
9
|
+
"url": "https://github.com/umijs/umi-next"
|
|
12
10
|
},
|
|
13
11
|
"license": "MIT",
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"index.js",
|
|
17
|
-
"lib"
|
|
18
|
-
],
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
19
14
|
"bin": {
|
|
20
|
-
"create-umi": "
|
|
15
|
+
"create-umi": "bin/create-umi.js"
|
|
21
16
|
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"templates"
|
|
20
|
+
],
|
|
22
21
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"prettier": "prettier -c --write '**/*'"
|
|
22
|
+
"build": "pnpm tsc",
|
|
23
|
+
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
24
|
+
"dev": "pnpm build -- --watch"
|
|
27
25
|
},
|
|
28
26
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"clipboardy": "^2.1.0",
|
|
31
|
-
"debug": "^4.1.1",
|
|
32
|
-
"execa": "^1.0.0",
|
|
33
|
-
"fs-extra": "^8.0.1",
|
|
34
|
-
"glob": "^7.1.4",
|
|
35
|
-
"inquirer": "^6.4.1",
|
|
36
|
-
"mkdirp": "^0.5.1",
|
|
37
|
-
"prettier": "^2.0.0",
|
|
38
|
-
"semver": "^6.1.0",
|
|
39
|
-
"sort-package-json": "^1.22.1",
|
|
40
|
-
"sylvanas": "^0.6.1",
|
|
41
|
-
"typescript": "^4.0.0",
|
|
42
|
-
"umi-utils": "^1.5.2",
|
|
43
|
-
"yargs-parser": "^13.1.1",
|
|
44
|
-
"yeoman-environment": "^2.8.0",
|
|
45
|
-
"yeoman-generator": "^4.0.1"
|
|
27
|
+
"@umijs/utils": "4.0.0-beta.13"
|
|
46
28
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"coffee": "^5.2.1",
|
|
50
|
-
"mm": "^2.5.0",
|
|
51
|
-
"np": "^5.0.1",
|
|
52
|
-
"umi-test": "^1.8.2"
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
53
31
|
},
|
|
54
32
|
"authors": [
|
|
55
33
|
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
registry={{{ registry }}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link, Outlet } from 'umi';
|
|
3
|
+
|
|
4
|
+
export default function Layout() {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<h2>global layout</h2>
|
|
8
|
+
<ul>
|
|
9
|
+
<li>
|
|
10
|
+
<Link to="/">Home</Link>
|
|
11
|
+
</li>
|
|
12
|
+
<li>
|
|
13
|
+
<Link to="/users">/users</Link>
|
|
14
|
+
</li>
|
|
15
|
+
<li>
|
|
16
|
+
<Link to="/users/foo">/users/foo</Link>
|
|
17
|
+
</li>
|
|
18
|
+
</ul>
|
|
19
|
+
<Outlet />
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"scripts": {
|
|
4
|
+
"dev": "umi dev",
|
|
5
|
+
"build": "umi build",
|
|
6
|
+
"postinstall": "umi setup",
|
|
7
|
+
"start": "npm run dev"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"umi": "^{{{ version }}}"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/react": "^17.0.0",
|
|
14
|
+
"@types/react-dom": "^17.0.0",
|
|
15
|
+
"typescript": "^4.1.2"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
registry={{{ registry }}}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# {{{ name }}}
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.org/package/{{{ name }}})
|
|
4
|
+
[](https://npmjs.org/package/{{{ name }}})
|
|
5
|
+
|
|
6
|
+
{{{ description }}}
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# or yarn
|
|
12
|
+
$ npm install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ npm run build --watch
|
|
17
|
+
$ npm run start
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Configure in `.umirc.js`,
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
export default {
|
|
26
|
+
plugins: [
|
|
27
|
+
['{{{ name }}}'],
|
|
28
|
+
],
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Options
|
|
33
|
+
|
|
34
|
+
TODO
|
|
35
|
+
|
|
36
|
+
## LICENSE
|
|
37
|
+
|
|
38
|
+
MIT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{{ name }}}",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "{{{ description }}}",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "father-build"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"repository": "{{{ org }}}/{{{ name }}}",
|
|
12
|
+
"authors": {
|
|
13
|
+
"name": "{{{ author }}}",
|
|
14
|
+
"email": "{{{ mail }}}"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"lib"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@umijs/types": "{{{ version }}}",
|
|
22
|
+
"father-build": "^1.20.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
## The new CHNAGELOG will be updated on the [Release page](https://github.com/umijs/create-umi/releases).
|
|
3
|
-
|
|
4
|
-
0.9.5 / 2019-01-14
|
|
5
|
-
==================
|
|
6
|
-
|
|
7
|
-
* enhance: add tests files (#32)
|
|
8
|
-
|
|
9
|
-
0.9.4 / 2019-01-14
|
|
10
|
-
==================
|
|
11
|
-
|
|
12
|
-
* fix: create with typescript (#31)
|
|
13
|
-
* fix: 少了一个分号 (#30)
|
|
14
|
-
|
|
15
|
-
0.9.3 / 2019-01-13
|
|
16
|
-
==================
|
|
17
|
-
|
|
18
|
-
* yarn create umi时报错 (#29)
|
|
19
|
-
|
|
20
|
-
0.9.2 / 2019-01-12
|
|
21
|
-
==================
|
|
22
|
-
|
|
23
|
-
* fix: create-umi not found, Close #26, Close #27
|
|
24
|
-
* fix: create-umi -v
|
|
25
|
-
|
|
26
|
-
0.9.1 / 2019-01-12
|
|
27
|
-
==================
|
|
28
|
-
|
|
29
|
-
* enable treeShaking by default
|
|
30
|
-
|
|
31
|
-
0.9.0 / 2019-01-12
|
|
32
|
-
==================
|
|
33
|
-
|
|
34
|
-
* refact: improve create-umi (#25)
|
|
35
|
-
* 重构一遍,结构清晰一些
|
|
36
|
-
* app 支持 TypeScript,Close #22, Close #17
|
|
37
|
-
* app 添加 ESLint 校验、treeShaking 配置
|
|
38
|
-
* 优化 ant-design-pro 仓库 clone 时间问题,Close #20
|
|
39
|
-
* 优化选择界面的提示文案,Close #24
|
|
40
|
-
|
|
41
|
-
0.8.1 / 2019-01-05
|
|
42
|
-
==================
|
|
43
|
-
|
|
44
|
-
* fix: update umi-plugin-library to ^1.0.1-0
|
package/cli.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const yParser = require('yargs-parser');
|
|
4
|
-
const semver = require('semver');
|
|
5
|
-
const { existsSync } = require('fs');
|
|
6
|
-
const { join } = require('path');
|
|
7
|
-
const chalk = require('chalk');
|
|
8
|
-
const run = require('./lib/run');
|
|
9
|
-
|
|
10
|
-
// print version and @local
|
|
11
|
-
const args = yParser(process.argv.slice(2));
|
|
12
|
-
|
|
13
|
-
if (args.v || args.version) {
|
|
14
|
-
console.log(require('./package').version);
|
|
15
|
-
if (existsSync(join(__dirname, '.local'))) {
|
|
16
|
-
console.log(chalk.cyan('@local'));
|
|
17
|
-
}
|
|
18
|
-
process.exit(0);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!semver.satisfies(process.version, '>= 8.0.0')) {
|
|
22
|
-
console.error(chalk.red('✘ The generator will only work with Node v8.0.0 and up!'));
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const name = args._[0] || '';
|
|
27
|
-
const { type } = args;
|
|
28
|
-
delete args.type;
|
|
29
|
-
|
|
30
|
-
(async () => {
|
|
31
|
-
await run({
|
|
32
|
-
name,
|
|
33
|
-
type,
|
|
34
|
-
args,
|
|
35
|
-
});
|
|
36
|
-
process.exit(0);
|
|
37
|
-
})();
|
package/index.js
DELETED
package/lib/BasicGenerator.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const Generator = require('yeoman-generator');
|
|
2
|
-
const glob = require('glob');
|
|
3
|
-
const { statSync } = require('fs');
|
|
4
|
-
const { basename } = require('path');
|
|
5
|
-
const debug = require('debug')('create-umi:BasicGenerator');
|
|
6
|
-
|
|
7
|
-
function noop() {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
class BasicGenerator extends Generator {
|
|
12
|
-
constructor(opts) {
|
|
13
|
-
super(opts);
|
|
14
|
-
this.opts = opts;
|
|
15
|
-
this.name = basename(opts.env.cwd);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
isTsFile(f) {
|
|
19
|
-
return f.endsWith('.ts') || f.endsWith('.tsx') || !!/(tsconfig\.json)/g.test(f);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
writeFiles({ context, filterFiles = noop }) {
|
|
23
|
-
// We have multiple welcome file, random this
|
|
24
|
-
const welcomeImages = glob
|
|
25
|
-
.sync('**/assets/welcomeImgs/*', {
|
|
26
|
-
cwd: this.templatePath(),
|
|
27
|
-
dot: true,
|
|
28
|
-
})
|
|
29
|
-
.filter(filterFiles);
|
|
30
|
-
|
|
31
|
-
if (welcomeImages.length) {
|
|
32
|
-
const welcomeImg = welcomeImages[Math.floor(Math.random() * welcomeImages.length)];
|
|
33
|
-
debug(`copy ${welcomeImg}`);
|
|
34
|
-
|
|
35
|
-
this.fs.copyTpl(
|
|
36
|
-
this.templatePath(welcomeImg),
|
|
37
|
-
this.destinationPath(welcomeImg.replace(/welcomeImgs.*$/, 'yay.jpg')),
|
|
38
|
-
context,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
debug(`context: ${JSON.stringify(context)}`);
|
|
43
|
-
glob
|
|
44
|
-
.sync('**/*', {
|
|
45
|
-
cwd: this.templatePath(),
|
|
46
|
-
dot: true,
|
|
47
|
-
})
|
|
48
|
-
.filter(filterFiles)
|
|
49
|
-
.filter(file => !file.includes('welcomeImgs'))
|
|
50
|
-
.forEach(file => {
|
|
51
|
-
debug(`copy ${file}`);
|
|
52
|
-
const filePath = this.templatePath(file);
|
|
53
|
-
if (statSync(filePath).isFile()) {
|
|
54
|
-
this.fs.copyTpl(
|
|
55
|
-
this.templatePath(filePath),
|
|
56
|
-
this.destinationPath(file.replace(/^_/, '.')),
|
|
57
|
-
context,
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
prompt(questions) {
|
|
64
|
-
process.send && process.send({ type: 'prompt' });
|
|
65
|
-
process.emit('message', { type: 'prompt' });
|
|
66
|
-
return super.prompt(questions);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
module.exports = BasicGenerator;
|