You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
|
|
// // http://localhost:3344
|
|
// get("http://baidu.com",res=>{
|
|
// console.log(res.statusCode);
|
|
// })
|
|
// import { spawn, ChildProcess } from 'child_process'
|
|
// spawn(
|
|
// electronForge,
|
|
// [
|
|
// "start",
|
|
// "--inspect-electron",
|
|
// "--app-path",
|
|
// join(__dirname, "dist/electron/entry.js"),//join(__dirname, `../${main}`),
|
|
// ] ,
|
|
// {
|
|
// stdio: 'inherit',
|
|
// env: Object.assign(process.env, { NODE_ENV: "development" }),
|
|
// })
|
|
const chalk = require("chalk")
|
|
const electron = require("electron")
|
|
const { spawn } = require("child_process")
|
|
const { join } = require("path")
|
|
console.log(electron);
|
|
|
|
// let child = spawn(
|
|
// electron,
|
|
// [join(__dirname, `dist/electron/entry.js`)]
|
|
// )
|
|
|
|
// if(child){
|
|
// setTimeout(() => {
|
|
// child.kill()
|
|
// }, 5000);
|
|
// }
|
|
|
|
function runVite () {
|
|
return new Promise((resolve, reject) => {
|
|
let viteProcess = spawn('node', [`D:/1XYX/pro/vite-electron/node_modules/vite/bin/vite.js`])
|
|
let isReady = false;
|
|
viteProcess.stdout.on('data', (data) => {
|
|
console.log(`${data}`);
|
|
if (!isReady && data.indexOf("ready") != -1) {
|
|
resolve()
|
|
}
|
|
});
|
|
|
|
viteProcess.stderr.on('data', (data) => {
|
|
console.error(`[vite err]: ${data}`);
|
|
reject()
|
|
});
|
|
|
|
viteProcess.on('close', (code) => {
|
|
console.log(`[vite close]: exited with code ${code}`);
|
|
reject()
|
|
});
|
|
})
|
|
}
|