kopia lustrzana https://github.com/shoelace-style/shoelace
fix dev build
rodzic
dafb10b1ce
commit
47a8b3f19a
|
|
@ -29,7 +29,7 @@
|
||||||
"url": "https://github.com/sponsors/claviska"
|
"url": "https://github.com/sponsors/claviska"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node scripts/build.cjs --serve",
|
"start": "node scripts/build.cjs --dev",
|
||||||
"build": "node scripts/build.cjs",
|
"build": "node scripts/build.cjs",
|
||||||
"prepublish": "npm run build",
|
"prepublish": "npm run build",
|
||||||
"prettier": "prettier --write --loglevel warn ."
|
"prettier": "prettier --write --loglevel warn ."
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,10 @@ const sass = require('sass');
|
||||||
const sassPlugin = require('esbuild-plugin-sass');
|
const sassPlugin = require('esbuild-plugin-sass');
|
||||||
const { build } = require('esbuild');
|
const { build } = require('esbuild');
|
||||||
|
|
||||||
const options = commandLineArgs({
|
const { dev } = commandLineArgs({ name: 'dev', type: Boolean });
|
||||||
name: 'serve',
|
|
||||||
type: Boolean
|
|
||||||
});
|
|
||||||
|
|
||||||
execSync(`rm -rf ./dist`, { stdio: 'inherit' });
|
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-metadata.cjs', { stdio: 'inherit' });
|
||||||
execSync('node scripts/make-icons.cjs', { stdio: 'inherit' });
|
execSync('node scripts/make-icons.cjs', { stdio: 'inherit' });
|
||||||
|
|
||||||
|
|
@ -47,7 +44,7 @@ execSync('node scripts/make-icons.cjs', { stdio: 'inherit' });
|
||||||
entryPoints,
|
entryPoints,
|
||||||
outdir: './dist',
|
outdir: './dist',
|
||||||
chunkNames: 'chunks/[name].[hash]',
|
chunkNames: 'chunks/[name].[hash]',
|
||||||
incremental: options.serve,
|
incremental: dev,
|
||||||
define: {
|
define: {
|
||||||
// Popper.js expects this to be set
|
// Popper.js expects this to be set
|
||||||
'process.env.NODE_ENV': '"production"'
|
'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
|
// 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.
|
// because it will conflict with browser sync's routing to the actual dist dir.
|
||||||
await del('./docs/dist');
|
await del('./docs/dist');
|
||||||
if (!options.serve) {
|
if (!dev) {
|
||||||
await copy('./dist', './docs/dist');
|
await copy('./dist', './docs/dist');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(chalk.green('The build has finished! 📦'));
|
console.log(chalk.green('The build has finished! 📦'));
|
||||||
|
|
||||||
if (options.serve) {
|
if (dev) {
|
||||||
const port = await getPort({
|
const port = await getPort({
|
||||||
port: getPort.makeRange(4000, 4999)
|
port: getPort.makeRange(4000, 4999)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue