create-umi 0.27.0 → 4.0.0-beta.14

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 (103) hide show
  1. package/README.md +2 -89
  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 -183
  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/plugin/index.js +0 -81
  67. package/lib/generators/plugin/meta.json +0 -3
  68. package/lib/generators/plugin/templates/.editorconfig +0 -16
  69. package/lib/generators/plugin/templates/.fatherrc.js +0 -35
  70. package/lib/generators/plugin/templates/.fatherrc.ts +0 -35
  71. package/lib/generators/plugin/templates/.gitignore +0 -8
  72. package/lib/generators/plugin/templates/.prettierignore +0 -8
  73. package/lib/generators/plugin/templates/.prettierrc +0 -14
  74. package/lib/generators/plugin/templates/CONTRIBUTING.md +0 -40
  75. package/lib/generators/plugin/templates/README.md +0 -51
  76. package/lib/generators/plugin/templates/example/.gitignore +0 -5
  77. package/lib/generators/plugin/templates/example/.umirc.js +0 -8
  78. package/lib/generators/plugin/templates/example/.umirc.ts +0 -8
  79. package/lib/generators/plugin/templates/example/app.jsx +0 -3
  80. package/lib/generators/plugin/templates/example/app.tsx +0 -3
  81. package/lib/generators/plugin/templates/example/package.json +0 -3
  82. package/lib/generators/plugin/templates/example/pages/index.css +0 -17
  83. package/lib/generators/plugin/templates/example/pages/index.jsx +0 -8
  84. package/lib/generators/plugin/templates/example/pages/index.tsx +0 -8
  85. package/lib/generators/plugin/templates/example/tsconfig.json +0 -37
  86. package/lib/generators/plugin/templates/example/typing.d.ts +0 -2
  87. package/lib/generators/plugin/templates/jest.config.js +0 -8
  88. package/lib/generators/plugin/templates/package.json +0 -66
  89. package/lib/generators/plugin/templates/src/index.js +0 -26
  90. package/lib/generators/plugin/templates/src/index.ts +0 -29
  91. package/lib/generators/plugin/templates/test/fixtures/normal/.umirc.js +0 -4
  92. package/lib/generators/plugin/templates/test/fixtures/normal/.umirc.ts +0 -4
  93. package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.css +0 -4
  94. package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.jsx +0 -10
  95. package/lib/generators/plugin/templates/test/fixtures/normal/pages/index.tsx +0 -11
  96. package/lib/generators/plugin/templates/test/fixtures/normal/test.js +0 -10
  97. package/lib/generators/plugin/templates/test/fixtures/normal/test.ts +0 -10
  98. package/lib/generators/plugin/templates/test/index.e2e.js +0 -5
  99. package/lib/generators/plugin/templates/test/index.e2e.ts +0 -5
  100. package/lib/generators/plugin/templates/tsconfig.json +0 -23
  101. package/lib/generators/plugin/templates/ui/index.jsx +0 -28
  102. package/lib/generators/plugin/templates/ui/index.tsx +0 -29
  103. package/lib/run.js +0 -76
@@ -1,57 +0,0 @@
1
- # Ant Design Pro
2
-
3
- This project is initialized with [Ant Design Pro](https://pro.ant.design). Follow is the quick guide for how to use.
4
-
5
- ## Environment Prepare
6
-
7
- Install `node_modules`:
8
-
9
- ```bash
10
- npm install
11
- ```
12
-
13
- or
14
-
15
- ```bash
16
- yarn
17
- ```
18
-
19
- ## Provided Scripts
20
-
21
- Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test.
22
-
23
- Scripts provided in `package.json`. It's safe to modify or add additional script:
24
-
25
- ### Start project
26
-
27
- ```bash
28
- npm start
29
- ```
30
-
31
- ### Build project
32
-
33
- ```bash
34
- npm run build
35
- ```
36
-
37
- ### Check code style
38
-
39
- ```bash
40
- npm run lint
41
- ```
42
-
43
- You can also use script to auto fix some lint error:
44
-
45
- ```bash
46
- npm run lint:fix
47
- ```
48
-
49
- ### Test code
50
-
51
- ```bash
52
- npm test
53
- ```
54
-
55
- ## More
56
-
57
- You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro).
@@ -1,15 +0,0 @@
1
- const filterPkg = (pkgObject, ignoreList) => {
2
- const devObj = {};
3
- Object.keys(pkgObject).forEach(key => {
4
- const isIgnore = ignoreList.some(reg => {
5
- return new RegExp(reg).test(key);
6
- });
7
- if (isIgnore) {
8
- return;
9
- }
10
- devObj[key] = pkgObject[key];
11
- });
12
- return devObj;
13
- };
14
-
15
- module.exports = filterPkg;
@@ -1,183 +0,0 @@
1
- const fs = require('fs-extra');
2
- const path = require('path');
3
- const chalk = require('chalk');
4
- const glob = require('glob');
5
- const exec = require('execa');
6
- const rimraf = require('rimraf');
7
- const BasicGenerator = require('../../BasicGenerator');
8
- const filterPkg = require('./filterPkg');
9
- const prettier = require('prettier');
10
- const sylvanas = require('sylvanas');
11
- const sortPackage = require('sort-package-json');
12
- const { getFastGithub } = require('umi-utils');
13
-
14
- function log(...args) {
15
- console.log(`${chalk.gray('>')}`, ...args);
16
- }
17
-
18
- function globList(patternList, options) {
19
- let fileList = [];
20
- patternList.forEach(pattern => {
21
- fileList = [...fileList, ...glob.sync(pattern, options)];
22
- });
23
-
24
- return fileList;
25
- }
26
-
27
- const getGithubUrl = async () => {
28
- const fastGithub = await getFastGithub();
29
- if (fastGithub === 'gitee.com' || fastGithub === 'github.com.cnpmjs.org') {
30
- return 'https://gitee.com/ant-design/ant-design-pro';
31
- }
32
- return 'https://github.com/ant-design/ant-design-pro';
33
- };
34
-
35
- class AntDesignProGenerator extends BasicGenerator {
36
- prompting() {
37
- if (this.opts.args.language) {
38
- this.prompts = {
39
- language: this.opts.args.language,
40
- };
41
- } else {
42
- const prompts = [
43
- {
44
- name: 'language',
45
- type: 'list',
46
- message: '🤓 Which language do you want to use?',
47
- choices: ['TypeScript', 'JavaScript'],
48
- default: 'TypeScript',
49
- },
50
- {
51
- name: 'allBlocks',
52
- type: 'list',
53
- message: '🚀 Do you need all the blocks or a simple scaffold?',
54
- choices: ['simple', 'complete'],
55
- default: 'simple',
56
- },
57
- ];
58
- return this.prompt(prompts).then(props => {
59
- this.prompts = props;
60
- });
61
- }
62
- }
63
-
64
- async writing() {
65
- const { language = 'TypeScript', allBlocks, } = this.prompts;
66
-
67
- const isTypeScript = language === 'TypeScript';
68
- const projectName = this.opts.name || this.opts.env.cwd;
69
- const projectPath = path.resolve(projectName);
70
-
71
- const envOptions = {
72
- cwd: projectPath,
73
- };
74
-
75
- const githubUrl = await getGithubUrl();
76
- const gitArgs = [`clone`, githubUrl, `--depth=1`];
77
-
78
- // all-blocks 分支上包含了所有的区块
79
- if (allBlocks === 'complete') {
80
- log(`🙈 complete mode can only use the version of antd@4`);
81
- gitArgs.push('--branch', 'all-blocks');
82
- }
83
-
84
- gitArgs.push(projectName);
85
-
86
- // // 没有提供关闭的配置
87
- // // https://github.com/yeoman/environment/blob/9880bc7d5b26beff9f0b4d5048c672a85ce4bcaa/lib/util/repository.js#L50
88
- const yoConfigPth = path.join(projectPath, '.yo-repository');
89
- if (fs.existsSync(yoConfigPth)) {
90
- // 删除 .yo-repository
91
- rimraf.sync(yoConfigPth);
92
- }
93
-
94
- if (
95
- fs.existsSync(projectPath) &&
96
- fs.statSync(projectPath).isDirectory() &&
97
- fs.readdirSync(projectPath).length > 0
98
- ) {
99
- console.log('\n');
100
- console.log(`🙈 请在空文件夹中使用,或者使用 ${chalk.red('yarn create umi myapp')}`);
101
- console.log(`🙈 Please select an empty folder, or use ${chalk.red('yarn create umi myapp')}`);
102
- process.exit(1);
103
- }
104
-
105
- // Clone remote branch
106
- // log(`git ${[`clone`, githubUrl].join(' ')}`);
107
- await exec(
108
- `git`,
109
- gitArgs,
110
- process.env.TEST
111
- ? {}
112
- : {
113
- stdout: process.stdout,
114
- stderr: process.stderr,
115
- stdin: process.stdin,
116
- },
117
- );
118
-
119
- log(`🚚 clone success`);
120
-
121
- const packageJsonPath = path.resolve(projectPath, 'package.json');
122
- const pkg = require(packageJsonPath);
123
- // Handle js version
124
- if (!isTypeScript) {
125
- log('[Sylvanas] Prepare js environment...');
126
- const tsFiles = globList(['**/*.tsx', '**/*.ts'], {
127
- ...envOptions,
128
- ignore: ['**/*.d.ts'],
129
- });
130
-
131
- sylvanas(tsFiles, {
132
- ...envOptions,
133
- action: 'overwrite',
134
- });
135
-
136
- log('[JS] Clean up...');
137
- const removeTsFiles = globList(['tsconfig.json', '**/*.d.ts'], envOptions);
138
- removeTsFiles.forEach(filePath => {
139
- const targetPath = path.resolve(projectPath, filePath);
140
- fs.removeSync(targetPath);
141
- });
142
- }
143
-
144
- // copy readme
145
- const babelConfig = path.resolve(__dirname, 'README.md');
146
- fs.copySync(babelConfig, path.resolve(projectPath, 'README.md'));
147
-
148
- // gen package.json
149
- if (pkg['create-umi']) {
150
- const { ignoreScript = [], ignoreDependencies = [] } = pkg['create-umi'];
151
- // filter scripts and devDependencies
152
- const projectPkg = {
153
- ...pkg,
154
- scripts: filterPkg(pkg.scripts, ignoreScript),
155
- devDependencies: filterPkg(pkg.devDependencies, ignoreDependencies),
156
- };
157
- // remove create-umi config
158
- delete projectPkg['create-umi'];
159
- fs.writeFileSync(
160
- path.resolve(projectPath, 'package.json'),
161
- // 删除一个包之后 json会多了一些空行。sortPackage 可以删除掉并且排序
162
- // prettier 会容忍一个空行
163
- prettier.format(JSON.stringify(sortPackage(projectPkg)), {
164
- parser: 'json',
165
- }),
166
- );
167
- }
168
-
169
- // Clean up useless files
170
- if (pkg['create-umi'] && pkg['create-umi'].ignore) {
171
- log('Clean up...');
172
- const ignoreFiles = pkg['create-umi'].ignore;
173
- const fileList = globList(ignoreFiles, envOptions);
174
-
175
- fileList.forEach(filePath => {
176
- const targetPath = path.resolve(projectPath, filePath);
177
- fs.removeSync(targetPath);
178
- });
179
- }
180
- }
181
- }
182
-
183
- module.exports = AntDesignProGenerator;
@@ -1,3 +0,0 @@
1
- {
2
- "description": "Create project with a layout-only ant-design-pro boilerplate, use together with umi block."
3
- }
@@ -1,69 +0,0 @@
1
- const debug = require('debug')('create-umi:generator');
2
- const BasicGenerator = require('../../BasicGenerator');
3
-
4
- class Generator extends BasicGenerator {
5
- prompting() {
6
- if (this.opts.args && 'isTypeScript' in this.opts.args && 'reactFeatures' in this.opts.args) {
7
- this.prompts = {
8
- isTypeScript: this.opts.args.isTypeScript,
9
- reactFeatures: this.opts.args.reactFeatures,
10
- };
11
- } else {
12
- const prompts = [
13
- {
14
- name: 'isTypeScript',
15
- type: 'confirm',
16
- message: 'Do you want to use typescript?',
17
- default: false,
18
- },
19
- {
20
- name: 'reactFeatures',
21
- message: 'What functionality do you want to enable?',
22
- type: 'checkbox',
23
- choices: [
24
- {name: 'antd', value: 'antd'},
25
- {name: 'dva', value: 'dva'},
26
- {name: 'code splitting', value: 'dynamicImport'},
27
- {name: 'dll', value: 'dll'},
28
- {name: 'internationalization', value: 'locale'},
29
- ],
30
- },
31
- ];
32
- return this.prompt(prompts).then(props => {
33
- this.prompts = props;
34
- });
35
- }
36
- }
37
-
38
- writing() {
39
- this.writeFiles({
40
- context: {
41
- name: this.name,
42
- ...this.prompts,
43
- },
44
- filterFiles: f => {
45
- const { isTypeScript, reactFeatures } = this.prompts;
46
- if (isTypeScript) {
47
- if (f.endsWith('.js')) return false;
48
- if (!reactFeatures.includes('dva')) {
49
- if (f.startsWith('src/models') || f === 'src/app.ts') return false;
50
- }
51
- if (!reactFeatures.includes('locale')) {
52
- if (f.startsWith('src/locales') || f.includes('umi-plugin-locale')) return false;
53
- }
54
- } else {
55
- if (this.isTsFile(f)) return false;
56
- if (!reactFeatures.includes('dva')) {
57
- if (f.startsWith('src/models') || f === 'src/app.js') return false;
58
- }
59
- if (!reactFeatures.includes('locale')) {
60
- if (f.startsWith('src/locales') || f.includes('umi-plugin-locale')) return false;
61
- }
62
- }
63
- return true;
64
- },
65
- });
66
- }
67
- }
68
-
69
- module.exports = Generator;
@@ -1,3 +0,0 @@
1
- {
2
- "description": "Create project with a simple boilerplate, support typescript."
3
- }
@@ -1,16 +0,0 @@
1
- # http://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.md]
13
- trim_trailing_whitespace = false
14
-
15
- [Makefile]
16
- indent_style = tab
@@ -1,2 +0,0 @@
1
- BROWSER=none
2
- ESLINT=1
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "eslint-config-umi"
3
- }
@@ -1,7 +0,0 @@
1
- **/*.md
2
- **/*.svg
3
- **/*.ejs
4
- **/*.html
5
- package.json
6
- .umi
7
- .umi-production
@@ -1,11 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "trailingComma": "all",
4
- "printWidth": 100,
5
- "overrides": [
6
- {
7
- "files": ".prettierrc",
8
- "options": { "parser": "json" }
9
- }
10
- ]
11
- }
@@ -1,37 +0,0 @@
1
-
2
- // ref: https://umijs.org/config/
3
- export default {
4
- treeShaking: true,
5
- routes: [
6
- {
7
- path: '/',
8
- component: '../layouts/index',
9
- routes: [
10
- { path: '/', component: '../pages/index' }
11
- ]
12
- }
13
- ],
14
- plugins: [
15
- // ref: https://umijs.org/plugin/umi-plugin-react.html
16
- ['umi-plugin-react', {
17
- antd: <% if (reactFeatures.includes('antd')) { %>true<% } else { %>false<% } %>,
18
- dva: <% if (reactFeatures.includes('dva')) { %>true<% } else { %>false<% } %>,
19
- dynamicImport: <% if (reactFeatures.includes('dynamicImport')) { %>{ webpackChunkName: true }<% } else { %>false<% } %>,
20
- title: '<%= name %>',
21
- dll: <% if (reactFeatures.includes('dll')) { %>true<% } else { %>false<% } %>,
22
- <% if (reactFeatures.includes('locale')) { %>locale: {
23
- enable: true,
24
- default: 'en-US',
25
- },<% } %>
26
- routes: {
27
- exclude: [<% if (reactFeatures.includes('dva')) { %>
28
- /models\//,
29
- /services\//,
30
- /model\.(t|j)sx?$/,
31
- /service\.(t|j)sx?$/,<% } %>
32
- /components\//,
33
- ],
34
- },
35
- }],
36
- ],
37
- }
@@ -1,40 +0,0 @@
1
- import { IConfig } from 'umi-types';
2
-
3
- // ref: https://umijs.org/config/
4
- const config: IConfig = {
5
- treeShaking: true,
6
- routes: [
7
- {
8
- path: '/',
9
- component: '../layouts/index',
10
- routes: [
11
- { path: '/', component: '../pages/index' }
12
- ]
13
- }
14
- ],
15
- plugins: [
16
- // ref: https://umijs.org/plugin/umi-plugin-react.html
17
- ['umi-plugin-react', {
18
- antd: <% if (reactFeatures.includes('antd')) { %>true<% } else { %>false<% } %>,
19
- dva: <% if (reactFeatures.includes('dva')) { %>true<% } else { %>false<% } %>,
20
- dynamicImport: <% if (reactFeatures.includes('dynamicImport')) { %>{ webpackChunkName: true }<% } else { %>false<% } %>,
21
- title: '<%= name %>',
22
- dll: <% if (reactFeatures.includes('dll')) { %>true<% } else { %>false<% } %>,
23
- <% if (reactFeatures.includes('locale')) { %>locale: {
24
- enable: true,
25
- default: 'en-US',
26
- },<% } %>
27
- routes: {
28
- exclude: [<% if (reactFeatures.includes('dva')) { %>
29
- /models\//,
30
- /services\//,
31
- /model\.(t|j)sx?$/,
32
- /service\.(t|j)sx?$/,<% } %>
33
- /components\//,
34
- ],
35
- },
36
- }],
37
- ],
38
- }
39
-
40
- export default config;
@@ -1,18 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
-
3
- # dependencies
4
- /node_modules
5
- /npm-debug.log*
6
- /yarn-error.log
7
- /yarn.lock
8
- /package-lock.json
9
-
10
- # production
11
- /dist
12
-
13
- # misc
14
- .DS_Store
15
-
16
- # umi
17
- .umi
18
- .umi-production
File without changes
@@ -1,60 +0,0 @@
1
- {
2
- "private": true,
3
- "scripts": {
4
- "start": "umi dev",
5
- "build": "umi build",
6
- "test": "umi test",
7
- <% if (isTypeScript) { -%>
8
- "lint": "eslint {src,mock,tests}/**/*.{ts,tsx} --fix",
9
- <% } -%>
10
- <% if (!isTypeScript) { -%>
11
- "lint": "eslint {src,mock,tests}/**/*.{js,jsx} --fix",
12
- <% } -%>
13
- "precommit": "lint-staged"
14
- },
15
- "dependencies": {
16
- <% if (reactFeatures.includes('dva')) { -%>
17
- "dva": "^2.6.0-beta.6",
18
- <% } -%>
19
- <% if (reactFeatures.includes('antd')) { -%>
20
- "antd": "^3.19.5",
21
- <% } -%>
22
- "react": "^16.8.6",
23
- "react-dom": "^16.8.6"
24
- },
25
- "devDependencies": {
26
- <% if (isTypeScript) { -%>
27
- "@types/jest": "^23.3.12",
28
- "@types/react": "^16.7.18",
29
- "@types/react-dom": "^16.0.11",
30
- "@types/react-test-renderer": "^16.0.3",
31
- <% } -%>
32
- "babel-eslint": "^9.0.0",
33
- "eslint": "^5.4.0",
34
- "eslint-config-umi": "^1.4.0",
35
- "eslint-plugin-flowtype": "^2.50.0",
36
- "eslint-plugin-import": "^2.14.0",
37
- "eslint-plugin-jsx-a11y": "^5.1.1",
38
- "eslint-plugin-react": "^7.11.1",
39
- "husky": "^0.14.3",
40
- "lint-staged": "^7.2.2",
41
- "react-test-renderer": "^16.7.0",
42
- <% if (isTypeScript) { -%>
43
- "umi": "^2.9.0",
44
- "umi-plugin-react": "^1.8.0",
45
- "umi-types": "^0.3.0"
46
- <% } else { -%>
47
- "umi": "^2.7.7",
48
- "umi-plugin-react": "^1.8.4"
49
- <% } -%>
50
- },
51
- "lint-staged": {
52
- <% if (isTypeScript) { -%>
53
- "*.{ts,tsx}": ["eslint --fix", "git add"],
54
- <% } -%>
55
- "*.{js,jsx}": ["eslint --fix", "git add"]
56
- },
57
- "engines": {
58
- "node": ">=8.0.0"
59
- }
60
- }
@@ -1,8 +0,0 @@
1
- export const dva = {
2
- config: {
3
- onError(err) {
4
- err.preventDefault();
5
- console.error(err.message);
6
- },
7
- },
8
- };
@@ -1,8 +0,0 @@
1
- export const dva = {
2
- config: {
3
- onError(err: ErrorEvent) {
4
- err.preventDefault();
5
- console.error(err.message);
6
- },
7
- },
8
- };
@@ -1,7 +0,0 @@
1
- html, body, #root {
2
- height: 100%;
3
- }
4
-
5
- body {
6
- margin: 0;
7
- }
@@ -1,14 +0,0 @@
1
- import BasicLayout from '..';
2
- import renderer from 'react-test-renderer';
3
-
4
- describe('Layout: BasicLayout', () => {
5
- it('Render correctly', () => {
6
- const wrapper = renderer.create(<BasicLayout />);
7
- expect(wrapper.root.children.length).toBe(1);
8
- const outerLayer = wrapper.root.children[0];
9
- expect(outerLayer.type).toBe('div');
10
- const title = outerLayer.children[0];
11
- expect(title.type).toBe('h1');
12
- expect(title.children[0]).toBe('Yay! Welcome to umi!');
13
- });
14
- });
@@ -1,16 +0,0 @@
1
- import 'jest';
2
- import BasicLayout from '..';
3
- import React from 'react';
4
- import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';
5
-
6
- describe('Layout: BasicLayout', () => {
7
- it('Render correctly', () => {
8
- const wrapper: ReactTestRenderer = renderer.create(<BasicLayout />);
9
- expect(wrapper.root.children.length).toBe(1);
10
- const outerLayer = wrapper.root.children[0] as ReactTestInstance;
11
- expect(outerLayer.type).toBe('div');
12
- const title = outerLayer.children[0] as ReactTestInstance;
13
- expect(title.type).toBe('h1');
14
- expect(title.children[0]).toBe('Yay! Welcome to umi!');
15
- });
16
- });
@@ -1,15 +0,0 @@
1
-
2
- .normal {
3
- font-family: Georgia, sans-serif;
4
- text-align: center;
5
- }
6
-
7
- .title {
8
- font-size: 2.5rem;
9
- font-weight: normal;
10
- letter-spacing: -1px;
11
- background: darkslateblue;
12
- padding: .6em 0;
13
- color: white;
14
- margin: 0;
15
- }
@@ -1,12 +0,0 @@
1
- import styles from './index.css';
2
-
3
- function BasicLayout(props) {
4
- return (
5
- <div className={styles.normal}>
6
- <h1 className={styles.title}>Yay! Welcome to umi!</h1>
7
- {props.children}
8
- </div>
9
- );
10
- }
11
-
12
- export default BasicLayout;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import styles from './index.css';
3
-
4
- const BasicLayout: React.FC = props => {
5
- return (
6
- <div className={styles.normal}>
7
- <h1 className={styles.title}>Yay! Welcome to umi!</h1>
8
- {props.children}
9
- </div>
10
- );
11
- };
12
-
13
- export default BasicLayout;
@@ -1,3 +0,0 @@
1
- export default {
2
- 'index.start': 'Getting Started',
3
- }
@@ -1,3 +0,0 @@
1
- export default {
2
- 'index.start': 'Getting Started',
3
- }
File without changes
@@ -1 +0,0 @@
1
- export const formatMessage = () => 'Mock text';
@@ -1 +0,0 @@
1
- export const formatMessage = (): string => 'Mock text';