How to use the prompts/dist.inject function in prompts

To help you get started, we’ve selected a few prompts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jxnblk / mdx-docs / packages / create-docs / cli.js View on Github external
const run = async opts => {
  prompts.inject(opts)
  const response = await prompts(form)

  if (!response.confirm) {
    log('aborted')
    process.exit(0)
  }
  const { name } = response
  const template = templates[response.template] || templates[0]

  log('creating docs...')

  if (!name) {
    log.error('name is required')
    // todo: prompt again
    process.exit(1)
  }
github AlexxNB / svelte-docs / packages / create / cli.js View on Github external
const run = async opts => {
  prompts.inject(opts)
  const response = await prompts(form)

  if (!response.confirm) {
    log('aborted')
    process.exit(0)
  }
  const { name } = response
  const theme = themes[response.theme] || themes[0]

  log('Creating docs ...')

  if (!name) {
    log.error('name is required')
    process.exit(1)
  }