-
Notifications
You must be signed in to change notification settings - Fork 144
/
build.js
34 lines (28 loc) · 899 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
import { fileURLToPath } from 'url';
import { build, loadEnv } from 'vite';
import kleur from 'kleur';
const { bold, yellow } = kleur;
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const env = loadEnv('production', __dirname, 'PUBLIC_');
function log(text = '', prefix = '') {
console.log(`${bold().green(`# ${prefix}`)}${text}`);
}
function logEnv(key, value, fallback = 'not set') {
log(value || yellow(fallback), `${key}: `);
}
function logDelimiter() {
console.log(bold().green('#'.repeat(80)));
}
async function main() {
logDelimiter();
log();
log(bold().magenta('APPWRITE CONSOLE'));
log();
logEnv('CONSOLE MODE', env?.PUBLIC_CONSOLE_MODE);
logEnv('APPWRITE ENDPOINT', env?.PUBLIC_APPWRITE_ENDPOINT, 'relative');
logEnv('GROWTH ENDPOINT', env?.PUBLIC_GROWTH_ENDPOINT);
log();
logDelimiter();
await build();
}
main();