How to use the std-env.minimal function in std-env

To help you get started, we’ve selected a few std-env 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 nuxt / nuxt.js / packages / typescript / src / config-generation.js View on Github external
export async function generateTsConfigIfMissing(rootDir) {
  const tsConfigPath = resolve(rootDir, 'tsconfig.json')

  if (!existsSync(tsConfigPath)) {
    const { confirmGeneration } = await prompt({
      type: 'confirm',
      name: 'confirmGeneration',
      message: `Missing ${chalk.bold.blue('tsconfig.json')} in ${rootDir === process.cwd() ? 'current directory' : chalk.bold.green(resolve(rootDir))}, generate it ?`,
      initial: true,
      skip: env.minimal
    })

    if (confirmGeneration) {
      const configToExtend = '@nuxt/typescript'
      await writeJSON(tsConfigPath, {
        extends: configToExtend,
        compilerOptions: {
          baseUrl: '.',
          types: [
            '@types/node',
            '@nuxt/vue-app'
          ]
        }
      }, { spaces: 2 })
      consola.info(`Extending ${chalk.bold.blue(`node_modules/${configToExtend}/tsconfig.json`)}`)
      consola.success(`Generated successfully at ${chalk.bold.green(resolve(rootDir, 'tsconfig.json'))}`)

std-env

Runtime agnostic JS utils

MIT
Latest version published 11 months ago

Package Health Score

79 / 100
Full package analysis

Similar packages