create-umi 0.25.1 → 0.27.1
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 +4 -12
- package/lib/BasicGenerator.js +2 -2
- package/lib/generators/ant-design-pro/index.js +7 -54
- package/lib/generators/plugin/templates/package.json +1 -0
- package/lib/run.js +4 -4
- package/package.json +3 -3
- package/CHANGELOG.md +0 -44
- 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/templates/.gitignore +0 -8
- package/lib/generators/plugin/templates/example/.gitignore +0 -5
package/README.md
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Creates a UmiJS application/plugin/block/library using the command line.
|
|
4
4
|
|
|
5
|
-
[](https://codecov.io/gh/umijs/create-umi)
|
|
6
|
-
[](https://npmjs.org/package/create-umi)
|
|
7
|
-
[](https://circleci.com/gh/umijs/create-umi/tree/master)
|
|
8
|
-
[](https://npmjs.org/package/create-umi)
|
|
9
|
-
[](https://github.com/umijs/create-umi)
|
|
5
|
+
[](https://codecov.io/gh/umijs/create-umi) [](https://npmjs.org/package/create-umi) [](https://circleci.com/gh/umijs/create-umi/tree/master) [](https://npmjs.org/package/create-umi) [](https://github.com/umijs/create-umi)
|
|
10
6
|
|
|
11
7
|
## Usage
|
|
12
8
|
|
|
@@ -16,11 +12,9 @@ $ yarn create umi [appName]
|
|
|
16
12
|
|
|
17
13
|
## Boilerplates
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* `library ` - Create a library with umi.
|
|
23
|
-
* `plugin ` - Create a umi plugin.
|
|
15
|
+
- `ant-design-pro` - Create project with a layout-only ant-design-pro boilerplate, use together with umi block.
|
|
16
|
+
- `app` - Create project with a simple boilerplate, support typescript.
|
|
17
|
+
- `plugin` - Create a umi plugin.
|
|
24
18
|
|
|
25
19
|
## Usage Example
|
|
26
20
|
|
|
@@ -30,8 +24,6 @@ $ yarn create umi
|
|
|
30
24
|
? Select the boilerplate type (Use arrow keys)
|
|
31
25
|
ant-design-pro - Create project with a layout-only ant-design-pro boilerplate, use together with umi block.
|
|
32
26
|
❯ app - Create project with a simple boilerplate, support typescript.
|
|
33
|
-
block - Create a umi block.
|
|
34
|
-
library - Create a library with umi.
|
|
35
27
|
plugin - Create a umi plugin.
|
|
36
28
|
|
|
37
29
|
? Do you want to use typescript? (y/N)
|
package/lib/BasicGenerator.js
CHANGED
|
@@ -46,8 +46,8 @@ class BasicGenerator extends Generator {
|
|
|
46
46
|
dot: true,
|
|
47
47
|
})
|
|
48
48
|
.filter(filterFiles)
|
|
49
|
-
.filter(file => !file.includes('welcomeImgs'))
|
|
50
|
-
.forEach(file => {
|
|
49
|
+
.filter((file) => !file.includes('welcomeImgs'))
|
|
50
|
+
.forEach((file) => {
|
|
51
51
|
debug(`copy ${file}`);
|
|
52
52
|
const filePath = this.templatePath(file);
|
|
53
53
|
if (statSync(filePath).isFile()) {
|
|
@@ -17,7 +17,7 @@ function log(...args) {
|
|
|
17
17
|
|
|
18
18
|
function globList(patternList, options) {
|
|
19
19
|
let fileList = [];
|
|
20
|
-
patternList.forEach(pattern => {
|
|
20
|
+
patternList.forEach((pattern) => {
|
|
21
21
|
fileList = [...fileList, ...glob.sync(pattern, options)];
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -40,30 +40,12 @@ class AntDesignProGenerator extends BasicGenerator {
|
|
|
40
40
|
};
|
|
41
41
|
} else {
|
|
42
42
|
const prompts = [
|
|
43
|
-
{
|
|
44
|
-
name: 'nextPro',
|
|
45
|
-
type: 'list',
|
|
46
|
-
choices: ['Pro V5', 'Pro V4'],
|
|
47
|
-
message: '🧙 Be the first to experience the new umi@3 ?',
|
|
48
|
-
default: 'Pro V4',
|
|
49
|
-
when: () => {
|
|
50
|
-
// 为了测试,没有任何用处
|
|
51
|
-
process.send && process.send({ type: 'prompt' });
|
|
52
|
-
process.emit('message', { type: 'prompt' });
|
|
53
|
-
return true;
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
43
|
{
|
|
57
44
|
name: 'language',
|
|
58
45
|
type: 'list',
|
|
59
46
|
message: '🤓 Which language do you want to use?',
|
|
60
47
|
choices: ['TypeScript', 'JavaScript'],
|
|
61
48
|
default: 'TypeScript',
|
|
62
|
-
when: ({ nextPro }) => {
|
|
63
|
-
process.send && process.send({ type: 'prompt' });
|
|
64
|
-
process.emit('message', { type: 'prompt' });
|
|
65
|
-
return nextPro === 'Pro V4';
|
|
66
|
-
},
|
|
67
49
|
},
|
|
68
50
|
{
|
|
69
51
|
name: 'allBlocks',
|
|
@@ -71,33 +53,16 @@ class AntDesignProGenerator extends BasicGenerator {
|
|
|
71
53
|
message: '🚀 Do you need all the blocks or a simple scaffold?',
|
|
72
54
|
choices: ['simple', 'complete'],
|
|
73
55
|
default: 'simple',
|
|
74
|
-
when: ({ nextPro }) => {
|
|
75
|
-
process.send && process.send({ type: 'prompt' });
|
|
76
|
-
process.emit('message', { type: 'prompt' });
|
|
77
|
-
return nextPro === 'Pro V4';
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'nextAntd',
|
|
82
|
-
type: 'list',
|
|
83
|
-
choices: ['antd@4', 'antd@3'],
|
|
84
|
-
when: ({ allBlocks, nextPro }) => {
|
|
85
|
-
process.send && process.send({ type: 'prompt' });
|
|
86
|
-
process.emit('message', { type: 'prompt' });
|
|
87
|
-
return allBlocks === 'simple' && nextPro === 'Pro V4';
|
|
88
|
-
},
|
|
89
|
-
message: '🦄 Time to use better, faster and latest antd@4!',
|
|
90
|
-
default: 'antd@4',
|
|
91
56
|
},
|
|
92
57
|
];
|
|
93
|
-
return this.prompt(prompts).then(props => {
|
|
58
|
+
return this.prompt(prompts).then((props) => {
|
|
94
59
|
this.prompts = props;
|
|
95
60
|
});
|
|
96
61
|
}
|
|
97
62
|
}
|
|
98
63
|
|
|
99
64
|
async writing() {
|
|
100
|
-
const { language = 'TypeScript', allBlocks
|
|
65
|
+
const { language = 'TypeScript', allBlocks } = this.prompts;
|
|
101
66
|
|
|
102
67
|
const isTypeScript = language === 'TypeScript';
|
|
103
68
|
const projectName = this.opts.name || this.opts.env.cwd;
|
|
@@ -110,24 +75,12 @@ class AntDesignProGenerator extends BasicGenerator {
|
|
|
110
75
|
const githubUrl = await getGithubUrl();
|
|
111
76
|
const gitArgs = [`clone`, githubUrl, `--depth=1`];
|
|
112
77
|
|
|
113
|
-
// 如果想要使用旧的 antd,使用 antd@3 分支
|
|
114
|
-
if (nextAntd === 'antd@3' && allBlocks === 'simple') {
|
|
115
|
-
gitArgs.push('--branch', 'antd@3');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (nextPro === 'Pro V5') {
|
|
119
|
-
gitArgs.push('--branch', 'v5');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
78
|
// all-blocks 分支上包含了所有的区块
|
|
123
79
|
if (allBlocks === 'complete') {
|
|
124
80
|
log(`🙈 complete mode can only use the version of antd@4`);
|
|
125
81
|
gitArgs.push('--branch', 'all-blocks');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Set branch if provided
|
|
129
|
-
if (this.opts.args.branch && !nextPro) {
|
|
130
|
-
gitArgs.push('--branch', this.opts.args.branch);
|
|
82
|
+
} else {
|
|
83
|
+
gitArgs.push('--branch', 'umi@3');
|
|
131
84
|
}
|
|
132
85
|
|
|
133
86
|
gitArgs.push(projectName);
|
|
@@ -184,7 +137,7 @@ class AntDesignProGenerator extends BasicGenerator {
|
|
|
184
137
|
|
|
185
138
|
log('[JS] Clean up...');
|
|
186
139
|
const removeTsFiles = globList(['tsconfig.json', '**/*.d.ts'], envOptions);
|
|
187
|
-
removeTsFiles.forEach(filePath => {
|
|
140
|
+
removeTsFiles.forEach((filePath) => {
|
|
188
141
|
const targetPath = path.resolve(projectPath, filePath);
|
|
189
142
|
fs.removeSync(targetPath);
|
|
190
143
|
});
|
|
@@ -221,7 +174,7 @@ class AntDesignProGenerator extends BasicGenerator {
|
|
|
221
174
|
const ignoreFiles = pkg['create-umi'].ignore;
|
|
222
175
|
const fileList = globList(ignoreFiles, envOptions);
|
|
223
176
|
|
|
224
|
-
fileList.forEach(filePath => {
|
|
177
|
+
fileList.forEach((filePath) => {
|
|
225
178
|
const targetPath = path.resolve(projectPath, filePath);
|
|
226
179
|
fs.removeSync(targetPath);
|
|
227
180
|
});
|
package/lib/run.js
CHANGED
|
@@ -8,8 +8,8 @@ const yeoman = require('yeoman-environment');
|
|
|
8
8
|
|
|
9
9
|
const generators = fs
|
|
10
10
|
.readdirSync(`${__dirname}/generators`)
|
|
11
|
-
.filter(f => !f.startsWith('.'))
|
|
12
|
-
.map(f => {
|
|
11
|
+
.filter((f) => !f.startsWith('.'))
|
|
12
|
+
.map((f) => {
|
|
13
13
|
return {
|
|
14
14
|
name: `${f.padEnd(15)} - ${chalk.gray(require(`./generators/${f}/meta.json`).description)}`,
|
|
15
15
|
value: f,
|
|
@@ -18,7 +18,7 @@ const generators = fs
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const runGenerator = async (generatorPath, { name = '', cwd = process.cwd(), args = {} }) => {
|
|
21
|
-
return new Promise(resolve => {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
22
|
if (name) {
|
|
23
23
|
mkdirp.sync(name);
|
|
24
24
|
cwd = path.join(cwd, name);
|
|
@@ -48,7 +48,7 @@ const runGenerator = async (generatorPath, { name = '', cwd = process.cwd(), arg
|
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
const run = async config => {
|
|
51
|
+
const run = async (config) => {
|
|
52
52
|
process.send && process.send({ type: 'prompt' });
|
|
53
53
|
process.emit('message', { type: 'prompt' });
|
|
54
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-umi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"description": "Creates a UmiJS application using the command line.",
|
|
5
5
|
"homepage": "https://github.com/umijs/create-umi",
|
|
6
6
|
"bugs": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"glob": "^7.1.4",
|
|
35
35
|
"inquirer": "^6.4.1",
|
|
36
36
|
"mkdirp": "^0.5.1",
|
|
37
|
-
"prettier": "^
|
|
37
|
+
"prettier": "^2.0.0",
|
|
38
38
|
"semver": "^6.1.0",
|
|
39
39
|
"sort-package-json": "^1.22.1",
|
|
40
40
|
"sylvanas": "^0.6.1",
|
|
41
|
-
"typescript": "^
|
|
41
|
+
"typescript": "^4.0.0",
|
|
42
42
|
"umi-utils": "^1.5.2",
|
|
43
43
|
"yargs-parser": "^13.1.1",
|
|
44
44
|
"yeoman-environment": "^2.8.0",
|
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
|
|
@@ -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;
|
|
@@ -1,17 +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
|
-
},
|
|
15
|
-
"allowSyntheticDefaultImports": true
|
|
16
|
-
}
|
|
17
|
-
}
|