refactor: 0.1.12

This commit is contained in:
xiaojunnuo
2021-02-05 14:45:53 +08:00
parent 4a421d5b14
commit 45547d6f94
10 changed files with 22 additions and 12 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import Router from 'koa-router'
import fs from 'fs'
import exportsService from '../service/exports-service.js'
// import executorPkg from '@certd/executor/package.json'
const router = Router()
router.prefix('/exports')
+2 -1
View File
@@ -37,5 +37,6 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"nodemon": "^1.19.1"
}
},
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
}
+9 -3
View File
@@ -4,7 +4,8 @@ import pathUtil from '../utils/util.path.js'
import cryptoRandomString from 'crypto-random-string'
import zipUtil from '../utils/util.zip.js'
import path from 'path'
import executorPkg from '@certd/executor/package.json'
import templatePkg from '@/templates/certd-run/package.json'
export default {
async exportsToZip (options, dirName) {
const tempDir = os.tmpdir()
@@ -19,11 +20,16 @@ export default {
console.log('targetProjectDir', targetProjectDir)
fs.copySync(templateDir, targetProjectDir)
// const packageFilePath = path.join(targetProjectDir, 'package.json')
// options
const optionsFilePath = path.join(targetProjectDir, 'options.json')
fs.writeJsonSync(optionsFilePath, options)
// 依赖版本
const currentVersion = executorPkg.version
templatePkg.dependencies['@certd/executor'] = '^' + currentVersion
const pkgFilePath = path.join(targetProjectDir, 'package.json')
fs.writeJsonSync(pkgFilePath, templatePkg)
const zipName = dirName + '.zip'
const outputFilePath = path.join(targetDir, zipName)