]> BookStack Code Mirror - bookstack/blob - dev/build/esbuild.js
Skip intermediate login page with single provider
[bookstack] / dev / build / esbuild.js
1 #!/usr/bin/env node
2
3 const esbuild = require('esbuild');
4 const fs = require('fs');
5 const path = require('path');
6
7 // Check if we're building for production
8 // (Set via passing `production` as first argument)
9 const isProd = process.argv[2] === 'production';
10
11 // Gather our input files
12 const jsInDir = path.join(__dirname, '../../resources/js');
13 const jsInDirFiles = fs.readdirSync(jsInDir, 'utf8');
14 const entryFiles = jsInDirFiles
15     .filter(f => f.endsWith('.js') || f.endsWith('.mjs'))
16     .map(f => path.join(jsInDir, f));
17
18 // Locate our output directory
19 const outDir = path.join(__dirname, '../../public/dist');
20
21 // Build via esbuild
22 esbuild.build({
23     bundle: true,
24     entryPoints: entryFiles,
25     outdir: outDir,
26     sourcemap: true,
27     target: 'es2020',
28     mainFields: ['module', 'main'],
29     format: 'esm',
30     minify: isProd,
31     logLevel: "info",
32 }).catch(() => process.exit(1));
Morty Proxy This is a proxified and sanitized view of the page, visit original site.