fix: add 'prompt' argument to loadConfig
This commit is contained in:
parent
b271e1e8df
commit
3132236449
|
|
@ -51,10 +51,9 @@ export const add = new Command()
|
|||
const { loadConfig, add } = frameworksCommands[framework]
|
||||
|
||||
// Read config
|
||||
const config = await loadConfig(cwd, options)
|
||||
const config = await loadConfig(cwd, options, false)
|
||||
if (!config) {
|
||||
consola.warn(`Configuration is missing. Please run ${colors.green('init')} to create a components.json file.`)
|
||||
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,9 @@ export const diff = new Command()
|
|||
const { loadConfig, diff } = frameworksCommands[framework]
|
||||
|
||||
// Load Config
|
||||
const config = await loadConfig(cwd, options)
|
||||
const config = await loadConfig(cwd, options, false)
|
||||
if (!config) {
|
||||
consola.warn(
|
||||
`Configuration is missing. Please run ${colors.green(
|
||||
'init',
|
||||
)} to create a components.json file.`,
|
||||
)
|
||||
consola.warn(`Configuration is missing. Please run ${colors.green('init')} to create a components.json file.`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import {
|
|||
resolveConfigPaths,
|
||||
} from '../../../utils/get-config'
|
||||
|
||||
export default async function (cwd: string, options: { yes: boolean, cwd: string }) {
|
||||
export default async function (cwd: string, options: { yes: boolean, cwd: string }, prompt: boolean) {
|
||||
const existingConfig = await getConfig(cwd)
|
||||
return await promptForConfig(cwd, existingConfig, options.yes)
|
||||
return prompt ? await promptForConfig(cwd, existingConfig, options.yes) : existingConfig
|
||||
}
|
||||
|
||||
async function promptForConfig(
|
||||
|
|
|
|||
|
|
@ -40,7 +40,11 @@ export const init = new Command()
|
|||
const { loadConfig, init } = frameworksCommands[framework]
|
||||
|
||||
// Read config
|
||||
const config = await loadConfig(cwd, options)
|
||||
const config = await loadConfig(cwd, options, true)
|
||||
if (!config) {
|
||||
consola.error(`Error loading config. Please run the ${colors.green('init')} command again.`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Init
|
||||
await init(cwd, config)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user