fix: debug bootstrap logic
This commit is contained in:
		
							parent
							
								
									d949120836
								
							
						
					
					
						commit
						4d636614ce
					
				| 
						 | 
					@ -2,13 +2,19 @@ import fs from 'fs'
 | 
				
			||||||
import path from 'path'
 | 
					import path from 'path'
 | 
				
			||||||
import { fileURLToPath } from 'url'
 | 
					import { fileURLToPath } from 'url'
 | 
				
			||||||
import { createRequire } from 'module'
 | 
					import { createRequire } from 'module'
 | 
				
			||||||
 | 
					import { spawn } from 'child_process'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const pkg = createRequire(import.meta.url)('../package.json')
 | 
					 | 
				
			||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
 | 
					const __dirname = path.dirname(fileURLToPath(import.meta.url))
 | 
				
			||||||
 | 
					const require = createRequire(import.meta.url)
 | 
				
			||||||
 | 
					const pkg = require('../package.json')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// write .debug.env
 | 
					// write .debug.env
 | 
				
			||||||
const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
 | 
					const envContent = Object.entries(pkg.env).map(([key, val]) => `${key}=${val}`)
 | 
				
			||||||
fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
 | 
					fs.writeFileSync(path.join(__dirname, '.debug.env'), envContent.join('\n'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// bootstrap
 | 
					// bootstrap
 | 
				
			||||||
import('../scripts/watch.mjs?debug=vscode')
 | 
					spawn(
 | 
				
			||||||
 | 
					  process.platform === 'win32' ? 'npm.cmd' : 'npm',
 | 
				
			||||||
 | 
					  ['run', 'dev'],
 | 
				
			||||||
 | 
					  { stdio: 'inherit' },
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue