Files
certd/packages/plugins/src/abstract-plugin/index.js

18 lines
476 B
JavaScript
Raw Normal View History

2020-12-16 00:35:05 +08:00
import fs from 'fs'
export class AbstractPlugin {
async executeFromContextFile (options = {}) {
const { contextPath } = options
const contextJson = fs.readFileSync(contextPath)
const context = JSON.parse(contextJson)
const newContext = await this.execute(options, context)
fs.writeFileSync(JSON.stringify(newContext || context))
}
async execute (options, context) {
console.log('请实现此方法,context:', context)
return context
}
}