Skip to content

Commit

Permalink
fix: revert runtime module ejs support
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Aug 19, 2019
1 parent f10aa85 commit ed3df96
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/@nodepack/service/src/lib/ServicePluginAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,22 @@ module.exports = class ServicePluginAPI {
* Add a runtime module that will be included in the app code
*/
addRuntimeModule (targetPath) {
const ejs = require('ejs')
const fs = require('fs-extra')
// @TODO proper ejs support

// const ejs = require('ejs')
// const fs = require('fs-extra')
const baseDir = extractCallDir()
const sourceFile = path.resolve(baseDir, targetPath)
const destFile = path.resolve(getConfigFolder(this.getCwd()), 'temp', 'runtime-render', `${targetPath}.js`)
const source = fs.readFileSync(sourceFile, { encoding: 'utf8' })
const result = ejs.render(source, {
projectOptions: this.service.projectOptions,
})
fs.ensureFileSync(destFile)
fs.writeFileSync(destFile, result, { encoding: 'utf8' })
this.service.runtimeModules.push(destFile)
// const destFile = path.resolve(getConfigFolder(this.getCwd()), 'temp', 'runtime-render', `${targetPath}.js`)
// const source = fs.readFileSync(sourceFile, { encoding: 'utf8' })
// const result = ejs.render(source, {
// projectOptions: this.service.projectOptions,
// })
// fs.ensureFileSync(destFile)
// fs.writeFileSync(destFile, result, { encoding: 'utf8' })
// this.service.runtimeModules.push(destFile)

this.service.runtimeModules.push(sourceFile)
}
}

Expand Down

0 comments on commit ed3df96

Please sign in to comment.