refactor: better Debug logic

This commit is contained in:
草鞋没号 committed 2022-07-23 07:31:47 +08:00
1 parent 58e568506a
commit f9571ab94a
2 files changed
+6 -11

No files matched your search

+4 -4
View File
@@ -12,13 +12,13 @@ const pkg = require('../package.json')
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
// for debug
fs.writeFileSync(path.join(__dirname, '../node_modules/.electron-vite-debug'), '')
// bootstrap
spawn(
// TODO: terminate `npm run dev` when Debug exits.
process.platform === 'win32' ? 'npm.cmd' : 'npm',
['run', 'dev'],
{ stdio: 'inherit' },
{
stdio: 'inherit',
env: Object.assign(process.env, { VSCODE_DEBUG: 'true' }),
},
)