mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 15:26:16 -08:00
add banner
This commit is contained in:
1 parent
dd8ba4c64d
commit
db66272555
4 files changed
+25
-9
No files matched your search
+14
-2
@@ -28,11 +28,23 @@ async function develop(name) {
|
||||
},
|
||||
});
|
||||
|
||||
const banner =
|
||||
'/*!\n' +
|
||||
` * ${name}.js v${version}\n` +
|
||||
` * Github: https://github.com/zhw2590582/ArtPlayer\n` +
|
||||
` * (c) 2017-${new Date().getFullYear()} Harvey Zack\n` +
|
||||
' * Released under the MIT License.\n' +
|
||||
' */\n';
|
||||
|
||||
try {
|
||||
const { bundleGraph, buildTime } = await bundler.run();
|
||||
const bundles = bundleGraph.getBundles();
|
||||
fs.renameSync(`${projects[name]}/dist/index.js`, `${projects[name]}/dist/${name}.js`);
|
||||
console.log(`✨ Built ${bundles.length} bundles in ${buildTime}ms!`);
|
||||
const filePath = `${projects[name]}/dist/index.js`;
|
||||
const newFilePath = `${projects[name]}/dist/${name}.js`;
|
||||
const code = banner + fs.readFileSync(filePath);
|
||||
fs.writeFileSync(filePath, code);
|
||||
fs.renameSync(filePath, newFilePath);
|
||||
console.log(`✨ Built ${name} ${bundles.length} bundles in ${buildTime}ms!`);
|
||||
} catch (err) {
|
||||
console.log(err.diagnostics);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user