perf: 小优化

This commit is contained in:
xiaojunnuo
2021-01-14 23:04:47 +08:00
parent 466f2b1a02
commit 8b0ca1da2e
18 changed files with 640 additions and 222 deletions

View File

@@ -2873,9 +2873,9 @@
"integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew="
},
"qs": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
"integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
"version": "6.9.6",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz",
"integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ=="
},
"randombytes": {
"version": "2.1.0",
@@ -3444,9 +3444,9 @@
}
},
"tencentcloud-sdk-nodejs": {
"version": "4.0.46",
"resolved": "https://registry.npmjs.org/tencentcloud-sdk-nodejs/-/tencentcloud-sdk-nodejs-4.0.46.tgz",
"integrity": "sha512-EP6K2da9yJsKWQcaMJ2dV2WyuwassBckUeLflGQZITKBz3kF92TkNdE1A1JzO74MAdzA2PhIuvaDXxxYAAaThA==",
"version": "4.0.49",
"resolved": "https://registry.npmjs.org/tencentcloud-sdk-nodejs/-/tencentcloud-sdk-nodejs-4.0.49.tgz",
"integrity": "sha512-4mZIwIup5oTtmlXtyyqGIUdpurLFdU25ZLcgjElcKOep8HYnMKVXNCvV57WXEMJx+UBc+wYg21OBQd6neUSkxg==",
"requires": {
"babel-eslint": "^10.0.2",
"eslint-plugin-react": "^7.17.0",

View File

@@ -22,7 +22,19 @@ export class Executor {
this.trace = new Trace()
}
use (plugin) {
useProviders (providers) {
if (providers) {
_.forEach(item => {
Certd.use(item)
})
}
}
useProvider (provider) {
Certd.use(provider)
}
usePlugin (plugin) {
if (plugin == null) {
return
}
@@ -38,9 +50,9 @@ export class Executor {
usePlugins (plugins) {
if (plugins) {
for (const plugin of plugins) {
this.use(plugin)
}
_.forEach(plugins, item => {
this.usePlugin(item)
})
}
}
@@ -58,7 +70,7 @@ export class Executor {
async doRun (options) {
// 申请证书
logger.info('任务开始')
const certd = new Certd(options)
const certd = new Certd(options, this.providers)
const cert = await this.runCertd(certd)
if (cert == null) {
throw new Error('申请证书失败')

View File

@@ -16,7 +16,10 @@ describe('AutoDeploy', function () {
this.timeout(120000)
const executor = new Executor()
const options = createOptions()
const ret = await executor.run(options, { forceCert: true, forceDeploy: false })
options.args.forceCert = true
options.args.forceDeploy = true
const ret = await executor.run(options)
expect(ret).ok
expect(ret.cert).ok
})