Skip to content

Commit

Permalink
fix(design): design tool setup and initial state handling (#2031)
Browse files Browse the repository at this point in the history
## Proposed change

Fix design tool setup and initial state handling
  • Loading branch information
matthieu-crouzet authored Aug 7, 2024
2 parents 66c55a9 + ccdc890 commit fa1b685
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@
"{projectRoot}/dist/builders/**/*.json",
"{projectRoot}/dist/schemas/**/*.json",
"{projectRoot}/dist/schematics/**/*.json",
"{projectRoot}/dist/schematics/**/templates/**"
"{projectRoot}/dist/schematics/**/templates/**",
"{projectRoot}/dist/schematics/**/templates-*/**"
],
"cache": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export const registerGenerateCssBuilder = (projectName?: string, taskName = 'gen
const themeFile = posix.join(srcBasePath, 'style', 'theme.scss');
const taskOptions: GenerateCssSchematicsSchema = {
defaultStyleFile: themeFile,
renderPrivateVariableTo: 'sass',
templateFile: posix.join(workspaceRootPath, 'design-token.template.json'),
designTokenFilePatterns: [
posix.join(srcBasePath, 'style', '*.json'),
posix.join(srcBasePath, '**', '*.theme.json')
]
};
const taskParameters = {
builder: '@o3r/design:generate-css',
options: taskOptions,
configuration: {
configurations: {
watch: { watch: true }
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ const walkThroughDesignTokenNodes = (
* @param specification Design Token content as specified on https://design-tokens.github.io/community-group/format/
*/
export const parseDesignToken = (specification: DesignTokenSpecification): DesignTokenVariableSet => {
return walkThroughDesignTokenNodes(specification.document, specification.context, [], new Map());
const initialMap: DesignTokenVariableSet = new Map();
if (Object.keys(specification.document).every((key) => key.startsWith('$'))) {
return initialMap;
}
return walkThroughDesignTokenNodes(specification.document, specification.context, [], initialMap);
};

interface ParseDesignTokenFileOptions {
Expand Down

0 comments on commit fa1b685

Please sign in to comment.