2024-06-10 09:34:28 +08:00
|
|
|
import { exec, spawn } from 'child_process'
|
2024-06-10 00:37:59 +08:00
|
|
|
const argv = [...process.argv].splice(2)
|
|
|
|
const argvs = argv.join(' ').replace(/(\S+\.js|\S+\.ts)/g, '')
|
2024-06-10 09:34:28 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* **********
|
|
|
|
* 生成css文件
|
|
|
|
* **********
|
|
|
|
*/
|
|
|
|
exec(
|
|
|
|
'tailwindcss -i ./src/input.css -o ./public/output.css',
|
|
|
|
(error, stdout, stderr) => {
|
|
|
|
if (error) {
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2024-06-10 00:37:59 +08:00
|
|
|
/**
|
|
|
|
* ***************
|
|
|
|
* 启动内部运行脚本
|
|
|
|
* ***************
|
|
|
|
*/
|
|
|
|
const child = spawn(
|
|
|
|
'node --no-warnings=ExperimentalWarning --loader ts-node/esm src/main.ts',
|
|
|
|
argvs.split(' '),
|
|
|
|
{
|
|
|
|
shell: true,
|
|
|
|
stdio: 'inherit'
|
|
|
|
}
|
|
|
|
)
|
|
|
|
/**
|
|
|
|
* *************
|
|
|
|
* exit
|
|
|
|
* *************
|
|
|
|
*/
|
|
|
|
process.on('SIGINT', () => {
|
|
|
|
if (child.pid) process.kill(child.pid)
|
|
|
|
if (process.pid) process.exit()
|
|
|
|
})
|