-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-site.mjs
More file actions
31 lines (24 loc) · 742 Bytes
/
Copy pathbuild-site.mjs
File metadata and controls
31 lines (24 loc) · 742 Bytes
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
#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
const distDir = path.resolve('dist');
const astroEntry = path.resolve('node_modules/astro/astro.js');
fs.rmSync(distDir, { recursive: true, force: true });
if (process.env.ASTRO_TELEMETRY_DISABLED === undefined) {
process.env.ASTRO_TELEMETRY_DISABLED = '1';
}
const result = spawnSync(process.execPath, [astroEntry, 'build'], {
stdio: 'inherit',
env: process.env,
shell: false,
});
if (result.error) {
console.error(result.error.message);
process.exit(1);
}
if (result.signal) {
console.error(`Build interrupted by signal ${result.signal}`);
process.exit(1);
}
process.exit(result.status ?? 1);