Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean cached template in downloadandgenerate #450

Merged
merged 2 commits into from
May 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
clean cached template in downloadandgenerate
  • Loading branch information
Steven Klein committed May 5, 2017
commit 88253081c6d1aa2c3e9a1c1c4b74950d123ed3ed
3 changes: 3 additions & 0 deletions bin/vue-init
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var home = require('user-home')
var tildify = require('tildify')
var chalk = require('chalk')
var inquirer = require('inquirer')
var rm = require('rimraf').sync
var logger = require('../lib/logger')
var generate = require('../lib/generate')
var checkVersion = require('../lib/check-version')
Expand Down Expand Up @@ -141,6 +142,8 @@ function run () {
function downloadAndGenerate (template) {
var spinner = ora('downloading template')
spinner.start()
// check if template is local
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use a proper comment, eg: Remove if local template exists

if (exists(tmp)) rm(tmp)
download(template, tmp, { clone: clone }, function (err) {
spinner.stop()
if (err) logger.fatal('Failed to download repo ' + template + ': ' + err.message.trim())
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"postcss-loader": "^1.2.1",
"read-metadata": "^1.0.0",
"request": "^2.67.0",
"rimraf": "^2.5.0",
"rimraf": "^2.6.1",
"semver": "^5.1.0",
"tildify": "^1.2.0",
"url-loader": "^0.5.7",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4610,7 +4610,7 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"

rimraf@2, rimraf@^2.2.8, rimraf@^2.5.0:
rimraf@2, rimraf@^2.2.8, rimraf@^2.5.0, rimraf@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
dependencies:
Expand Down