create-umi 0.25.1 → 4.0.0-beta.12

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.
Files changed (134) hide show
  1. package/README.md +2 -97
  2. package/bin/create-umi.js +3 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +31 -0
  5. package/dist/index.d.ts +6 -0
  6. package/dist/index.js +105 -0
  7. package/package.json +18 -40
  8. package/templates/app/.gitignore.tpl +8 -0
  9. package/templates/app/.npmrc.tpl +1 -0
  10. package/templates/app/.umirc.ts.tpl +3 -0
  11. package/templates/app/layouts/index.tsx +22 -0
  12. package/templates/app/package.json.tpl +17 -0
  13. package/templates/app/pages/index.tsx +5 -0
  14. package/templates/app/pages/users/foo.tsx +3 -0
  15. package/templates/app/pages/users.tsx +9 -0
  16. package/templates/plugin/.fatherrc.ts +5 -0
  17. package/templates/plugin/.gitignore.tpl +2 -0
  18. package/templates/plugin/.npmrc.tpl +1 -0
  19. package/templates/plugin/README.md.tpl +38 -0
  20. package/templates/plugin/package.json.tpl +24 -0
  21. package/templates/plugin/src/index.ts.tpl +5 -0
  22. package/CHANGELOG.md +0 -44
  23. package/cli.js +0 -37
  24. package/index.js +0 -3
  25. package/lib/BasicGenerator.js +0 -70
  26. package/lib/generators/ant-design-pro/.babelrc +0 -10
  27. package/lib/generators/ant-design-pro/README.md +0 -57
  28. package/lib/generators/ant-design-pro/filterPkg.js +0 -15
  29. package/lib/generators/ant-design-pro/index.js +0 -232
  30. package/lib/generators/ant-design-pro/meta.json +0 -3
  31. package/lib/generators/app/index.js +0 -69
  32. package/lib/generators/app/meta.json +0 -3
  33. package/lib/generators/app/templates/.editorconfig +0 -16
  34. package/lib/generators/app/templates/.env +0 -2
  35. package/lib/generators/app/templates/.eslintrc +0 -3
  36. package/lib/generators/app/templates/.prettierignore +0 -7
  37. package/lib/generators/app/templates/.prettierrc +0 -11
  38. package/lib/generators/app/templates/.umirc.js +0 -37
  39. package/lib/generators/app/templates/.umirc.ts +0 -40
  40. package/lib/generators/app/templates/_gitignore +0 -18
  41. package/lib/generators/app/templates/mock/.gitkeep +0 -0
  42. package/lib/generators/app/templates/package.json +0 -60
  43. package/lib/generators/app/templates/src/app.js +0 -8
  44. package/lib/generators/app/templates/src/app.ts +0 -8
  45. package/lib/generators/app/templates/src/assets/welcomeImgs/0.jpg +0 -0
  46. package/lib/generators/app/templates/src/assets/welcomeImgs/1.jpg +0 -0
  47. package/lib/generators/app/templates/src/global.css +0 -7
  48. package/lib/generators/app/templates/src/layouts/__tests__/index.test.js +0 -14
  49. package/lib/generators/app/templates/src/layouts/__tests__/index.test.tsx +0 -16
  50. package/lib/generators/app/templates/src/layouts/index.css +0 -15
  51. package/lib/generators/app/templates/src/layouts/index.js +0 -12
  52. package/lib/generators/app/templates/src/layouts/index.tsx +0 -13
  53. package/lib/generators/app/templates/src/locales/en-US.js +0 -3
  54. package/lib/generators/app/templates/src/locales/en-US.ts +0 -3
  55. package/lib/generators/app/templates/src/models/.gitkeep +0 -0
  56. package/lib/generators/app/templates/src/pages/__tests__/__mocks__/umi-plugin-locale.js +0 -1
  57. package/lib/generators/app/templates/src/pages/__tests__/__mocks__/umi-plugin-locale.ts +0 -1
  58. package/lib/generators/app/templates/src/pages/__tests__/index.test.js +0 -19
  59. package/lib/generators/app/templates/src/pages/__tests__/index.test.tsx +0 -21
  60. package/lib/generators/app/templates/src/pages/index.css +0 -23
  61. package/lib/generators/app/templates/src/pages/index.js +0 -18
  62. package/lib/generators/app/templates/src/pages/index.tsx +0 -19
  63. package/lib/generators/app/templates/tsconfig.json +0 -18
  64. package/lib/generators/app/templates/typings.d.ts +0 -2
  65. package/lib/generators/app/templates/webpack.config.js +0 -12
  66. package/lib/generators/block/index.js +0 -56
  67. package/lib/generators/block/meta.json +0 -3
  68. package/lib/generators/block/templates/.prettierignore +0 -7
  69. package/lib/generators/block/templates/.prettierrc +0 -11
  70. package/lib/generators/block/templates/.umirc.js +0 -5
  71. package/lib/generators/block/templates/.umirc.ts +0 -9
  72. package/lib/generators/block/templates/LICENSE +0 -21
  73. package/lib/generators/block/templates/README.md +0 -13
  74. package/lib/generators/block/templates/_gitignore +0 -7
  75. package/lib/generators/block/templates/package.json +0 -27
  76. package/lib/generators/block/templates/src/index.css +0 -3
  77. package/lib/generators/block/templates/src/index.js +0 -9
  78. package/lib/generators/block/templates/src/index.tsx +0 -12
  79. package/lib/generators/block/templates/tsconfig.json +0 -18
  80. package/lib/generators/block/templates/typings.d.ts +0 -2
  81. package/lib/generators/library/index.js +0 -55
  82. package/lib/generators/library/meta.json +0 -3
  83. package/lib/generators/library/templates/.fatherrc.js +0 -4
  84. package/lib/generators/library/templates/.fatherrc.ts +0 -9
  85. package/lib/generators/library/templates/.prettierignore +0 -5
  86. package/lib/generators/library/templates/.prettierrc +0 -11
  87. package/lib/generators/library/templates/LICENSE +0 -21
  88. package/lib/generators/library/templates/README.md +0 -13
  89. package/lib/generators/library/templates/_gitignore +0 -5
  90. package/lib/generators/library/templates/package.json +0 -28
  91. package/lib/generators/library/templates/src/index.css +0 -4
  92. package/lib/generators/library/templates/src/index.js +0 -15
  93. package/lib/generators/library/templates/src/index.mdx +0 -18
  94. package/lib/generators/library/templates/src/index.tsx +0 -21
  95. package/lib/generators/library/templates/tsconfig.json +0 -17
  96. package/lib/generators/library/templates/typings.d.ts +0 -2
  97. package/lib/generators/plugin/index.js +0 -81
  98. package/lib/generators/plugin/meta.json +0 -3
  99. package/lib/generators/plugin/templates/.editorconfig +0 -16
  100. package/lib/generators/plugin/templates/.fatherrc.js +0 -35
  101. package/lib/generators/plugin/templates/.fatherrc.ts +0 -35
  102. package/lib/generators/plugin/templates/.gitignore +0 -8
  103. package/lib/generators/plugin/templates/.prettierignore +0 -8
  104. package/lib/generators/plugin/templates/.prettierrc +0 -14
  105. package/lib/generators/plugin/templates/CONTRIBUTING.md +0 -40
  106. package/lib/generators/plugin/templates/README.md +0 -51
  107. package/lib/generators/plugin/templates/example/.gitignore +0 -5
  108. package/lib/generators/plugin/templates/example/.umirc.js +0 -8
  109. package/lib/generators/plugin/templates/example/.umirc.ts +0 -8
  110. package/lib/generators/plugin/templates/example/app.jsx +0 -3
  111. package/lib/generators/plugin/templates/example/app.tsx +0 -3
  112. package/lib/generators/plugin/templates/example/package.json +0 -3
  113. package/lib/generators/plugin/templates/example/pages/index.css +0 -17
  114. package/lib/generators/plugin/templates/example/pages/index.jsx +0 -8
  115. package/lib/generators/plugin/templates/example/pages/index.tsx +0 -8
  116. package/lib/generators/plugin/templates/example/tsconfig.json +0 -37
  117. package/lib/generators/plugin/templates/example/typing.d.ts +0 -2
  118. package/lib/generators/plugin/templates/jest.config.js +0 -8
  119. package/lib/generators/plugin/templates/package.json +0 -65
  120. package/lib/generators/plugin/templates/src/index.js +0 -26
  121. package/lib/generators/plugin/templates/src/index.ts +0 -29
  122. package/lib/generators/plugin/templates/test/fixtures/normal/.umirc.js +0 -4
  123. package/lib/generators/plugin/templates/test/fixtures/normal/.umirc.ts +0 -4
  124. package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.css +0 -4
  125. package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.jsx +0 -10
  126. package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.tsx +0 -11
  127. package/lib/generators/plugin/templates/test/fixtures/normal/test.js +0 -10
  128. package/lib/generators/plugin/templates/test/fixtures/normal/test.ts +0 -10
  129. package/lib/generators/plugin/templates/test/index.e2e.js +0 -5
  130. package/lib/generators/plugin/templates/test/index.e2e.ts +0 -5
  131. package/lib/generators/plugin/templates/tsconfig.json +0 -23
  132. package/lib/generators/plugin/templates/ui/index.jsx +0 -28
  133. package/lib/generators/plugin/templates/ui/index.tsx +0 -29
  134. package/lib/run.js +0 -76
package/README.md CHANGED
@@ -1,98 +1,3 @@
1
- # create-umi
1
+ # @umijs/create-umi
2
2
 
3
- Creates a UmiJS application/plugin/block/library using the command line.
4
-
5
- [![codecov](https://codecov.io/gh/umijs/create-umi/branch/master/graph/badge.svg)](https://codecov.io/gh/umijs/create-umi)
6
- [![NPM version](https://img.shields.io/npm/v/create-umi.svg?style=flat)](https://npmjs.org/package/create-umi)
7
- [![CircleCI](https://circleci.com/gh/umijs/create-umi/tree/master.svg?style=svg)](https://circleci.com/gh/umijs/create-umi/tree/master)
8
- [![NPM downloads](http://img.shields.io/npm/dm/create-umi.svg?style=flat)](https://npmjs.org/package/create-umi)
9
- [![GitHub Actions status](https://github.com/umijs/create-umi/workflows/Node%20CI/badge.svg)](https://github.com/umijs/create-umi)
10
-
11
- ## Usage
12
-
13
- ```bash
14
- $ yarn create umi [appName]
15
- ```
16
-
17
- ## Boilerplates
18
-
19
- * `ant-design-pro` - Create project with a layout-only ant-design-pro boilerplate, use together with umi block.
20
- * `app ` - Create project with a simple boilerplate, support typescript.
21
- * `block ` - Create a umi block.
22
- * `library ` - Create a library with umi.
23
- * `plugin ` - Create a umi plugin.
24
-
25
- ## Usage Example
26
-
27
- ```bash
28
- $ yarn create umi
29
-
30
- ? Select the boilerplate type (Use arrow keys)
31
- ant-design-pro - Create project with a layout-only ant-design-pro boilerplate, use together with umi block.
32
- ❯ app - Create project with a simple boilerplate, support typescript.
33
- block - Create a umi block.
34
- library - Create a library with umi.
35
- plugin - Create a umi plugin.
36
-
37
- ? Do you want to use typescript? (y/N)
38
-
39
- ? What functionality do you want to enable? (Press <space> to select, <a> to toggle all, <i> to invert selection)
40
- ❯◯ antd
41
- ◯ dva
42
- ◯ code splitting
43
- ◯ dll
44
-
45
- create abc/package.json
46
- create abc/.gitignore
47
- create abc/.editorconfig
48
- create abc/.env
49
- create abc/.eslintrc
50
- create abc/.prettierignore
51
- create abc/.prettierrc
52
- create abc/.umirc.js
53
- create abc/mock/.gitkeep
54
- create abc/src/assets/yay.jpg
55
- create abc/src/global.css
56
- create abc/src/layouts/index.css
57
- create abc/src/layouts/index.tsx
58
- create abc/src/pages/index.css
59
- create abc/src/pages/index.tsx
60
- create abc/tsconfig.json
61
- create abc/typings.d.ts
62
- 📋 Copied to clipboard, just use Ctrl+V
63
- ✨ File Generate Done
64
- ```
65
-
66
- ## FAQ
67
-
68
- ### `yarn create umi` command failed
69
-
70
- 这个问题基本上都是因为没有添加 yarn global module 的路径到 PATH 环境变量引起的。
71
-
72
- 先执行 `yarn global bin` 拿到路径,然后添加到 PATH 环境变量里。
73
-
74
- ```bash
75
- $ yarn global bin
76
- /usr/local/bin
77
- ```
78
-
79
- 你也可以尝试用 npm,
80
-
81
- ```bash
82
- $ npm create umi
83
- ```
84
-
85
- 或者手动安装 create-umi,并执行他,
86
-
87
- ```bash
88
- $ npm install create-umi -g
89
- $ create-umi
90
- ```
91
-
92
- ## Questions & Suggestions
93
-
94
- Please open an issue [here](https://github.com/umijs/umi/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).
95
-
96
- ## LICENSE
97
-
98
- MIT
3
+ See our website [umijs](https://umijs.org) for more information.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/cli');
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
+ }
@@ -0,0 +1,6 @@
1
+ import { yParser } from '@umijs/utils';
2
+ declare const _default: ({ cwd, args, }: {
3
+ cwd: string;
4
+ args: yParser.Arguments;
5
+ }) => Promise<void>;
6
+ export default _default;
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.25.1",
4
- "description": "Creates a UmiJS application using the command line.",
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.12",
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/create-umi"
9
+ "url": "https://github.com/umijs/umi-next"
12
10
  },
13
11
  "license": "MIT",
14
- "files": [
15
- "cli.js",
16
- "index.js",
17
- "lib"
18
- ],
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
19
14
  "bin": {
20
- "create-umi": "cli.js"
15
+ "create-umi": "bin/create-umi.js"
21
16
  },
17
+ "files": [
18
+ "dist",
19
+ "templates"
20
+ ],
22
21
  "scripts": {
23
- "prepublishOnly": "np --no-cleanup --yolo --no-publish",
24
- "test": "umi-test test/index.test.js",
25
- "cov": "umi-test test/index.test.js --coverage",
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
- "chalk": "4.0.0",
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": "^1.17.0",
38
- "semver": "^6.1.0",
39
- "sort-package-json": "^1.22.1",
40
- "sylvanas": "^0.6.1",
41
- "typescript": "^3.8.3",
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.12"
46
28
  },
47
- "devDependencies": {
48
- "@types/jest": "^24.0.19",
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,8 @@
1
+ /node_modules
2
+ /.env.local
3
+ /.umirc.local.ts
4
+ /.umirc.local.js
5
+ /config/config.local.ts
6
+ /config/config.local.js
7
+ /src/.umi
8
+ /.umi
@@ -0,0 +1 @@
1
+ registry={{{ registry }}}
@@ -0,0 +1,3 @@
1
+ export default {
2
+ npmClient: '{{{ npmClient }}}'
3
+ };
@@ -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,5 @@
1
+ import React from 'react';
2
+
3
+ export default function HomePage() {
4
+ return <div>HomePage</div>;
5
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+
3
+ export default () => <h2>user: Foo</h2>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ export default () => {
4
+ return (
5
+ <div>
6
+ <h2>users layout</h2>
7
+ </div>
8
+ );
9
+ };
@@ -0,0 +1,5 @@
1
+ export default {
2
+ target: 'node',
3
+ cjs: { type: 'babel', lazy: true },
4
+ disableTypeCheck: true,
5
+ };
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ lib
@@ -0,0 +1 @@
1
+ registry={{{ registry }}}
@@ -0,0 +1,38 @@
1
+ # {{{ name }}}
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/{{{ name }}}.svg?style=flat)](https://npmjs.org/package/{{{ name }}})
4
+ [![NPM downloads](http://img.shields.io/npm/dm/{{{ name }}}.svg?style=flat)](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
+ }
@@ -0,0 +1,5 @@
1
+ import type { IApi } from '@umijs/types';
2
+
3
+ export default (api: IApi) => {
4
+ // TODO: https://umijs.org/plugins/api
5
+ };
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
@@ -1,3 +0,0 @@
1
- const run = require('./lib/run');
2
-
3
- module.exports.run = run;
@@ -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;
@@ -1,10 +0,0 @@
1
- {
2
- "plugins": [
3
- [
4
- "@babel/plugin-transform-typescript",
5
- {
6
- "isTSX": true
7
- }
8
- ]
9
- ]
10
- }