mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-20 19:40:59 -05:00
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
module.exports = function fetchRemotePreset (name, clone) {
|
||||
const fs = require('fs-extra')
|
||||
|
||||
module.exports = async function fetchRemotePreset (name, clone) {
|
||||
// github shorthand fastpath
|
||||
if (!clone && /^[\w_-]+\/[\w_-]+$/.test(name)) {
|
||||
const { request } = require('@vue/cli-shared-utils')
|
||||
@@ -12,6 +14,12 @@ module.exports = function fetchRemotePreset (name, clone) {
|
||||
const download = require('download-git-repo')
|
||||
const tmpdir = path.join(os.tmpdir(), 'vue-cli')
|
||||
|
||||
// clone will fail if tmpdir already exists
|
||||
// https://github.com/flipxfx/download-git-repo/issues/41
|
||||
if (clone) {
|
||||
await fs.remove(tmpdir)
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
download(name, tmpdir, { clone }, err => {
|
||||
if (err) return reject(err)
|
||||
|
||||
Reference in New Issue
Block a user