mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
完成build脚本
This commit is contained in:
1 parent
cc2027832e
commit
00b51c32ba
18 files changed
+84
-123
No files matched your search
@@ -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!');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user