Skip to content

Commit d2a7d78

Browse files
authored
feat!: add ux core helpers (#219)
1 parent 8aec549 commit d2a7d78

File tree

137 files changed

+483
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+483
-400
lines changed

packages/@sanity/cli-core/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
"require": "./dist/_exports/tree.js",
2929
"import": "./dist/_exports/tree.js"
3030
},
31+
"./ux": {
32+
"source": "./src/_exports/ux.ts",
33+
"require": "./dist/_exports/ux.js",
34+
"import": "./dist/_exports/ux.js"
35+
},
3136
"./package.json": "./package.json"
3237
},
3338
"main": "dist/index.js",
@@ -47,19 +52,20 @@
4752
"watch": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ --watch src"
4853
},
4954
"dependencies": {
55+
"@inquirer/prompts": "^8.1.0",
5056
"@oclif/core": "^4.8.0",
5157
"@sanity/client": "^7.11.2",
5258
"@sanity/types": "^4.21.0",
5359
"babel-plugin-react-compiler": "^1.0.0",
54-
"chalk": "^5.4.1",
60+
"chalk": "^5.6.2",
5561
"configstore": "^7.0.0",
5662
"debug": "^4.4.3",
5763
"get-tsconfig": "^4.10.1",
5864
"import-meta-resolve": "^4.1.0",
5965
"jsdom": "^26.0.0",
6066
"json-lexer": "^1.2.0",
6167
"log-symbols": "^7.0.1",
62-
"ora": "^8.2.0",
68+
"ora": "^9.0.0",
6369
"tsx": "^4.20.3",
6470
"vite": "^7.1.6",
6571
"vite-node": "^3.0.8",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from '../ux/chalk.js'
2+
export * from '../ux/logSymbols.js'
3+
export * from '../ux/prompts.js'
4+
export * from '../ux/spinner.js'

packages/@sanity/cli-core/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,5 @@ export * from './util/resolveLocalPackage.js'
3030
export * from './util/tryGetDefaultExport.js'
3131
export * from './ux/colorizeJson.js'
3232
export * from './ux/formatObject.js'
33-
export * from './ux/logSymbols.js'
3433
export * from './ux/printKeyValue.js'
35-
export * from './ux/spinner.js'
3634
export * from './ux/timer.js'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export {default as chalk} from 'chalk'
2+
export * from 'chalk'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@inquirer/prompts'
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
export {default as spinner} from 'ora'
1+
export {
2+
default as spinner,
3+
type Spinner,
4+
type Ora as SpinnerInstance,
5+
type Options as SpinnerOptions,
6+
oraPromise as spinnerPromise,
7+
type PromiseOptions as SpinnerPromiseOptions,
8+
} from 'ora'

packages/@sanity/cli/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"watch": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ --watch src"
5858
},
5959
"dependencies": {
60-
"@inquirer/prompts": "^7.8.6",
6160
"@oclif/core": "^4.8.0",
6261
"@oclif/plugin-help": "^6.2.36",
6362
"@oclif/plugin-not-found": "^3.2.73",
@@ -78,7 +77,6 @@
7877
"@vercel/fs-detectors": "5.5.2",
7978
"@vitejs/plugin-react": "^4.5.0",
8079
"boxen": "^8.0.1",
81-
"chalk": "^5.4.1",
8280
"chokidar": "^4.0.3",
8381
"console-table-printer": "^2.14.6",
8482
"date-fns": "^4.1.0",
@@ -100,7 +98,6 @@
10098
"node-html-parser": "^7.0.1",
10199
"oneline": "^2.0.0",
102100
"open": "^10.1.0",
103-
"ora": "^8.2.0",
104101
"p-map": "^7.0.3",
105102
"peek-stream": "^1.1.3",
106103
"pkg-dir": "^8.0.0",

packages/@sanity/cli/src/actions/auth/login/getProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {input} from '@inquirer/prompts'
2-
import {spinner} from '@sanity/cli-core'
1+
import {input, spinner} from '@sanity/cli-core/ux'
32
import {type SanityClient} from '@sanity/client'
43

54
import {type LoginProvider, type ProvidersResponse} from '../types.js'

packages/@sanity/cli/src/actions/auth/login/getSSOProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {select} from '@inquirer/prompts'
1+
import {select} from '@sanity/cli-core/ux'
22
import {type SanityClient} from '@sanity/client'
33

44
import {type LoginProvider, type SamlLoginProvider} from '../types.js'

packages/@sanity/cli/src/actions/auth/login/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {getCliToken, getGlobalCliClient, type Output, setConfig, spinner} from '@sanity/cli-core'
1+
import {getCliToken, getGlobalCliClient, type Output, setConfig} from '@sanity/cli-core'
2+
import {spinner} from '@sanity/cli-core/ux'
23
import open from 'open'
34

45
import {canLaunchBrowser} from '../../../util/canLaunchBrowser.js'

0 commit comments

Comments
 (0)