Skip to content

Commit

Permalink
clean cached template in downloadandgenerate (#450) closed #409 #403
Browse files Browse the repository at this point in the history
* clean cached template in downloadandgenerate

* update comment for clarity
  • Loading branch information
steven-klein authored and egoist committed May 7, 2017
1 parent 305bdd0 commit 3f748c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
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 @@ -144,6 +145,8 @@ function run () {
function downloadAndGenerate (template) {
var spinner = ora('downloading template')
spinner.start()
// 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

0 comments on commit 3f748c7

Please sign in to comment.