Skip to content

Commit

Permalink
fix: use deepclone allow dynamic template config
Browse files Browse the repository at this point in the history
  • Loading branch information
imcuttle committed Mar 31, 2018
1 parent 4ead7c1 commit 8865fef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/edam/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ export class Edam extends AwaitEventEmitter {
this,
[require(templateConfigPath), [this, this]]
)) || {}

// The below process would update templateConfig
// So we requires clone
templateConfig = _.cloneDeep(templateConfig)
this.templateConfigPath = templateConfigPath = require.resolve(
templateConfigPath
)
Expand Down
3 changes: 2 additions & 1 deletion packages/edam/src/mockPrompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ export default async function mockPrompts(
promptValues = {},
output?: string
): Promise<FileProcessor> {
const em: Edam = new Edam({ userc: false, yes: true })
const em: Edam = new Edam({ userc: false, yes: true, storePrompts: false })
em.config.output = output
em.once('prompt:after', variables => {
variables.assign(promptValues)
})

if (typeof template === 'string') {
return await em.process(template)
}
Expand Down

0 comments on commit 8865fef

Please sign in to comment.