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,19 +0,0 @@
1
- import Index from '..';
2
- import renderer from 'react-test-renderer';
3
-
4
- <% if (reactFeatures.includes('locale')) { %>jest.mock('umi-plugin-locale');
5
- <% } %>
6
- describe('Page: index', () => {
7
- it('Render correctly', () => {
8
- const wrapper = renderer.create(<Index />);
9
- expect(wrapper.root.children.length).toBe(1);
10
- const outerLayer = wrapper.root.children[0];
11
- expect(outerLayer.type).toBe('div');
12
- expect(outerLayer.children.length).toBe(2);
13
- <% if (reactFeatures.includes('locale')) { %>const getStartLink = outerLayer.findAllByProps({
14
- href: 'https://umijs.org/guide/getting-started.html',
15
- });
16
- expect(getStartLink.length).toBe(1);
17
- expect(getStartLink[0].children).toMatchObject(['Mock text']);<% } %>
18
- });
19
- });
@@ -1,21 +0,0 @@
1
- import 'jest';
2
- import Index from '..';
3
- import React from 'react';
4
- import renderer, { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';
5
-
6
- <% if (reactFeatures.includes('locale')) { %>jest.mock('umi-plugin-locale');
7
- <% } %>
8
- describe('Page: index', () => {
9
- it('Render correctly', () => {
10
- const wrapper: ReactTestRenderer = renderer.create(<Index />);
11
- expect(wrapper.root.children.length).toBe(1);
12
- const outerLayer = wrapper.root.children[0] as ReactTestInstance;
13
- expect(outerLayer.type).toBe('div');
14
- expect(outerLayer.children.length).toBe(2);
15
- <% if (reactFeatures.includes('locale')) { %>const getStartLink = outerLayer.findAllByProps({
16
- href: 'https://umijs.org/guide/getting-started.html',
17
- }) as ReactTestInstance[];
18
- expect(getStartLink.length).toBe(1);
19
- expect(getStartLink[0].children).toMatchObject(['Mock text']);<% } %>
20
- });
21
- });
@@ -1,23 +0,0 @@
1
-
2
- .normal {
3
- font-family: Georgia, sans-serif;
4
- margin-top: 4em;
5
- text-align: center;
6
- }
7
-
8
- .welcome {
9
- height: 512px;
10
- background: url(../assets/yay.jpg) no-repeat center 0;
11
- background-size: 512px 512px;
12
- }
13
-
14
- .list {
15
- font-size: 1.2em;
16
- margin: 1.8em 0 0;
17
- list-style: none;
18
- line-height: 1.5em;
19
- }
20
-
21
- .list code {
22
- background: #f7f7f7;
23
- }
@@ -1,18 +0,0 @@
1
- import styles from './index.css';
2
- <% if (reactFeatures.includes('locale')) { %>import { formatMessage } from 'umi-plugin-locale';<% } -%>
3
-
4
- export default function() {
5
- return (
6
- <div className={styles.normal}>
7
- <div className={styles.welcome} />
8
- <ul className={styles.list}>
9
- <li>To get started, edit <code>src/pages/index.js</code> and save to reload.</li>
10
- <li>
11
- <a href="https://umijs.org/guide/getting-started.html">
12
- <% if (reactFeatures.includes('locale')) { %>{formatMessage({ id: 'index.start' })}<% } else { %>Getting Started<% } %>
13
- </a>
14
- </li>
15
- </ul>
16
- </div>
17
- );
18
- }
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import styles from './index.css';
3
- <% if (reactFeatures.includes('locale')) { %>import { formatMessage } from 'umi-plugin-locale';<% } -%>
4
-
5
- export default function() {
6
- return (
7
- <div className={styles.normal}>
8
- <div className={styles.welcome} />
9
- <ul className={styles.list}>
10
- <li>To get started, edit <code>src/pages/index.js</code> and save to reload.</li>
11
- <li>
12
- <a href="https://umijs.org/guide/getting-started.html">
13
- <% if (reactFeatures.includes('locale')) { %>{formatMessage({ id: 'index.start' })}<% } else { %>Getting Started<% } %>
14
- </a>
15
- </li>
16
- </ul>
17
- </div>
18
- );
19
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "importHelpers": true,
7
- "jsx": "react",
8
- "esModuleInterop": true,
9
- "sourceMap": true,
10
- "baseUrl": ".",
11
- "strict": true,
12
- "paths": {
13
- "@/*": ["src/*"],
14
- "@tmp/*": ["src/pages/.umi/*"]
15
- },
16
- "allowSyntheticDefaultImports": true
17
- }
18
- }
@@ -1,2 +0,0 @@
1
- declare module '*.css';
2
- declare module "*.png";
@@ -1,12 +0,0 @@
1
- /**
2
- * 不是真实的 webpack 配置,仅为兼容 webstorm 和 intellij idea 代码跳转
3
- * ref: https://github.com/umijs/umi/issues/1109#issuecomment-423380125
4
- */
5
-
6
- module.exports = {
7
- resolve: {
8
- alias: {
9
- '@': require('path').resolve(__dirname, 'src'),
10
- },
11
- },
12
- };
@@ -1,81 +0,0 @@
1
- const BasicGenerator = require('../../BasicGenerator');
2
-
3
- class Generator extends BasicGenerator {
4
- prompting() {
5
- const prompts = [
6
- {
7
- name: 'name',
8
- message: `What's the plugin name?`,
9
- default: this.name,
10
- },
11
- {
12
- name: 'description',
13
- message: `What's your plugin used for?`,
14
- },
15
- {
16
- name: 'mail',
17
- message: `What's your email?`,
18
- },
19
- {
20
- name: 'author',
21
- message: `What's your name?`,
22
- },
23
- {
24
- name: 'org',
25
- message: `Which organization is your plugin stored under github?`,
26
- },
27
- {
28
- name: 'isTypeScript',
29
- type: 'list',
30
- message: 'Select the development language',
31
- choices: [
32
- {
33
- name: 'TypeScript',
34
- value: true,
35
- },
36
- {
37
- name: 'JavaScript',
38
- value: false,
39
- },
40
- ],
41
- default: true,
42
- },
43
- {
44
- name: 'withUmiUI',
45
- type: 'confirm',
46
- message: 'Does your plugin have ui interaction(umi ui)?',
47
- default: false,
48
- },
49
- ];
50
- return this.prompt(prompts).then(props => {
51
- this.prompts = props;
52
- });
53
- }
54
-
55
- // lang: ts || js
56
- isUIFiles(file, lang) {
57
- const uiFile = lang === 'ts' ? 'ui/index.tsx' : 'ui/index.jsx';
58
- return file === uiFile;
59
- }
60
-
61
- writing() {
62
- this.writeFiles({
63
- context: this.prompts,
64
- filterFiles: f => {
65
- const { isTypeScript = true, withUmiUI } = this.prompts;
66
- if (isTypeScript) {
67
- if (f.endsWith('.js') || f.endsWith('.jsx')) return false;
68
- // filter ui files
69
- if (!withUmiUI && this.isUIFiles(f, 'ts')) return false;
70
- } else {
71
- if (this.isTsFile(f)) return false;
72
- // filter ui files
73
- if (!withUmiUI && this.isUIFiles(f)) return false;
74
- }
75
- return true;
76
- },
77
- });
78
- }
79
- }
80
-
81
- module.exports = Generator;
@@ -1,3 +0,0 @@
1
- {
2
- "description": "Create a umi plugin."
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,35 +0,0 @@
1
- <% if (withUmiUI) { -%>
2
- const isProd = process.env.NODE_ENV === 'prod';
3
-
4
- <% } -%>
5
- export default [{
6
- target: 'node',
7
- cjs: { type: 'babel', lazy: true },
8
- disableTypeCheck: true,
9
- extraBabelPlugins: [
10
- [
11
- 'babel-plugin-import',
12
- { libraryName: 'antd', libraryDirectory: 'es', style: true },
13
- 'antd',
14
- ],
15
- ],
16
- <% if (withUmiUI) { -%>
17
- },
18
- {
19
- entry: 'ui/index.tsx',
20
- umd: {
21
- name: 'tasks',
22
- minFile: isProd,
23
- sourcemap: !isProd,
24
- },
25
- extraExternals: ['antd', 'react', 'react-dom', 'xterm'],
26
- typescriptOpts: {
27
- check: false,
28
- globals: {
29
- antd: 'window.antd',
30
- react: 'window.React',
31
- 'react-dom': 'window.ReactDOM',
32
- },
33
- },
34
- <% } -%>
35
- }];
@@ -1,35 +0,0 @@
1
- <% if (withUmiUI) { -%>
2
- const isProd = process.env.NODE_ENV === 'prod';
3
-
4
- <% } -%>
5
- export default [{
6
- target: 'node',
7
- cjs: { type: 'babel', lazy: true },
8
- disableTypeCheck: true,
9
- extraBabelPlugins: [
10
- [
11
- 'babel-plugin-import',
12
- { libraryName: 'antd', libraryDirectory: 'es', style: true },
13
- 'antd',
14
- ],
15
- ],
16
- <% if (withUmiUI) { -%>
17
- },
18
- {
19
- entry: 'ui/index.tsx',
20
- umd: {
21
- name: 'tasks',
22
- minFile: isProd,
23
- sourcemap: !isProd,
24
- },
25
- extraExternals: ['antd', 'react', 'react-dom', 'xterm'],
26
- typescriptOpts: {
27
- check: false,
28
- globals: {
29
- antd: 'window.antd',
30
- react: 'window.React',
31
- 'react-dom': 'window.ReactDOM',
32
- },
33
- },
34
- <% } -%>
35
- }];
@@ -1,8 +0,0 @@
1
- node_modules
2
- .changelog
3
- .umi
4
- .umi-test
5
- .umi-production
6
- .DS_Store
7
- /lib
8
- dist
@@ -1,8 +0,0 @@
1
- **/node_modules/**
2
- package.json
3
-
4
- # fixtures
5
- **/fixtures/**
6
-
7
- # templates
8
- **/templates/**
@@ -1,14 +0,0 @@
1
- {
2
- "printWidth": 80,
3
- "singleQuote": true,
4
- "trailingComma": "all",
5
- "proseWrap": "never",
6
- "overrides": [
7
- {
8
- "files": ".prettierrc",
9
- "options": {
10
- "parser": "json"
11
- }
12
- }
13
- ]
14
- }
@@ -1,40 +0,0 @@
1
- # Contributing to plugin
2
-
3
- ## Set up
4
-
5
- Install dev deps after git clone the repo.
6
-
7
- ```bash
8
- # npm is not allowed.
9
- $ yarn
10
- ```
11
-
12
- ## Build
13
-
14
- Transform with babel and rollup.
15
-
16
- ```bash
17
- $ yarn build
18
-
19
- # Build and monitor file changes
20
- $ yarn build --watch
21
-
22
- ```
23
-
24
- ## Dev Plugin
25
-
26
- ```bash
27
- # This Step must only be executed in Build
28
- $ yarn dev
29
- ```
30
-
31
- ## Debug
32
-
33
- TODO
34
-
35
- ## Test
36
-
37
- ```bash
38
- $ yarn test
39
- ```
40
-
@@ -1,51 +0,0 @@
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
- <% if (withUmiUI) { -%>
15
- ## Development UI
16
-
17
- UI mini start:
18
-
19
- ```bash
20
- $ npm run build --watch
21
- $ npm run start
22
- ```
23
-
24
- <img src="https://user-images.githubusercontent.com/13595509/67024897-bbeede80-f137-11e9-9f19-6a3f0ea3f6cd.png" width="768" />
25
- <% } else { -%>
26
-
27
- ```bash
28
- $ npm run build --watch
29
- $ npm run start
30
- ```
31
- <% } -%>
32
-
33
- ## Usage
34
-
35
- Configure in `.umirc.js`,
36
-
37
- ```js
38
- export default {
39
- plugins: [
40
- ['<%= name %>'],
41
- ],
42
- }
43
- ```
44
-
45
- ## Options
46
-
47
- TODO
48
-
49
- ## LICENSE
50
-
51
- MIT
@@ -1,5 +0,0 @@
1
- /.umi
2
- /.umi-production
3
- /dist
4
- /node_modules
5
- /yarn.lock
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'umi';
2
-
3
- export default defineConfig({
4
- <% if (withUmiUI) { -%>
5
- presets: [require.resolve('@umijs/preset-ui')],
6
- <% } -%>
7
- plugins: [require.resolve('../lib')],
8
- });
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'umi';
2
-
3
- export default defineConfig({
4
- <% if (withUmiUI) { -%>
5
- presets: [require.resolve('@umijs/preset-ui')],
6
- <% } -%>
7
- plugins: [require.resolve('../lib')],
8
- });
@@ -1,3 +0,0 @@
1
- export function render(oldRender) {
2
- oldRender();
3
- }
@@ -1,3 +0,0 @@
1
- export function render(oldRender: Function) {
2
- oldRender();
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "dependencies": {}
3
- }
@@ -1,17 +0,0 @@
1
- body,
2
- html,
3
- #root {
4
- height: 100%;
5
- margin: 0;
6
- }
7
-
8
- a {
9
- color: #1890ff;
10
- cursor: pointer;
11
- }
12
-
13
- .normal {
14
- background: #ddd;
15
- height: 100vh;
16
- padding: 48px;
17
- }
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import styles from './index.css';
3
-
4
- export default () => (
5
- <div className={styles.normal}>
6
- Hello Umi!
7
- </div>
8
- );
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import styles from './index.css';
3
-
4
- export default () => (
5
- <div className={styles.normal}>
6
- Hello Umi!
7
- </div>
8
- );
@@ -1,37 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "build/dist",
4
- "module": "esnext",
5
- "target": "esnext",
6
- "lib": ["esnext", "dom"],
7
- "sourceMap": true,
8
- "baseUrl": ".",
9
- "jsx": "react",
10
- "allowSyntheticDefaultImports": true,
11
- "moduleResolution": "node",
12
- "forceConsistentCasingInFileNames": true,
13
- "noImplicitReturns": true,
14
- "suppressImplicitAnyIndexErrors": true,
15
- "noUnusedLocals": true,
16
- "allowJs": true,
17
- "skipLibCheck": true,
18
- "experimentalDecorators": true,
19
- "strict": true,
20
- "paths": {
21
- "@/*": ["/*"],
22
- "@@/*": ["/.umi/*"]
23
- }
24
- },
25
- "exclude": [
26
- "node_modules",
27
- "build",
28
- "dist",
29
- "scripts",
30
- "acceptance-tests",
31
- "webpack",
32
- "jest",
33
- "src/setupTests.ts",
34
- "tslint:latest",
35
- "tslint-config-prettier"
36
- ]
37
- }
@@ -1,2 +0,0 @@
1
- declare module '*.css';
2
- declare module '*.less';
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- moduleNameMapper(memo) {
3
- return Object.assign(memo, {
4
- '^react$': require.resolve('react'),
5
- '^react-dom$': require.resolve('react-dom'),
6
- });
7
- },
8
- };
@@ -1,66 +0,0 @@
1
- {
2
- "name": "<%= name %>",
3
- "main": "lib/index.js",
4
- "description": "<%= description %>",
5
- "authors": {
6
- "name": "<%= author %>",
7
- "email": "<%= mail %>"
8
- },
9
- "repository": "<%= org %>/<%= name %>",
10
- "scripts": {
11
- "start": "cross-env APP_ROOT=example umi dev",
12
- "build": "father-build",
13
- "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
14
- "test": "umi-test",
15
- "test:coverage": "umi-test --coverage",
16
- "test:update": "umi-test --updateSnapshot"
17
- },
18
- "lint-staged": {
19
- "*.ts?(x)": [
20
- "prettier --parser=typescript --write",
21
- "git add"
22
- ],
23
- "*.{js,jsx,less,md,json}": [
24
- "prettier --write",
25
- "git add"
26
- ]
27
- },
28
- "devDependencies": {
29
- "@testing-library/react": "^9.4.0",
30
- "@testing-library/react-hooks": "^3.2.1",
31
- "@types/jest": "^25.1.3",
32
- "@types/node": "^13.7.7",
33
- <% if (withUmiUI) { -%>
34
- "@umijs/preset-ui": "^2.1.13",
35
- <% } -%>
36
- "@umijs/test": "^3.0.10",
37
- "@umijs/test-utils": "^1.0.0",
38
- "babel-plugin-import": "^1.13.3",
39
- "body-parser": "^1.18.2",
40
- "cross-env": "^6.0.3",
41
- "express": "^4.15.3",
42
- "father-build": "^1.17.2",
43
- "lerna": "^3.20.2",
44
- "lint-staged": "^10.0.8",
45
- "npm-run-all": "^4.1.5",
46
- "pify": "^5.0.0",
47
- "prettier": "^1.19.1",
48
- "puppeteer": "^1.20.0",
49
- "query-string": "^6.11.1",
50
- "react": "^16.12.0",
51
- "react-dom": "^16.12.0",
52
- "react-test-renderer": "^16.9.0",
53
- "test-umi-plugin": "^0.1.0",
54
- "umi": "^3.1.0",
55
- "yorkie": "^2.0.0"
56
- },
57
- "gitHooks": {
58
- "pre-commit": "lint-staged"
59
- },
60
- "files": [
61
- <% if (withUmiUI) { -%>
62
- "dist",
63
- <% } -%>
64
- "lib"
65
- ]
66
- }
@@ -1,26 +0,0 @@
1
- // ref:
2
- // - https://umijs.org/plugins/api
3
- <% if (withUmiUI) { -%>
4
- import { join } from 'path';
5
- <% } -%>
6
-
7
- export default function (api) {
8
- api.logger.info('use plugin');
9
-
10
- api.modifyHTML(($) => {
11
- $('body').prepend(`<h1>hello umi plugin</h1>`);
12
- return $;
13
- });
14
-
15
- <% if (withUmiUI) { -%>
16
- api.addUIPlugin(() => join(__dirname, '../dist/index.umd.js'));
17
-
18
- api.onUISocket(({ action, failure, success }) => {
19
- if (action.type === 'org.xiaohuoni.demo.test') {
20
- success({
21
- data: 'demo.test',
22
- });
23
- }
24
- });
25
- <% } -%>
26
- }