mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
refactor: 0.1.12
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
@@ -37,5 +37,6 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"nodemon": "^1.19.1"
|
||||
}
|
||||
},
|
||||
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user