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]
|
const { loadConfig, add } = frameworksCommands[framework]
|
||||||
|
|
||||||
// Read config
|
// Read config
|
||||||
const config = await loadConfig(cwd, options)
|
const config = await loadConfig(cwd, options, false)
|
||||||
if (!config) {
|
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)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,9 @@ export const diff = new Command()
|
||||||
const { loadConfig, diff } = frameworksCommands[framework]
|
const { loadConfig, diff } = frameworksCommands[framework]
|
||||||
|
|
||||||
// Load Config
|
// Load Config
|
||||||
const config = await loadConfig(cwd, options)
|
const config = await loadConfig(cwd, options, false)
|
||||||
if (!config) {
|
if (!config) {
|
||||||
consola.warn(
|
consola.warn(`Configuration is missing. Please run ${colors.green('init')} to create a components.json file.`)
|
||||||
`Configuration is missing. Please run ${colors.green(
|
|
||||||
'init',
|
|
||||||
)} to create a components.json file.`,
|
|
||||||
)
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ import {
|
||||||
resolveConfigPaths,
|
resolveConfigPaths,
|
||||||
} from '../../../utils/get-config'
|
} 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)
|
const existingConfig = await getConfig(cwd)
|
||||||
return await promptForConfig(cwd, existingConfig, options.yes)
|
return prompt ? await promptForConfig(cwd, existingConfig, options.yes) : existingConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
async function promptForConfig(
|
async function promptForConfig(
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,11 @@ export const init = new Command()
|
||||||
const { loadConfig, init } = frameworksCommands[framework]
|
const { loadConfig, init } = frameworksCommands[framework]
|
||||||
|
|
||||||
// Read config
|
// 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
|
// Init
|
||||||
await init(cwd, config)
|
await init(cwd, config)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user