2020-12-19 15:11:24 -05:00
|
|
|
const path = require('path');
|
|
|
|
const mkdirp = require('mkdirp');
|
|
|
|
const fs = require('fs-extra');
|
2020-12-28 22:42:58 -05:00
|
|
|
const Parcel = require('parcel-bundler');
|
2020-12-19 15:11:24 -05:00
|
|
|
|
|
|
|
const distPath = path.resolve(__dirname, '..', 'dist');
|
|
|
|
const srcPath = path.resolve(__dirname, '..', 'src');
|
|
|
|
|
|
|
|
mkdirp(distPath).then(src);
|
|
|
|
|
|
|
|
// copy src files
|
|
|
|
|
|
|
|
function src() {
|
2020-12-28 22:42:58 -05:00
|
|
|
|
2020-12-19 15:11:24 -05:00
|
|
|
const copyCustomIcons = fs.copy(
|
|
|
|
path.resolve(srcPath, 'customIcons'),
|
|
|
|
path.resolve(distPath, 'icons')
|
|
|
|
);
|
2020-12-28 22:42:58 -05:00
|
|
|
|
|
|
|
const entryFile = path.resolve(srcPath, 'main.js');
|
|
|
|
const parcelOptions = {
|
|
|
|
watch: false,
|
|
|
|
minify: true,
|
|
|
|
}
|
|
|
|
const bundler = new Parcel(entryFile, parcelOptions)
|
|
|
|
const bundleMainScript = bundler.bundle();
|
|
|
|
|
2020-12-19 15:11:24 -05:00
|
|
|
const copyManifest = fs.copy(
|
|
|
|
path.resolve(srcPath, 'manifest.json'),
|
|
|
|
path.resolve(distPath, 'manifest.json')
|
|
|
|
);
|
2020-12-28 22:42:58 -05:00
|
|
|
|
2020-12-19 17:34:52 -05:00
|
|
|
const copyExtensionLogos = fs.copy(path.resolve(srcPath, 'extensionIcons'), distPath);
|
2020-12-28 22:42:58 -05:00
|
|
|
|
|
|
|
return Promise.all([copyCustomIcons, copyManifest, copyExtensionLogos, bundleMainScript]);
|
2020-12-19 15:11:24 -05:00
|
|
|
}
|