Files
ArtPlayer/scripts/copyAfterBuild.js
T
2018-12-03 12:46:52 +08:00

20 lines
591 B
JavaScript

const cpy = require('cpy');
const logger = require('./logger');
module.exports = (opts = {}) => ({
name: 'copyAfterBuild',
generateBundle(outputOptions, bundle, isWrite) {
if (!isWrite) {
logger.fatal('copyAfterBuild currently only works with bundles that are written to disk');
}
if (opts.from && opts.to) {
cpy(opts.from, opts.to).then(() => {
logger.success(`Successfully copied to: ${opts.to}`);
}).catch(() => {
logger.fatal('File copy failed!');
});
}
},
});