Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error(noSuchCommandText(commandOrGroup, subCommandName, this.commandGroups))
}
const command = commandInfo.command
if (command.group && command.group !== 'default') {
cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1)
}
const output = this.handlers.outputter
const {prompt} = this.handlers.prompter
const manifestPath = path.join(options.workDir, 'sanity.json')
debug(`Reading "${manifestPath}"`)
const baseManifest = await loadJson(manifestPath)
const manifest = reduceConfig(baseManifest || {}, environment, {
studioRootPath: options.workDir
})
const apiClient = clientWrapper(manifest, manifestPath)
const context = {
output,
prompt,
apiClient,
yarn,
chalk,
...options,
commandRunner: this
}
if (command.isGroupRoot) {
async function doDatasetImport(options) {
const {outputPath, coreCommands, template, datasetName, context} = options
const manifestPath = path.join(outputPath, 'sanity.json')
const baseManifest = await loadJson(manifestPath)
const manifest = reduceConfig(baseManifest || {}, environment, {
studioRootPath: outputPath
})
const importCmd = coreCommands.find(cmd => cmd.name === 'import' && cmd.group === 'dataset')
return importCmd.action(
{argsWithoutOptions: [template.datasetUrl, datasetName], extOptions: {}},
Object.assign({}, context, {
apiClient: clientWrapper(manifest, manifestPath),
workDir: outputPath,
fromInitCommand: true
})
)
}