yo.node.conf.js
918 Bytes
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
const shelljs = require('shelljs');
const path = require('path');
const pkg = require('../package.json');
const distDir = path.join(__dirname, '../dist/node');
shelljs.rm('-rf', distDir);
shelljs.mkdir(distDir);
const cpPaths = [
'favicon.ico',
'.nvmrc',
'.npmrc',
'process.json',
'yarn.lock',
'package.json',
'*.js',
'config',
'apps',
'doraemon',
'utils',
['public/static', 'public'],
`dist/statics/yohobuywap-node/${pkg.version}/manifest.json`
];
cpPaths.forEach(p => {
let dist = distDir;
let file = p;
if (typeof p === 'object') {
dist = path.join(dist, p[1]);
file = p[0];
if (!shelljs.test('-e', dist)) {
shelljs.mkdir('-p', dist);
}
}
shelljs.cp('-R', path.join(__dirname, '../', file), dist);
});
shelljs.cd(distDir);
// shelljs.exec('nvm use');
shelljs.exec('yarn --production=true');