1 | const path = require('path');
|
2 | const fs = require('fs-extra');
|
3 |
|
4 | const entry = path.join(__dirname, '../../transform-framework/');
|
5 | const output = path.join(__dirname, '../../antmove/');
|
6 |
|
7 | function prepubAntmove () {
|
8 | const dirs = [
|
9 | '/src',
|
10 | './cli',
|
11 | './bin',
|
12 | '/packages/@antmove/utils',
|
13 | '/packages/@antmove/wx-alipay-plugin',
|
14 | '/packages/@antmove/wx-amap-plugin',
|
15 | '/packages/@antmove/alipay-wx-plugin',
|
16 | '/packages/@antmove/alipay-baidu-plugin',
|
17 | '/examples/wechat-v2ex',
|
18 | '/examples/wx-zhihu'
|
19 | ];
|
20 |
|
21 | const files = [
|
22 | '/README.md',
|
23 | '/.commitlintrc.js',
|
24 | '/.editorconfig',
|
25 | '/.eslintignore',
|
26 | '/.eslintrc.js',
|
27 | '/.gitignore',
|
28 | '/.npmignore',
|
29 | '/lerna.json',
|
30 | '/package.json'
|
31 | ];
|
32 |
|
33 | dirs.forEach(function (dir) {
|
34 | _copy(dir);
|
35 | });
|
36 |
|
37 | files.forEach(function (filename) {
|
38 | fs.outputFileSync(
|
39 | path.join(output, filename),
|
40 | fs.readFileSync(path.join(entry, filename), 'utf8')
|
41 | );
|
42 | console.log('[generate]: ' + path.join(output, filename));
|
43 | });
|
44 |
|
45 | function _copy (dirname) {
|
46 | const dist01 = path.join(output, dirname);
|
47 | fs.emptyDirSync(dist01);
|
48 | console.log('[generate]: ' + dist01);
|
49 |
|
50 | fs.copy(path.join(entry, dirname), dist01);
|
51 | }
|
52 | }
|
53 |
|
54 | prepubAntmove(); |
\ | No newline at end of file |