diff --git a/scripts/release.mjs b/scripts/release.mjs index 45e6a216d..e9a599a4c 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -27,4 +27,7 @@ for (const [DISTRIBUTION, pkg] of Object.entries(distributions)) { } // clean up -x('git', ['restore', 'package.json']) +x('git', ['restore', 'package.json'], { + nodeOptions: { stdio: 'inherit' }, + throwOnError: true, +}) diff --git a/src/commands/devtools.ts b/src/commands/devtools.ts index bf0ed6ecb..37cc61709 100644 --- a/src/commands/devtools.ts +++ b/src/commands/devtools.ts @@ -33,6 +33,7 @@ export default defineCommand({ 'npx', ['@nuxt/devtools-wizard@latest', ctx.args.command, cwd], { + throwOnError: true, nodeOptions: { stdio: 'inherit', cwd, diff --git a/src/commands/preview.ts b/src/commands/preview.ts index cd16aaa89..e25f48b8f 100644 --- a/src/commands/preview.ts +++ b/src/commands/preview.ts @@ -102,6 +102,9 @@ export default defineCommand({ logger.info(`Starting preview command: \`${nitroJSON.commands.preview}\``) const [command, ...commandArgs] = nitroJSON.commands.preview.split(' ') logger.log('') - await x(command, commandArgs, { nodeOptions: { stdio: 'inherit', cwd: outputPath } }) + await x(command, commandArgs, { + throwOnError: true, + nodeOptions: { stdio: 'inherit', cwd: outputPath }, + }) }, }) diff --git a/src/commands/typecheck.ts b/src/commands/typecheck.ts index a657e425a..d584e9ce5 100644 --- a/src/commands/typecheck.ts +++ b/src/commands/typecheck.ts @@ -48,6 +48,7 @@ export default defineCommand({ ]) if (resolvedTypeScript && resolvedVueTsc) { await x(fileURLToPath(resolvedVueTsc), ['--noEmit'], { + throwOnError: true, nodeOptions: { stdio: 'inherit', cwd, @@ -59,10 +60,14 @@ export default defineCommand({ await x( 'bun', 'install typescript vue-tsc --global --silent'.split(' '), - { nodeOptions: { stdio: 'inherit', cwd } }, + { + throwOnError: true, + nodeOptions: { stdio: 'inherit', cwd }, + }, ) await x('bunx', 'vue-tsc --noEmit'.split(' '), { + throwOnError: true, nodeOptions: { stdio: 'inherit', cwd, @@ -73,7 +78,10 @@ export default defineCommand({ await x( 'npx', '-p vue-tsc -p typescript vue-tsc --noEmit'.split(' '), - { nodeOptions: { stdio: 'inherit', cwd } }, + { + throwOnError: true, + nodeOptions: { stdio: 'inherit', cwd }, + }, ) } } diff --git a/test/e2e/commands.spec.ts b/test/e2e/commands.spec.ts index a1390e993..5ef76211a 100644 --- a/test/e2e/commands.spec.ts +++ b/test/e2e/commands.spec.ts @@ -20,6 +20,7 @@ describe('commands', () => { const file = join(fixtureDir, 'server/api/test.ts') await rm(file, { force: true }) await x('nuxi', ['add', 'api', 'test'], { + throwOnError: true, nodeOptions: { stdio: 'pipe', cwd: fixtureDir }, }) expect(existsSync(file)).toBeTruthy() @@ -45,6 +46,7 @@ describe('commands', () => { await rm(installPath, { recursive: true, force: true }) try { await x('nuxi', ['init', installPath, `--packageManager=${pm}`, '--gitInit=false', '--preferOffline', '--install=false'], { + throwOnError: true, nodeOptions: { stdio: 'inherit', cwd: fixtureDir }, }) const files = await readdir(installPath).catch(() => [])