Skip to content

Commit 8865fef

Browse files
committed
fix: use deepclone allow dynamic template config
1 parent 4ead7c1 commit 8865fef

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/edam/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ export class Edam extends AwaitEventEmitter {
289289
this,
290290
[require(templateConfigPath), [this, this]]
291291
)) || {}
292+
293+
// The below process would update templateConfig
294+
// So we requires clone
295+
templateConfig = _.cloneDeep(templateConfig)
292296
this.templateConfigPath = templateConfigPath = require.resolve(
293297
templateConfigPath
294298
)

packages/edam/src/mockPrompts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ export default async function mockPrompts(
1414
promptValues = {},
1515
output?: string
1616
): Promise<FileProcessor> {
17-
const em: Edam = new Edam({ userc: false, yes: true })
17+
const em: Edam = new Edam({ userc: false, yes: true, storePrompts: false })
1818
em.config.output = output
1919
em.once('prompt:after', variables => {
2020
variables.assign(promptValues)
2121
})
22+
2223
if (typeof template === 'string') {
2324
return await em.process(template)
2425
}

0 commit comments

Comments
 (0)