Skip to content

Commit

Permalink
feat(token-cli): 参照できないtokenがあるとき、warnを出すがそのまま処理を続ける
Browse files Browse the repository at this point in the history
  • Loading branch information
mimokmt committed Dec 4, 2024
1 parent c0ae5d6 commit 6613787
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions packages/token-cli/src/createToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,36 @@ export const createToken = (

if (!v) throw new Error(`can't find variable: ${it}`)

return {
[v.name]: {
value: resolveValue(
variableCollectionMap,
variableMap,
v.resolvedType,
v,
modeId
),
},
try {
const value = resolveValue(
variableCollectionMap,
variableMap,
v.resolvedType,
v,
modeId
)
return {
[v.name]: {
value,
},
}
} catch (e) {
if (e instanceof Error) {
// eslint-disable-next-line no-console
console.warn(`[warn]: ${e.message}`)
}
return undefined
}
})
.filter(
(
it
): it is {
[x: string]: {
value: string
}
} => it !== undefined
)
.reduce((prev, current) => ({
...prev,
...current,
Expand Down

0 comments on commit 6613787

Please sign in to comment.