htmldocs
Version:
<h1 align="center"> <img src="https://github.com/user-attachments/assets/655fa7f9-98e7-42ee-8cd0-bb9193f100e9" alt="htmldocs" width="100%" /> </h1>
24 lines (20 loc) • 549 B
JavaScript
import { spawn } from 'node:child_process';
import fs from 'node:fs';
const nextBuildProcess = spawn('next', ['build'], {
detached: true,
stdio: "inherit",
env: { ...process.env }
});
process.on('SIGINT', () => {
nextBuildProcess.kill('SIGINT');
});
nextBuildProcess.on('exit', (code) => {
if (code !== 0) {
process.exit(code);
}
if (fs.existsSync('dist/preview')) {
fs.rmSync('dist/preview', { recursive: true });
}
fs.mkdirSync('dist/preview', { recursive: true });
fs.renameSync('.next', 'dist/preview/.next');
});