Files
ArtPlayer/scripts/copyAfterBuild.js
T
2018-11-30 17:25:48 +08:00

19 lines
544 B
JavaScript

const cpy = require('cpy');
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');
}
if (opts.from && opts.to) {
cpy(opts.from, opts.to).then(() => {
console.log('File copy succeeded!');
}).catch(() => {
throw new Error('File copy failed!');
});
}
},
});