avg-cli
Version:
CLI tools for AVG.js
29 lines (25 loc) • 1.62 kB
JavaScript
;
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
const path = require('path');
const execa = require('execa');
const fs = require('fs-extra');
const ora = require('ora');
module.exports = (() => {
var _ref = _asyncToGenerator(function* (dir) {
let spinner = ora('正在编译主程序并拷贝其余文件...').start();
yield execa('npm', ['run', 'dist']);
fs.copySync(path.resolve(dir, 'index.html'), path.resolve(dir, 'dist/index.html'));
fs.copySync(path.resolve(dir, 'manifest.json'), path.resolve(dir, 'dist/manifest.json'));
fs.copySync(path.resolve(dir, 'copyright.txt'), path.resolve(dir, 'dist/copyright.txt'));
fs.copySync(path.resolve(dir, 'icon64.png'), path.resolve(dir, 'dist/icon64.png'));
fs.copySync(path.resolve(dir, 'icon128.png'), path.resolve(dir, 'dist/icon128.png'));
fs.copySync(path.resolve(dir, 'icon192.png'), path.resolve(dir, 'dist/icon192.png'));
if (fs.existsSync(path.resolve(dir, 'libs'))) {
fs.copySync(path.resolve(dir, 'libs'), path.resolve(dir, 'dist/libs'));
}
spinner.succeed('编译主程序并拷贝其余文件');
});
return function (_x) {
return _ref.apply(this, arguments);
};
})();