Skip to content

Commit

Permalink
⚡improve download experience
Browse files Browse the repository at this point in the history
  • Loading branch information
LHammer committed May 6, 2018
1 parent b86af80 commit dd94cb1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/ydt-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const download = require('download-git-repo')
const inquirer = require('inquirer')
const fs = require('fs')
const ini = require('ini')
const ora = require('ora')
const chalk = require('chalk')

const prompts = [
{
Expand Down Expand Up @@ -93,7 +95,10 @@ module.exports = () => {
})
} else {
inquirer.prompt(prompts).then((answers) => {
const spinner = ora('downloading emplate……')
spinner.start()
download(template, tmp, false, (err) => {
spinner.succeed(chalk.green('download successful~'))
if (err) logger.error('Failed to download repo ' + template + ': ' + err)
initProject(tmp, answers);
})
Expand Down
47 changes: 47 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"download-git-repo": "^1.0.2",
"ini": "^1.3.5",
"inquirer": "^5.2.0",
"ora": "^2.1.0",
"read-metadata": "^1.0.0",
"request": "^2.85.0"
}
Expand Down

0 comments on commit dd94cb1

Please sign in to comment.