generated from overextended/fivem-typescript-boilerplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
46 lines (42 loc) · 1021 Bytes
/
build.js
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
41
42
43
44
45
46
//@ts-check
import { exists, exec, getFiles } from './utils.js';
import { createBuilder, createFxmanifest } from '@overextended/fx-utils';
const watch = process.argv.includes('--watch');
const web = await exists('./web');
createBuilder(
watch,
{
dropLabels: !watch ? ['DEV'] : undefined,
},
[
{
name: 'server',
options: {
platform: 'node',
target: ['node16'],
format: 'cjs',
},
},
{
name: 'client',
options: {
platform: 'browser',
target: ['es2021'],
format: 'iife',
},
},
],
async (outfiles) => {
const files = await getFiles('dist/web', 'static', 'locales');
await createFxmanifest({
client_scripts: [outfiles.client],
server_scripts: [outfiles.server],
files: files,
dependencies: ['/server:7290', '/onesync'],
metadata: {
ui_page: 'dist/web/index.html',
},
});
}
);
if (web) await exec(`cd ./web && vite build ${watch ? '--watch' : ''}`);