mirror of
https://github.com/certd/certd.git
synced 2026-04-25 05:07:25 +08:00
refactor: 0.1.12
This commit is contained in:
@@ -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