create-umi 0.25.0 → 4.0.0-beta.11
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 -97
- 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 +16 -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/block/index.js +0 -56
- package/lib/generators/block/meta.json +0 -3
- package/lib/generators/block/templates/.prettierignore +0 -7
- package/lib/generators/block/templates/.prettierrc +0 -11
- package/lib/generators/block/templates/.umirc.js +0 -5
- package/lib/generators/block/templates/.umirc.ts +0 -9
- package/lib/generators/block/templates/LICENSE +0 -21
- package/lib/generators/block/templates/README.md +0 -13
- package/lib/generators/block/templates/_gitignore +0 -7
- package/lib/generators/block/templates/package.json +0 -27
- package/lib/generators/block/templates/src/index.css +0 -3
- package/lib/generators/block/templates/src/index.js +0 -9
- package/lib/generators/block/templates/src/index.tsx +0 -12
- package/lib/generators/block/templates/tsconfig.json +0 -18
- package/lib/generators/block/templates/typings.d.ts +0 -2
- package/lib/generators/library/index.js +0 -55
- package/lib/generators/library/meta.json +0 -3
- package/lib/generators/library/templates/.fatherrc.js +0 -4
- package/lib/generators/library/templates/.fatherrc.ts +0 -9
- package/lib/generators/library/templates/.prettierignore +0 -5
- package/lib/generators/library/templates/.prettierrc +0 -11
- package/lib/generators/library/templates/LICENSE +0 -21
- package/lib/generators/library/templates/README.md +0 -13
- package/lib/generators/library/templates/_gitignore +0 -5
- package/lib/generators/library/templates/package.json +0 -28
- package/lib/generators/library/templates/src/index.css +0 -4
- package/lib/generators/library/templates/src/index.js +0 -15
- package/lib/generators/library/templates/src/index.mdx +0 -18
- package/lib/generators/library/templates/src/index.tsx +0 -21
- package/lib/generators/library/templates/tsconfig.json +0 -17
- package/lib/generators/library/templates/typings.d.ts +0 -2
- 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
|
@@ -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;
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const formatMessage = () => 'Mock text';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const formatMessage = (): string => 'Mock text';
|
|
@@ -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,56 +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 block name?`,
|
|
9
|
-
default: this.name,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: 'description',
|
|
13
|
-
message: `What's your block description?`,
|
|
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: 'repo',
|
|
25
|
-
message: `Which repo is your block stored under github?`,
|
|
26
|
-
default: 'umijs/umi-blocks',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'isTypeScript',
|
|
30
|
-
type: 'confirm',
|
|
31
|
-
message: 'Do you want to use typescript?',
|
|
32
|
-
default: false,
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
return this.prompt(prompts).then(props => {
|
|
36
|
-
this.prompts = props;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
writing() {
|
|
41
|
-
this.writeFiles({
|
|
42
|
-
context: this.prompts,
|
|
43
|
-
filterFiles: f => {
|
|
44
|
-
const { isTypeScript } = this.prompts;
|
|
45
|
-
if (isTypeScript) {
|
|
46
|
-
if (f.endsWith('.js')) return false;
|
|
47
|
-
} else {
|
|
48
|
-
if (this.isTsFile(f)) return false;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = Generator;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019-present <%= author %> (<%= mail %>)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@umi-block/<%= name %>",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "<%= description %>",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"authors": {
|
|
7
|
-
"name": "<%= author %>",
|
|
8
|
-
"email": "<%= mail %>"
|
|
9
|
-
},
|
|
10
|
-
"repository": "<%= repo %>/<%= name %>",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"dev": "umi dev"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"react": ">=16.0.0"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"umi": "^2.9.0",
|
|
19
|
-
<% if (isTypeScript) { -%>
|
|
20
|
-
"umi-plugin-block-dev": "^2.0.0",
|
|
21
|
-
"umi-types": "^0.3.0"
|
|
22
|
-
<% } else { -%>
|
|
23
|
-
"umi-plugin-block-dev": "^2.0.0"
|
|
24
|
-
<% } -%>
|
|
25
|
-
},
|
|
26
|
-
"license": "MIT"
|
|
27
|
-
}
|
|
@@ -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,55 +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 library name?`,
|
|
9
|
-
default: this.name,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: 'description',
|
|
13
|
-
message: `What's your library description?`,
|
|
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: 'repo',
|
|
25
|
-
message: `Which repo is your library stored under github?`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'isTypeScript',
|
|
29
|
-
type: 'confirm',
|
|
30
|
-
message: 'Do you want to use typescript?',
|
|
31
|
-
default: false,
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
return this.prompt(prompts).then(props => {
|
|
35
|
-
this.prompts = props;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
writing() {
|
|
40
|
-
this.writeFiles({
|
|
41
|
-
context: this.prompts,
|
|
42
|
-
filterFiles: f => {
|
|
43
|
-
const { isTypeScript } = this.prompts;
|
|
44
|
-
if (isTypeScript) {
|
|
45
|
-
if (f.endsWith('.js')) return false;
|
|
46
|
-
} else {
|
|
47
|
-
if (this.isTsFile(f)) return false;
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = Generator;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019-present <%= author %> (<%= mail %>)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<%= name %>",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "<%= description %>",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.esm.js",
|
|
7
|
-
"authors": {
|
|
8
|
-
"name": "<%= author %>",
|
|
9
|
-
"email": "<%= mail %>"
|
|
10
|
-
},
|
|
11
|
-
"repository": "<%= repo %>/<%= name %>",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"dev": "father doc dev",
|
|
14
|
-
"build": "father build"
|
|
15
|
-
},
|
|
16
|
-
"peerDependencies": {
|
|
17
|
-
"react": "16.x"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
<% if (isTypeScript) { -%>
|
|
21
|
-
"father": "^2.16.0",
|
|
22
|
-
"typescript": "^3.3.3"
|
|
23
|
-
<% } else { -%>
|
|
24
|
-
"father": "^2.16.0"
|
|
25
|
-
<% } -%>
|
|
26
|
-
},
|
|
27
|
-
"license": "MIT"
|
|
28
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styles from './index.css';
|
|
3
|
-
|
|
4
|
-
export default function(props) {
|
|
5
|
-
return (
|
|
6
|
-
<button
|
|
7
|
-
className={styles.button}
|
|
8
|
-
style={{
|
|
9
|
-
fontSize: props.size === 'large' ? 40 : 20,
|
|
10
|
-
}}
|
|
11
|
-
>
|
|
12
|
-
{ props.children }
|
|
13
|
-
</button>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styles from './index.css';
|
|
3
|
-
|
|
4
|
-
export interface ButtonProps {
|
|
5
|
-
size?: 'large' | 'default';
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Button: React.FC<ButtonProps> = function(props) {
|
|
9
|
-
return (
|
|
10
|
-
<button
|
|
11
|
-
className={styles.button}
|
|
12
|
-
style={{
|
|
13
|
-
fontSize: props.size === 'large' ? 40 : 20,
|
|
14
|
-
}}
|
|
15
|
-
>
|
|
16
|
-
{props.children}
|
|
17
|
-
</button>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default Button;
|