-
-
Notifications
You must be signed in to change notification settings - Fork 196
/
build.js
73 lines (61 loc) · 1.48 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { build } from 'esbuild';
import { readFileSync, writeFileSync } from 'fs';
const packageJson = JSON.parse(readFileSync('package.json', { encoding: 'utf8' }));
const version = process.env.TGT_RELEASE_VERSION;
if (version) {
packageJson.version = version.replace('v', '');
writeFileSync('package.json', JSON.stringify(packageJson, null, 2));
}
writeFileSync(
'.yarn.installed',
new Date().toLocaleString('en-AU', {
timeZone: 'UTC',
timeStyle: 'long',
dateStyle: 'full',
})
);
writeFileSync(
'fxmanifest.lua',
`fx_version 'cerulean'
game 'common'
use_experimental_fxv2_oal 'yes'
lua54 'yes'
name '${packageJson.name}'
author '${packageJson.author}'
version '${packageJson.version}'
license '${packageJson.license}'
repository '${packageJson.repository.url}'
description '${packageJson.description}'
dependencies {
'/server:7290',
}
client_script 'ui.lua'
server_script 'dist/build.js'
files {
'web/build/index.html',
'web/build/**/*'
}
ui_page 'web/build/index.html'
provide 'mysql-async'
provide 'ghmattimysql'
convar_category 'OxMySQL' {
'Configuration',
{
{ 'Connection string', 'mysql_connection_string', 'CV_STRING', 'mysql://user:password@localhost/database' },
{ 'Debug', 'mysql_debug', 'CV_BOOL', 'false' }
}
}
`
);
build({
bundle: true,
entryPoints: [`./src/index.ts`],
outfile: `dist/build.js`,
keepNames: true,
dropLabels: ['DEV'],
legalComments: 'inline',
platform: 'node',
target: ['node16'],
format: 'cjs',
logLevel: 'info',
});