|
@@ -4,6 +4,7 @@ const { DownloaderHelper } = require('node-downloader-helper')
|
|
const decompress = require('decompress')
|
|
const decompress = require('decompress')
|
|
const path = require('path')
|
|
const path = require('path')
|
|
const fs = require('fs')
|
|
const fs = require('fs')
|
|
|
|
+const rm = require('rimraf').sync
|
|
|
|
|
|
export interface FormatParams {
|
|
export interface FormatParams {
|
|
type: string
|
|
type: string
|
|
@@ -61,11 +62,13 @@ export default class DownloadRemoteProjectTemplate {
|
|
}
|
|
}
|
|
return this.download(url, realDestinationFolder, this.hooks.getOptions()).then(async () => {
|
|
return this.download(url, realDestinationFolder, this.hooks.getOptions()).then(async () => {
|
|
if (extract) {
|
|
if (extract) {
|
|
- await decompress(path.resolve(realDestinationFolder, this.FileName), realDestinationFolder, {
|
|
|
|
|
|
+ const zipPath = path.resolve(realDestinationFolder, this.FileName)
|
|
|
|
+ await decompress(zipPath, realDestinationFolder, {
|
|
filter: this.hooks.doFilterFiles,
|
|
filter: this.hooks.doFilterFiles,
|
|
strip: params.strip
|
|
strip: params.strip
|
|
}).then(() => {
|
|
}).then(() => {
|
|
console.log(i18next.t('success_extract'))
|
|
console.log(i18next.t('success_extract'))
|
|
|
|
+ rm(zipPath)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|