Skip to content

Commit

Permalink
feat(semver): nested options template strings
Browse files Browse the repository at this point in the history
replace templateStrings like ${version} in version's postTarget's options also in nested structures and arrays.
  • Loading branch information
ndrsg committed Jun 2, 2022
1 parent 2f23f52 commit 08221df
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/semver/src/executors/version/utils/post-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ export function _getTargetOptions({
}): Record<string, unknown> {
return Object.entries(options).reduce(
(optionsAccumulator, [option, value]) => {
const resolvedValue =
typeof value === 'object'
? value
: coerce(
const resolvedValue =
Array.isArray(value) ?
value.map(_element => _getTargetOptions({ options: _element, context}))
:
typeof value === 'object' ?
_getTargetOptions({
options: value as Record<string, unknown>,
context
})
:
coerce(
createTemplateString(
(value as number | string | boolean).toString(),
context
Expand Down

0 comments on commit 08221df

Please sign in to comment.