INNER CODE UNIT · TypeScript

assertIsCleanSlate

prisma-labs/graphql-framework-experiment · src/cli/commands/create/app.ts:355

async function assertIsCleanSlate() {
  log.trace('checking folder is in a clean state')
  const contents = await fs.listAsync()

  if (contents !== undefined && contents.length > 0) {
    proc.fatal('Cannot create a new nexus project here because the directory is not empty', {
      contents,
    })
  }
}

async function scaffoldTemplate(template: Template) {
  return Promise.all(
    template.files.map(({ path, content }) => {
      return fs.writeAsync(path, content)
    })
  )
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…