Miao-Yunzai/image.js

25 lines
606 B
JavaScript
Raw Normal View History

2024-06-16 22:17:29 +08:00
import { spawn } from 'child_process'
const argv = [...process.argv].splice(2)
const argvs = argv.join(' ').replace(/(\S+\.js|\S+\.ts)/g, '')
const child1 = spawn(
'tailwindcss -i ./src/input.css -o ./public/output.css --watch',
[],
{
shell: true,
stdio: 'inherit'
}
)
const child2 = spawn(
2024-06-17 13:19:18 +08:00
'node --no-warnings=ExperimentalWarning --loader ts-node/esm src/server.ts',
2024-06-16 22:17:29 +08:00
argvs.split(' '),
{
shell: true,
stdio: 'inherit'
}
)
process.on('SIGINT', () => {
if (child1.pid) process.kill(child1.pid)
if (child2.pid) process.kill(child2.pid)
if (process.pid) process.exit()
})