37 lines
967 B
JavaScript
Raw Normal View History

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');
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
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();
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]);
}