yo.node.conf.js 918 Bytes
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');