forked from ant-design/pro-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.js
95 lines (83 loc) · 2.52 KB
/
bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const { existsSync, writeFileSync, readdirSync } = require('fs');
const { join } = require('path');
const { yParser } = require('@umijs/utils');
(async () => {
const args = yParser(process.argv);
const version = '1.0.0-beta.1';
const pkgs = readdirSync(join(__dirname, '../packages')).filter((pkg) => pkg.charAt(0) !== '.');
pkgs.forEach((shortName) => {
const name = `@ant-design/pro-${shortName}`;
const pkgJSONPath = join(__dirname, '..', 'packages', shortName, 'package.json');
const pkgJSONExists = existsSync(pkgJSONPath);
let json;
if (args.force || !pkgJSONExists) {
json = {
name,
version,
description: name,
module: 'es/index.js',
main: 'lib/index.js',
types: 'lib/index.d.ts',
files: ['lib', 'src', 'dist', 'es'],
repository: {
type: 'git',
url: 'https://github.com/ant-design/pro-components',
},
browserslist: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 11'],
keywords: ['antd', 'admin', 'ant-design', 'ant-design-pro'],
authors: [
'chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)',
'chenshuai2144 <qixian.cs@outlook.com> (https://github.com/chenshuai2144)',
],
license: 'MIT',
bugs: 'http://github.com/umijs/plugins/issues',
homepage: `https://github.com/ant-design/pro-components/tree/master/packages/${shortName}#readme`,
peerDependencies: {
umi: '3.x',
},
publishConfig: {
access: 'public',
},
};
if (pkgJSONExists) {
const pkg = require(pkgJSONPath);
[
'dependencies',
'devDependencies',
'peerDependencies',
'bin',
'version',
'files',
'authors',
'types',
'sideEffects',
'main',
'module',
'description',
].forEach((key) => {
if (pkg[key]) json[key] = pkg[key];
});
}
writeFileSync(pkgJSONPath, `${JSON.stringify(json, null, 2)}\n`);
}
const readmePath = join(__dirname, '..', 'packages', shortName, 'README.md');
if (args.force || !existsSync(readmePath)) {
writeFileSync(
readmePath,
`# ${name}
> ${json.description}.
See our website [${name}](https://umijs.org/plugins/${shortName}) for more information.
## Install
Using npm:
\`\`\`bash
$ npm install --save ${name}
\`\`\`
or using yarn:
\`\`\`bash
$ yarn add ${name}
\`\`\`
`,
);
}
});
})();