Conversation
✅ Storybook build successful
Relevant files
|
PR Reviewer Guide 🔍(Review updated until commit f71858c)Here are some key observations to aid the review process:
|
| parser: ({ contents }: { filePath: string; contents: string }) => { | ||
| const data = JSON.parse(contents); |
There was a problem hiding this comment.
Suggestion: Wrap JSON.parse(contents) in a try-catch block to handle malformed JSON files gracefully. This prevents the build process from crashing with an unhandled exception and allows for a more descriptive error message that includes the filePath. [possible issue, importance: 7]
| parser: ({ contents }: { filePath: string; contents: string }) => { | |
| const data = JSON.parse(contents); | |
| parser: ({ contents, filePath }: { filePath: string; contents: string }) => { | |
| let data: any; | |
| try { | |
| data = JSON.parse(contents); | |
| } catch (e) { | |
| throw new Error(`Failed to parse ${filePath}: ${e instanceof Error ? e.message : String(e)}`); | |
| } |
1cf15e3 to
f71858c
Compare
|
Persistent review updated to latest commit f71858c |
|
Failed to generate code suggestions for PR |
| export const T1_DIRECTORY_NAME = 't1-primitive'; | ||
| export const T2_DIRECTORY_NAME = 't2-semantic'; | ||
| export const T3_DIRECTORY_NAME = 't3-component'; |
There was a problem hiding this comment.
Nit: these constants are already defined in /packages/tokens/scripts/scripts/build-tokens/src/constants/design-token-tiers.ts, could we re-use them?
| @@ -0,0 +1,31 @@ | |||
| import { AUTO_GENERATED_FILE_HEADER } from '../../constants/auto-generated-file-header.ts'; | |||
|
|
|||
| export const VARIABLE_PREFIX = 'esds'; | |||
There was a problem hiding this comment.
Nit: could we re-use or defined this constant in the same folder as CSS_VARIABLE_PREFIX, see packages/tokens/scripts/scripts/build-tokens/src/constants/css-variable-prefix.ts
| * Name transform that replicates the exact naming logic from the custom DTCG framework. | ||
| */ | ||
| export const nameTransform: Transform = { | ||
| name: 'esds/name', |
There was a problem hiding this comment.
Question: should esds come from a constant?
| import { segmentKebabCase } from './helpers.ts'; | ||
|
|
||
| /** | ||
| * Name transform that replicates the exact naming logic from the custom DTCG framework. |
There was a problem hiding this comment.
Question: how is DTCG custom? It should be a standard, no?
Do you mean "custom parser" ?
There was a problem hiding this comment.
Not, it's not a parser, it's for the output.
But I think it's an oversight of my part with testing cause actually SD have a Kebabcase transform built-in
| * source files define different $type at their root level. | ||
| */ | ||
| export const fixTypeInheritanceParser = { | ||
| name: 'esds/fix-type-inheritance', |
There was a problem hiding this comment.
Question: should esds come from a constant?
| @@ -0,0 +1,23 @@ | |||
| /** | |||
| * Custom parser that moves root-level $type into each top-level group. | |||
| * This prevents SD5's merge from losing per-file $type when multiple | |||
There was a problem hiding this comment.
Question: what does SD5 mean here?
There was a problem hiding this comment.
| * This prevents SD5's merge from losing per-file $type when multiple | |
| * This prevents Style Dictionary's merge from losing per-file $type when multiple |
This PR adds Helpers and parser that Style dictionary needs to work