Skip to content

Commit

Permalink
exit on canceling create-vite operation
Browse files Browse the repository at this point in the history
  • Loading branch information
chicoxyzzy committed Sep 25, 2023
1 parent 0e4b7b2 commit b974f2c
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,29 @@ const viteProcess = spawn(viteCreateCommand, [], {
encoding: 'utf-8'
})

// TODO
// viteProcess.on('exit', (code) => {
// if (code !== 0) {
// process.stderr.write(`\nUnable to create vite project. Exit code ${code}\n`)
// process.exit(1)
// }
// })

viteProcess.on('close', (code) => {
const cwd = resolve(process.cwd(), projectName)



try {
execSync('ssc --version', {
stdio: 'ignore'
})
} catch {
process.stdout.write('Installing \'@socketsupply/socket\' locally (ssc not in PATH)\n')
process.stdout.write('Installing \'@socketsupply/socket\' locally (ssc not in PATH)\n\n')
execSync('npm install @socketsupply/socket --save-dev')
}

process.stdout.write('Installing dependencies\n')

execSync('npm install', {
cwd,
stdio: 'inherit'
})
try {
execSync('npm install', {
cwd,
stdio: 'inherit'
})
} catch (error) {
// create-vite operation was cancelled
if (error.code === 'ENOENT') process.exit(0)
}

process.stdout.write(`\nAdding the socket.ini file to the project\n`)

Expand Down

0 comments on commit b974f2c

Please sign in to comment.