Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Commit

Permalink
fix: allow action to override global config
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Dec 2, 2018
1 parent 676a7f9 commit 14d1fbf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/runActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = async (config, context) => {
stream.source(['!**/node_modules/**'].concat(action.files), {
baseDir: path.resolve(
context.generator.path,
config.templateDir || 'template'
action.templateDir || config.templateDir || 'template'
)
})

Expand Down Expand Up @@ -63,6 +63,7 @@ module.exports = async (config, context) => {
const transformer = require('jstransformer')(
require(`jstransformer-${config.transformer || 'ejs'}`)
)
const templateData = action.templateData || config.templateData
stream.writeContents(
relativePath,
transformer.render(
Expand All @@ -71,9 +72,9 @@ module.exports = async (config, context) => {
Object.assign(
{},
context.answers,
typeof config.templateData === 'function'
? config.templateData.call(context, context)
: config.templateData,
typeof templateData === 'function'
? templateData.call(context, context)
: templateData,
{
context
}
Expand Down

0 comments on commit 14d1fbf

Please sign in to comment.