internals/setup.js
/**
 * Checks if we are under Git version control.
 * If we are and this a clone of our repository the user is given a choice to
 * either keep it or start with a new repository.
 * @returns {Promise<boolean>}
 */
Checks if we are under Git version control.
If we are and this a clone of our repository the user is given a choice to
either keep it or start with a new repository.
@returns {Promise}
Checks if we are under Git version control . If we are and this a clone of our repository the user is given a choice to either keep it or start with a new repository . @returns { Promise }
async function cleanCurrentRepository() {
  const hasGitRepo = await hasGitRepository().catch(onError)
  if (hasGitRepo === false) {
    return await askUserIfWeShouldCreateNewRepo()
  }
  const isClone = await checkIfRepositoryIsAClone().catch(onError)
  if (isClone === false) {
    return false
  }
  const answer = await askUserIfWeShouldCreateNewRepo()
  if (answer === true) {
    const spinner = ora('Removing current repository').start()
    await removeGitRepository().catch(reason => {
      spinner.fail(reason)
      onError()
    })
    spinner.succeed('Repository removed')
  }
  return answer
}
async function cleanCurrentRepository ( ) { const hasGitRepo = await hasGitRepository ( ) . catch ( onError ) if ( hasGitRepo === false ) { return await askUserIfWeShouldCreateNewRepo ( ) } const isClone = await checkIfRepositoryIsAClone ( ) . catch ( onError ) if ( isClone === false ) { return false } const answer = await askUserIfWeShouldCreateNewRepo ( ) if ( answer === true ) { const spinner = ora ( 'Removing current repository' ) . start ( ) await removeGitRepository ( ) . catch ( reason => { spinner . fail ( reason ) onError ( ) } ) spinner . succeed ( 'Repository removed' ) } return answer }
Checks if we are under Git version control.
Checks if we are under Git version control .
// We are not under Git version control. So, do nothing // Not our clone so do nothing