v3-installer
Advanced tools
Comparing version 1.0.27 to 1.0.28
@@ -19,5 +19,6 @@ /** | ||
/* 要添加的脚本内容 */ | ||
/* 要添加的脚本内容,如果存在相同的命令则不做改变,否则更新命令 */ | ||
scripts["v3:install"] = scripts["v3:install"] || "v3installer -i" | ||
scripts["v3:uninstall"] = scripts["v3:uninstall"] || "v3installer -u"; | ||
scripts["npm:install"] = scripts["npm:install"] || "v3installer -n"; | ||
@@ -24,0 +25,0 @@ ioUtils.write(packageJsonPath, JSON.stringify(packageJson, null, "\t")).catch(err => { |
@@ -12,2 +12,3 @@ #!/usr/bin/env node | ||
.option('-u, --uninstall', '卸载当前已安装的依赖构件') | ||
.option('-n, --npminstall', '安装原生npm插件') | ||
.parse(process.argv); | ||
@@ -19,4 +20,6 @@ /* 根据命令行参数确定执行安装还是卸载操作 */ | ||
v3installer._simpleUnistall(program.args); | ||
} else if (program.npminstall) { | ||
v3installer._npmInstall(program.args); | ||
} else { | ||
program.help(); | ||
} |
65
index.js
@@ -15,2 +15,3 @@ /** | ||
const V3PlatformResult = require('./src/model/V3PlatformResult'); | ||
const pathUtils = require('./src/utils/PathUtils'); | ||
module.exports = { | ||
@@ -30,4 +31,5 @@ _handleError: function (err, simpleMode) { | ||
break; | ||
default: | ||
errMsg = err.message; | ||
} | ||
} else { | ||
@@ -41,5 +43,5 @@ errMsg = err.stack; | ||
}, | ||
_handleSuccess: function (simpleMode) { | ||
_handleSuccess: function (simpleMode, message) { | ||
if (simpleMode) { | ||
new V3PlatformResult(true, "PluginInstallSuccess", "安装本地V3平台插件完成!").consoleStr(); | ||
new V3PlatformResult(true, "PluginInstallSuccess", message || "安装本地V3平台插件完成!").consoleStr(); | ||
} else { | ||
@@ -116,3 +118,3 @@ console.log('安装本地V3平台插件完成!'); | ||
} else { | ||
let libCode = 'dev'; | ||
let libCode; | ||
let downAndInstall = () => { | ||
@@ -167,3 +169,3 @@ /*@TODO 根据参数从vstore中搜索构件并显示列表 */ | ||
/** | ||
* 简易安装,只执行本地jar安装,且不进行关联依赖解析安装 | ||
* 简易安装,只执行本地jar安装,且不进行关联依赖解析安装,用于打包中心 | ||
*/ | ||
@@ -182,3 +184,3 @@ _simpleInstall: function (args) { | ||
} catch (err) { | ||
this._handleError('传入的vstore账号参数格式错误!',true); | ||
this._handleError('传入的vstore账号参数格式错误!', true); | ||
return; | ||
@@ -189,3 +191,3 @@ } | ||
console.log('开始安装本地V3平台插件,请稍候...'); | ||
let installer = new VPlatformPluginInstaller(pluginPath, null, true, argCfg); | ||
let installer = new VPlatformPluginInstaller(pluginPath, true, argCfg); | ||
let promise = installer.install(); | ||
@@ -197,6 +199,6 @@ promise.then(() => { | ||
console.log('安装V3平台插件出现错误!'); | ||
this._handleError(err,true); | ||
this._handleError(err, true); | ||
}); | ||
} else { | ||
this._handleError(`插件路径${argPath}不存在,安装失败!`,true); | ||
this._handleError(`插件路径${argPath}不存在,安装失败!`, true); | ||
} | ||
@@ -207,5 +209,48 @@ }, | ||
*/ | ||
_simpleUnistall:function(args){ | ||
_simpleUnistall: function (args) { | ||
PluginUninstall._simpleUnistall(args[0] || null); | ||
}, | ||
/** | ||
* 提供npm原生插件批量安装功能 | ||
*/ | ||
_npmInstall: function (args) { | ||
//排除列表过滤后的安装列表 | ||
let installList = []; | ||
let metadataPath = path.resolve(pathUtils.getPluginPath(), 'metadata.json'); | ||
try { | ||
let metadata = require(metadataPath); | ||
for (let i = 0; i < args.length; i++) { | ||
let checkName = args[i]; | ||
if (args[i].indexOf('@') > 0) { | ||
checkName = args[i].substring(0, args[i].indexOf('@')); | ||
} | ||
if (metadata.excludePlugins.indexOf(checkName) < 0) { | ||
installList.push(args[i]); | ||
} | ||
} | ||
let promises = []; | ||
installList.forEach(plugin => { | ||
let install = new Promise((resolve, reject) => { | ||
console.log(`正在安装 ${plugin} ...`); | ||
childProcess.exec(`npm i ${plugin} --save-dev`, (err, stdout, stderr) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
console.log(`${plugin} 安装完成.`); | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
promises.push(install); | ||
}); | ||
Promise.all(promises).then(() => { | ||
this._handleSuccess(true, "插件安装完成!"); | ||
}).catch(err => { | ||
this._handleError(err, true); | ||
}); | ||
} catch (err) { | ||
this._handleError(err, true); | ||
console.log(`读取元信息文件${metadataPath}失败!`); | ||
} | ||
} | ||
} |
{ | ||
"name": "v3-installer", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"description": "v3二次开发插件安装器", | ||
@@ -11,5 +11,7 @@ "main": "index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"prepublish": "node bin/prepublihs.js", | ||
"install": "node bin/init.js", | ||
"v3:install": "v3installer -i", | ||
"v3:uninstall": "v3installer -u" | ||
"v3:uninstall": "v3installer -u", | ||
"npm:install": "v3installer -n" | ||
}, | ||
@@ -16,0 +18,0 @@ "keywords": [ |
@@ -13,3 +13,4 @@ /** | ||
const PluginDepInfo = require('../model/PluginDepInfo'); | ||
const cacheUtils = require('../utils/CacheUtils'); | ||
const stringUtils = require('../utils/StringUtils'); | ||
class PluginAnalyzer { | ||
@@ -22,30 +23,57 @@ /** | ||
*/ | ||
constructor(pluginJarPath, pluginName, unZipDir) { | ||
constructor(pluginJarPath) { | ||
this.pluginJarPath = pluginJarPath; | ||
this.unZipDir = unZipDir; | ||
this.pluginName = pluginName; | ||
this.cfgPath = unZipDir + PathSep + pluginName; | ||
/* node插件的解压路径 */ | ||
this.nodejsPluginPath = unZipDir + PathSep + "nodePlugin"; | ||
this.tgzCachePath = cacheUtils.getTgzCachePath(); | ||
this.cfgPath = path.join(this.tgzCachePath, 'v3cfgCache'); | ||
/* 保存从jar包中解析到的v3配置文件信息 */ | ||
this.v3DevConfigs = []; | ||
/* 保存jar解压后内部的node插件路径 */ | ||
this.tgzFiles = []; | ||
this.tgzFiles = {}; | ||
this.jarMd5 = stringUtils.toMd5(path.basename(this.pluginJarPath)); | ||
} | ||
/* 解压jar包到指定文件夹下 */ | ||
/* 解压jar包内的tgz文件到指定文件夹下 */ | ||
_decompressJar() { | ||
return new Promise((resolve, reject) => { | ||
decompress(this.pluginJarPath, this.nodejsPluginPath, { | ||
decompress(this.pluginJarPath, this.tgzCachePath, { | ||
filter: (data) => { | ||
return data.type == 'file' && data.path.endsWith('.tgz'); | ||
// 获取元信息xml和tgz压缩包 | ||
return path.basename(data.path) == 'vplatform-plugin-metadata.xml' || (data.type == 'file' && data.path.endsWith('.tgz')); | ||
}, | ||
map: (file) => { | ||
let extName = path.extname(file.path); | ||
/* 使用jar包文件名的md5值作为解压出来的tgz文件名 */ | ||
if (extName == '.xml') { | ||
file.path = 'metadata' + path.sep + this.jarMd5 + extName; | ||
} else { | ||
file.path = this.jarMd5 + extName; | ||
} | ||
return file; | ||
} | ||
}).then((files) => { | ||
let TgzFiles = []; | ||
for (let i = 0; i < files.length; i++) { | ||
let filePath = path.resolve(this.nodejsPluginPath, files[i].path); | ||
TgzFiles.push(filePath); | ||
/* 同时保存到解析器属性中 */ | ||
this.tgzFiles.push(filePath); | ||
let TgzFiles = {}; | ||
let metadataXml, tgzFile; | ||
files.forEach(file => { | ||
let extName = path.extname(file.path); | ||
let fileAbsPath = path.resolve(this.tgzCachePath, file.path); | ||
if (extName == '.xml') { | ||
metadataXml = fileAbsPath; | ||
} else if (extName == '.tgz') { | ||
tgzFile = fileAbsPath; | ||
} | ||
}); | ||
if (fs.existsSync(metadataXml)) { | ||
let parser = new xml2js.Parser(); | ||
let data = fs.readFileSync(metadataXml); | ||
parser.parseString(data, (err, result) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
let pluginName = result.root.pluginName; | ||
TgzFiles[pluginName] = tgzFile; | ||
/* 同时保存到解析器属性中 */ | ||
this.tgzFiles[pluginName] = tgzFile; | ||
resolve(TgzFiles); | ||
}); | ||
} | ||
resolve(TgzFiles); | ||
}).catch(err => { | ||
@@ -58,12 +86,17 @@ reject(err); | ||
_getV3DevConfigFromTgz(TgzFiles) { | ||
let pluginNames = Object.keys(TgzFiles); | ||
return new Promise((resolve, reject) => { | ||
let getV3cfg = () => { | ||
if (TgzFiles.length == 0) { | ||
if (pluginNames.length == 0) { | ||
resolve(this.v3DevConfigs); | ||
return; | ||
} | ||
let tgzFile = TgzFiles.pop(); | ||
decompress(tgzFile, this.cfgPath, { | ||
let pluginName = pluginNames.pop(); | ||
decompress(TgzFiles[pluginName], this.cfgPath, { | ||
filter: (data) => { | ||
return data.type == 'file' && data.path.endsWith('.v3devrc'); | ||
}, | ||
map: (file) => { | ||
file.path = path.basename(file.path); | ||
return file; | ||
} | ||
@@ -74,7 +107,8 @@ }).then((files) => { | ||
for (let i = 0; i < files.length; i++) { | ||
cfgFiles.push(this.cfgPath + PathSep + files[i].path); | ||
cfgFiles.push(path.join(this.cfgPath, files[i].path)); | ||
} | ||
try { | ||
for (let j = 0; j < cfgFiles.length; j++) { | ||
this.v3DevConfigs.push(JSON.parse(fs.readFileSync(cfgFiles[j]))); | ||
let v3cfg = JSON.parse(fs.readFileSync(cfgFiles[j])); | ||
this.v3DevConfigs.push(v3cfg); | ||
} | ||
@@ -171,3 +205,3 @@ fileUtils.removeDirectory(this.cfgPath); | ||
/* 移除临时文件夹 */ | ||
fileUtils.removeDirectory(xmlPath); | ||
//fileUtils.removeDirectory(xmlPath); | ||
getDepInfo(); | ||
@@ -188,11 +222,13 @@ }); | ||
this._decompressJar().then(TgzFiles => { | ||
this._getV3DevConfigFromTgz(TgzFiles).then(v3DevConfigs => { | ||
this._getPluginDepInfo(v3DevConfigs).then(pluginDepInfo => { | ||
resolve([this.tgzFiles, pluginDepInfo]); | ||
}) | ||
}) | ||
}); | ||
return this._getV3DevConfigFromTgz(TgzFiles); | ||
}).then(v3DevConfigs => { | ||
return this._getPluginDepInfo(v3DevConfigs); | ||
}).then(pluginDepInfo => { | ||
resolve([this.tgzFiles, pluginDepInfo]); | ||
}).catch(err => { | ||
reject(err); | ||
}) | ||
} catch (e) { | ||
console.error(e); | ||
fileUtils.removeDirectory(this.unZipDir); | ||
fileUtils.removeDirectory(this.tgzCachePath); | ||
} | ||
@@ -199,0 +235,0 @@ }); |
@@ -5,3 +5,2 @@ const configUtils = require('../utils/ConfigUtils'); | ||
const path = require('path'); | ||
const PathSep = path.sep; | ||
const fs = require('fs'); | ||
@@ -15,2 +14,3 @@ const fileUtils = require('../utils/FileUtils'); | ||
const prompt = require('inquirer').prompt; | ||
const cacheUtils = require('../utils/CacheUtils'); | ||
/* 从vstore中安装构件到本地 */ | ||
@@ -24,10 +24,8 @@ class VPlatformPluginInstaller { | ||
*/ | ||
constructor(jarFiles, downloadPath, simpleMode, vstoreCfg) { | ||
constructor(jarFiles, simpleMode, vstoreCfg) { | ||
this.jarFiles = jarFiles; | ||
this.simpleMode = simpleMode || false; | ||
this.downloadPath = downloadPath || this._getNewDirPath(); | ||
this.vstoreCfg = vstoreCfg; | ||
vstoreCfg.simpleMode = this.simpleMode; | ||
this.downloader = new VpluginDownloader(this.downloadPath, vstoreCfg); | ||
this.unZipDir = pathUtils.getPluginPath() + PathSep + "analyTmp" | ||
this.downloader = new VpluginDownloader(vstoreCfg); | ||
} | ||
@@ -56,8 +54,7 @@ | ||
return new Promise((resolve, reject) => { | ||
let jarFiles = []; | ||
jarFiles = jarFiles.concat(this.jarFiles); | ||
let jarFiles = [].concat(this.jarFiles); | ||
/* 拷贝一份文件列表用于作为递归变量 */ | ||
let files = [].concat(jarFiles); | ||
/* 解压后的tgz文件路径 */ | ||
let tgzFiles = []; | ||
let tgzFiles = {}; | ||
/* 全部依赖信息 */ | ||
@@ -72,3 +69,3 @@ let pluginDepInfo = new PluginDepInfo(); | ||
/* 解析器 */ | ||
let pluginAnalyzer = new PluginAnalyzer(file, this.symbolicName, this.unZipDir); | ||
let pluginAnalyzer = new PluginAnalyzer(file); | ||
pluginAnalyzer._analyze().then((result) => { | ||
@@ -78,3 +75,3 @@ if (result.length == 2) { | ||
let resultDepInfo = result[1]; | ||
tgzFiles = tgzFiles.concat(resultFiles); | ||
tgzFiles = Object.assign(tgzFiles, resultFiles); | ||
/* 整合依赖信息 */ | ||
@@ -86,6 +83,7 @@ pluginDepInfo.dependencies = pluginDepInfo.dependencies.concat(resultDepInfo.dependencies); | ||
} | ||
}).catch(err => { | ||
reject(err); | ||
}); | ||
} //analyze | ||
analyze(); | ||
}); | ||
@@ -119,5 +117,5 @@ } | ||
/* 解析器 */ | ||
let pluginAnalyzer = new PluginAnalyzer(file, this.symbolicName, this.unZipDir); | ||
let pluginAnalyzer = new PluginAnalyzer(file); | ||
pluginAnalyzer._decompressJar().then((TgzFiles) => { | ||
tgzFiles = tgzFiles.concat(TgzFiles); | ||
tgzFiles = Object.assign(tgzFiles, TgzFiles); | ||
/* 解压下一个依赖 */ | ||
@@ -160,24 +158,25 @@ decompressDep(); | ||
_installNodeJsPlugin(tgzFiles) { | ||
let pluginNames = Object.keys(tgzFiles); | ||
return new Promise((resolve, reject) => { | ||
let npmInstall = () => { | ||
if (tgzFiles.length == 0) { | ||
resolve(); | ||
return; | ||
} | ||
let tgzfile = tgzFiles.pop(); | ||
console.log('安装:' + tgzfile); | ||
childProcess.exec("npm install " + tgzfile + " --no-save --ignore-scripts", { | ||
cwd: pathUtils.getPluginPath() | ||
}, (err, stdout, stderr) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
console.log(stdout); | ||
npmInstall(); | ||
let promises = []; | ||
pluginNames.forEach(plugin => { | ||
let install = new Promise((resolve, reject) => { | ||
console.log(`正在安装 ${plugin} ...`); | ||
childProcess.exec(`npm i ${tgzFiles[plugin]} --save-dev`, (err, stdout, stderr) => { | ||
console.log(stdout); | ||
if (err) { | ||
reject(err); | ||
} else { | ||
console.log(`${plugin} 安装完成.`); | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
//childProcess.execSync("npm install " + tgzfile + " --no-save --ignore-scripts"); | ||
npmInstall(); | ||
} //npmInstall | ||
npmInstall(); | ||
promises.push(install); | ||
}); | ||
Promise.all(promises).then(() => { | ||
resolve(); | ||
}).catch(err => { | ||
reject(err); | ||
}) | ||
}); | ||
@@ -187,26 +186,51 @@ } | ||
_installPluginByUnzip(tgzFiles) { | ||
let nodePath = path.resolve(pathUtils.getPluginPath(), "node_modules"); | ||
let v3_modulesPath = cacheUtils.getV3_modulesPath(); | ||
let pluginNames = Object.keys(tgzFiles); | ||
return new Promise((resolve, reject) => { | ||
let unZip = () => { | ||
if (tgzFiles.length == 0) { | ||
resolve(); | ||
return; | ||
} | ||
let tgzfile = tgzFiles.pop(); | ||
/* 获取插件的node解压路径文件名 */ | ||
let nodeUnzipDir = nodePath + PathSep + tgzfile.substring(tgzfile.lastIndexOf(PathSep) + 1, tgzfile.lastIndexOf('-')); | ||
if (fs.existsSync(nodeUnzipDir)) { | ||
fileUtils.removeDirectory(nodeUnzipDir); | ||
} | ||
/* 通过map的方式除去一层package目录 */ | ||
decompress(tgzfile, nodeUnzipDir, { | ||
map: file => { | ||
file.path = file.path.replace('package/', ""); | ||
return file; | ||
let promises = []; | ||
pluginNames.forEach(pluginName => { | ||
let installPromise = new Promise((resv, rej) => { | ||
console.log(`正在安装 ${pluginName} ...`); | ||
/* 获取插件的node解压路径文件名 */ | ||
let nodeUnzipDir = path.resolve(v3_modulesPath, pluginName); | ||
if (fs.existsSync(nodeUnzipDir)) { | ||
fileUtils.removeDirectory(nodeUnzipDir); | ||
} | ||
}).then(() => { | ||
unZip(); | ||
/* 通过map的方式除去一层package目录 */ | ||
decompress(tgzFiles[pluginName], nodeUnzipDir, { | ||
map: file => { | ||
file.path = file.path.replace('package/', ""); | ||
return file; | ||
} | ||
}).then(() => { | ||
try { | ||
let pluginPackagePath = path.resolve(nodeUnzipDir, 'package.json'); | ||
let packageJson = require(pluginPackagePath); | ||
// 清除二次开发项目中的npm依赖 | ||
packageJson.dependencies = {}; | ||
packageJson.devDependencies = {}; | ||
fs.writeFileSync(pluginPackagePath, JSON.stringify(packageJson, null, '\t')); | ||
// 通过链接文件夹的方式安装 | ||
childProcess.exec(`npm i ${nodeUnzipDir} --save-dev`, (err, stdout, stderr) => { | ||
if (err) { | ||
rej(err); | ||
} else { | ||
console.log(`${pluginName} 安装完成.`); | ||
resv(); | ||
} | ||
}); | ||
} catch (err) { | ||
rej(err); | ||
} | ||
}); | ||
}); | ||
} | ||
unZip(); | ||
promises.push(installPromise); | ||
}); | ||
Promise.all(promises).then(() => { | ||
//清除tgz缓存文件夹 | ||
fileUtils.removeDirectory(cacheUtils.getTgzCachePath()); | ||
resolve(); | ||
}).catch(err => { | ||
reject(err); | ||
}); | ||
}); | ||
@@ -219,6 +243,6 @@ } | ||
this._preInstall().then(tgzFiles => { | ||
this._installPluginByUnzip(tgzFiles).then(() => { | ||
this._afterInstall(); | ||
resolve(); | ||
}); | ||
return this._installPluginByUnzip(tgzFiles); | ||
}).then(() => { | ||
//this._afterInstall(); | ||
resolve(); | ||
}).catch(err => { | ||
@@ -259,4 +283,4 @@ this._afterInstall(); | ||
_afterInstall() { | ||
fileUtils.removeDirectory(this.downloadPath); | ||
fileUtils.removeDirectory(this.unZipDir); | ||
//fileUtils.removeDirectory(this.downloadPath); | ||
//fileUtils.removeDirectory(this.unZipDir); | ||
} | ||
@@ -263,0 +287,0 @@ /* 将解析出来的依赖添加到用户项目配置文件中 */ |
@@ -12,2 +12,3 @@ /** | ||
const fs = require('fs'); | ||
const cacheUtils = require('../utils/CacheUtils'); | ||
class VpluginDownloader { | ||
@@ -19,5 +20,5 @@ /** | ||
*/ | ||
constructor(downloadPath, config) { | ||
constructor(config) { | ||
this.taskList = []; | ||
this.downloadPath = downloadPath || this._getNewDirPath(); | ||
this.downloadPath = cacheUtils.getJarCachePath(); | ||
this.config = config; | ||
@@ -61,3 +62,3 @@ } | ||
/* 获取文件id */ | ||
_getFileId(task) { | ||
_getFileInfo(task) { | ||
return new Promise((resolve, reject) => { | ||
@@ -110,4 +111,4 @@ /* 内部函数 */ | ||
try { | ||
let fildId = body.data.results.componentVers.result.datas.values[0].fileId; | ||
resolve(fildId); | ||
let resultValue = body.data.results.componentVers.result.datas.values[0]; | ||
resolve(resultValue); | ||
return; | ||
@@ -135,2 +136,3 @@ } catch (e) { | ||
_start() { | ||
let Jarmanifest = cacheUtils.getManifest(this.downloadPath); | ||
return new Promise((resolve, reject) => { | ||
@@ -141,2 +143,4 @@ /* 已经下载完成的文件列表 */ | ||
if (this.taskList.length == 0) { | ||
/* 保存缓存信息 */ | ||
cacheUtils.updateJarManifest(Jarmanifest); | ||
resolve(finishFiles); | ||
@@ -147,25 +151,40 @@ return; | ||
console.log(`下载插件: ${task.name}`); | ||
this._getFileId(task).then((fileId) => { | ||
let params = { | ||
data: { | ||
dataId: fileId | ||
} | ||
}; | ||
let json = JSON.stringify(params); | ||
let encodedJson = encodeURIComponent(json); | ||
let paramData = { | ||
token: encodedJson | ||
}; | ||
let absPath = path.join(this.downloadPath, task.name + ".jar"); | ||
needle.get("http://www.toone.com.cn:8808/module-operation!executeOperation?operation=PartFileDown&token=" + encodedJson, { | ||
output: absPath | ||
}, (err, resp, body) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
this._getFileInfo(task).then((fileInfo) => { | ||
let catchfile = cacheUtils.getJarFromCache(task.name); | ||
/* 如果从vstore中获取的文件id与缓存的文件id相同则采用本地缓存,否则下载新文件 */ | ||
if (catchfile && catchfile.vstoreId == fileInfo.fileId) { | ||
finishFiles[task.name] = catchfile.filePath; | ||
download(); | ||
} else { | ||
let params = { | ||
data: { | ||
dataId: fileInfo.fileId | ||
} | ||
}; | ||
/* 如果没有出错则添加到已下载列表,然后开启下一个任务 */ | ||
finishFiles[task.name] = absPath; | ||
download(); | ||
}); | ||
let json = JSON.stringify(params); | ||
let encodedJson = encodeURIComponent(json); | ||
let paramData = { | ||
token: encodedJson | ||
}; | ||
let absPath = path.join(this.downloadPath, task.name + ".jar"); | ||
needle.get("http://www.toone.com.cn:8808/module-operation!executeOperation?operation=PartFileDown&token=" + encodedJson, { | ||
output: absPath | ||
}, (err, resp, body) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
}; | ||
/* 如果没有出错则添加到已下载列表,然后开启下一个任务 */ | ||
finishFiles[task.name] = absPath; | ||
Jarmanifest.push({ | ||
symbolicName: task.name, | ||
libType: task.libType, | ||
vstoreId: fileInfo.fileId, | ||
version: fileInfo.bundleVersion, | ||
filePath: absPath, | ||
timestamp: Date.now() | ||
}); | ||
download(); | ||
}); | ||
} | ||
}).catch(err => { | ||
@@ -172,0 +191,0 @@ reject(err); |
@@ -15,4 +15,3 @@ const pathUtils = require('../utils/PathUtils'); | ||
this.libType = libType; | ||
this.downloadPath = this._getNewDirPath(); | ||
this.downloader = new VpluginDownloader(this.downloadPath); | ||
this.downloader = new VpluginDownloader(); | ||
this.unZipDir = pathUtils.getPluginPath() + PathSep + "analyTmp" | ||
@@ -41,3 +40,3 @@ } | ||
/* 使用本地安装器 */ | ||
let vplatformPluginInstaller = new VPlatformPluginInstaller(Object.values(fileList), this.downloadPath, false, { | ||
let vplatformPluginInstaller = new VPlatformPluginInstaller(Object.values(fileList), false, { | ||
libType: this.libType | ||
@@ -44,0 +43,0 @@ }); |
@@ -28,3 +28,3 @@ /** | ||
this.keywords = keywords; | ||
params.data.libCode = libCode; | ||
params.data.libCode = libCode||'dev'; | ||
} | ||
@@ -31,0 +31,0 @@ /* 查询操作 */ |
@@ -151,3 +151,3 @@ const fs = require("fs"); | ||
} catch (err) { | ||
console.log('目录删除失败!'); | ||
console.log(`目录${dirPath}删除失败!`); | ||
console.log(err); | ||
@@ -154,0 +154,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93807
2404
25
20