完成build脚本

This commit is contained in:
Harvey Zack committed 2018-12-03 12:46:52 +08:00
1 parent cc2027832e
commit 00b51c32ba
18 files changed
+84 -123

No files matched your search

+4 -3
View File
@@ -1,17 +1,18 @@
const cpy = require('cpy');
const logger = require('./logger');
module.exports = (opts = {}) => ({
name: 'copyAfterBuild',
generateBundle(outputOptions, bundle, isWrite) {
if (!isWrite) {
throw new Error('copyAfterBuild currently only works with bundles that are written to disk');
logger.fatal('copyAfterBuild currently only works with bundles that are written to disk');
}
if (opts.from && opts.to) {
cpy(opts.from, opts.to).then(() => {
console.log('File copy succeeded!');
logger.success(`Successfully copied to: ${opts.to}`);
}).catch(() => {
throw new Error('File copy failed!');
logger.fatal('File copy failed!');
});
}
},