pull/362/head^2
Cory LaViska 2021-03-07 09:02:57 -05:00
rodzic dafb10b1ce
commit 47a8b3f19a
2 zmienionych plików z 6 dodań i 9 usunięć

Wyświetl plik

@ -29,7 +29,7 @@
"url": "https://github.com/sponsors/claviska"
},
"scripts": {
"start": "node scripts/build.cjs --serve",
"start": "node scripts/build.cjs --dev",
"build": "node scripts/build.cjs",
"prepublish": "npm run build",
"prettier": "prettier --write --loglevel warn ."

Wyświetl plik

@ -16,13 +16,10 @@ const sass = require('sass');
const sassPlugin = require('esbuild-plugin-sass');
const { build } = require('esbuild');
const options = commandLineArgs({
name: 'serve',
type: Boolean
});
const { dev } = commandLineArgs({ name: 'dev', type: Boolean });
execSync(`rm -rf ./dist`, { stdio: 'inherit' });
execSync('tsc', { stdio: 'inherit' }); // for type declarations
if (!dev) execSync('tsc', { stdio: 'inherit' }); // for type declarations
execSync('node scripts/make-metadata.cjs', { stdio: 'inherit' });
execSync('node scripts/make-icons.cjs', { stdio: 'inherit' });
@ -47,7 +44,7 @@ execSync('node scripts/make-icons.cjs', { stdio: 'inherit' });
entryPoints,
outdir: './dist',
chunkNames: 'chunks/[name].[hash]',
incremental: options.serve,
incremental: dev,
define: {
// Popper.js expects this to be set
'process.env.NODE_ENV': '"production"'
@ -89,13 +86,13 @@ execSync('node scripts/make-icons.cjs', { stdio: 'inherit' });
// Create the docs distribution by copying dist into docs/dist. This is what powers the website. It can't exist in dev
// because it will conflict with browser sync's routing to the actual dist dir.
await del('./docs/dist');
if (!options.serve) {
if (!dev) {
await copy('./dist', './docs/dist');
}
console.log(chalk.green('The build has finished! 📦'));
if (options.serve) {
if (dev) {
const port = await getPort({
port: getPort.makeRange(4000, 4999)
});