Skip to content

Commit

Permalink
feat: use a lightweight "@inquirer/confirm" in the CLI (#2020)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Savoskin <sairu2k@gmail.com>
Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com>
  • Loading branch information
3 people committed Feb 12, 2024
1 parent a957235 commit f25af8a
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 17 deletions.
22 changes: 9 additions & 13 deletions cli/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const { until } = require('@open-draft/until')
const inquirer = require('inquirer')
const confirm = require('@inquirer/confirm')
const invariant = require('./invariant')
const { SERVICE_WORKER_BUILD_PATH } = require('../config/constants')

Expand Down Expand Up @@ -180,18 +180,14 @@ function saveWorkerDirectory(packageJsonPath, publicDir) {
}

function promptWorkerDirectoryUpdate(message, packageJsonPath, publicDir) {
return inquirer
.prompt({
type: 'confirm',
name: 'saveWorkerDirectory',
return confirm({
theme: {
prefix: chalk.yellowBright('?'),
message,
})
.then((answers) => {
if (!answers.saveWorkerDirectory) {
return
}

},
message,
}).then((answer) => {
if (answer) {
saveWorkerDirectory(packageJsonPath, publicDir)
})
}
})
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"dependencies": {
"@bundled-es-modules/cookie": "^2.0.0",
"@bundled-es-modules/statuses": "^1.0.1",
"@inquirer/confirm": "^3.0.0",
"@mswjs/cookies": "^1.1.0",
"@mswjs/interceptors": "^0.25.16",
"@open-draft/until": "^2.1.0",
Expand All @@ -123,7 +124,6 @@
"chokidar": "^3.4.2",
"graphql": "^16.8.1",
"headers-polyfill": "^4.0.2",
"inquirer": "^8.2.0",
"is-node-process": "^1.2.0",
"outvariant": "^1.4.2",
"path-to-regexp": "^6.2.0",
Expand Down

0 comments on commit f25af8a

Please sign in to comment.