How to use the @adonisjs/sink.isEmptyDir function in @adonisjs/sink

To help you get started, we’ve selected a few @adonisjs/sink 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 AdonisCommunity / create-adonis-ts-app / index.ts View on Github external
* file
   */
  if (state.eslint === null) {
    try {
      state.eslint = await new Prompt().confirm('Setup eslint?')
    } catch (_) {
      process.exit(1)
    }
  }

  /**
   * Ensuring that defined path exists
   */
  ensureDirSync(absPath)

  if (!isEmptyDir(absPath)) {
    const errors = [
      `Cannot overwrite contents of {${projectRoot}} directory.`,
      'Make sure to define path to an empty directory',
    ]

    logger.error(errors.join(' '))
    return
  }

  /**
   * Set environment variables that can be used by the packages
   * to tweak their setup behavior
   */
  process.env['ADONIS_CREATE_APP_NAME'] = state.name
  process.env['ADONIS_CREATE_ESLINT'] = String(state.eslint)
  process.env['ADONIS_CREATE_APP_CLIENT'] = state.client