Skip to content

Commit 01fd21e

Browse files
committed
refactor: address pr feedback
1 parent b427847 commit 01fd21e

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

packages/@sanity/cli/src/actions/init/initStudio.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {styleText} from 'node:util'
22

33
import {getCliToken, subdebug, type TelemetryUserProperties} from '@sanity/cli-core'
4-
import {confirm, warn} from '@sanity/cli-core/ux'
4+
import {confirm} from '@sanity/cli-core/ux'
55
import {type TelemetryTrace} from '@sanity/telemetry'
66
import {execa} from 'execa'
77

@@ -136,7 +136,7 @@ export async function initStudio({
136136
output.log('and create a new clean dataset with')
137137
output.log(` ${styleText('cyan', `npx sanity dataset create <name>`)}\n`)
138138
} catch {
139-
warn(
139+
output.warn(
140140
'Sample dataset import failed. Your studio will work fine without it.\n' +
141141
`You can import it later with: ${styleText('cyan', `npx sanity dataset import ${template.datasetUrl} ${datasetName}`)}`,
142142
)

packages/create-sanity/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
// eslint-disable-next-line import-x/no-extraneous-dependencies -- bundled, not a runtime dep
44
import {isInteractive} from '@sanity/cli-core'
5+
// eslint-disable-next-line import-x/no-extraneous-dependencies -- bundled, not a runtime dep
6+
import {CLIError} from '@sanity/cli-core/errors'
57

68
import {
79
flagsToInitOptions,
@@ -55,6 +57,11 @@ try {
5557
process.exit(error.exitCode)
5658
}
5759

60+
if (error instanceof CLIError) {
61+
console.error(error.message)
62+
process.exit(error.oclif.exit ?? 2)
63+
}
64+
5865
// Clean message for unknown flags instead of a raw stack trace
5966
if (
6067
error instanceof TypeError &&

packages/create-sanity/test/create-sanity.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ describe('create-sanity', () => {
7575
const result = await runCreateSanity(['--help'])
7676

7777
expect(result.code).toBe(0)
78-
expect(result.stdout).not.toContain('--from-create')
79-
expect(result.stdout).not.toContain('--quickstart')
78+
expect(result.stdout).not.toContain('--reconfigure')
79+
expect(result.stdout).not.toContain('--template-token')
8080
})
8181

8282
test('references `npm create sanity@latest` by default', async () => {

0 commit comments

Comments
 (0)