-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
40 lines (34 loc) · 1.03 KB
/
build.js
File metadata and controls
40 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const esbuild = require('esbuild');
const path = require('path');
const fs = require('fs');
const { execSync } = require('child_process');
const { glob } = require('glob');
async function build() {
// Create output directories if they don't exist
const assetsOutdir = path.join(__dirname, 'resources/build/assets');
if (!fs.existsSync(assetsOutdir)) {
fs.mkdirSync(assetsOutdir, { recursive: true });
}
try {
// Copy tailwindcss runtime
console.log('Copying TailwindCSS runtime...');
fs.copyFileSync(
'resources/assets/static/tailwindcss.js',
'resources/build/assets/tailwindcss.js'
);
// Build JS file with esbuild
console.log('Building JavaScript...');
await esbuild.build({
entryPoints: ['resources/assets/app.js'],
bundle: true,
target: 'es2020',
outfile: 'resources/build/assets/app.js',
minify: true,
});
console.log('✓ Build completed successfully');
} catch (error) {
console.error('Build failed:', error);
process.exit(1);
}
}
build();