-
Notifications
You must be signed in to change notification settings - Fork 6
[DIT 11281] CLI support for components #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DIT 11281] CLI support for components #124
Conversation
| for (let i = 0; i < data.components.length; i++) { | ||
| const component = data.components[i]; | ||
| this.transformAPITextEntity(component, data.variablesById); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we always write components to file after writing textItems, component files will always be sorted last in the generated index.js file
marla-hoggard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing went well! I left one suggestion for a small refactor, but otherwise everything looks good. Do we want to merge this as is and then open another PR with the nested folders filter or just wait for that PR to merge and get it updated here?
We will need to be careful about the timing of merging and publishing. If we can merge to v5-beta without releasing the update externally, then we can go ahead and merge any time. But I think we should wait to publish again until:
- This is updated with the new nested folder param + root support
- We publicly release component dev ids
| this.variablesOutputFile = new JSONOutputFile({ | ||
| filename: "variables", | ||
| path: this.outDir, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why we didn't need these before and do now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled these out into instance variables so that they can be referenced transformAPITextEntity, which handles writing to these files for a given textItem/component returned from API response
transformAPITextEntity is called on each text entity returned from API, to avoid code duplication for comps and textItems
|
@JWhite30515 This looks good except for the We will also need to make sure we're doing versioning correctly - think we have to update the version in package.json before we merge. |
|
Now that Screen.Recording.2025-09-25.at.1.52.00.PM.mov |
marla-hoggard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks good! I tested again with root and excludeNestedFolders and all still looks good.
I'm approving but don't merge this just yet. We'll coordinate merging this in the proper sequence with the other related pieces on Monday.
package.json
Outdated
| { | ||
| "name": "@dittowords/cli", | ||
| "version": "5.0.0-beta.6", | ||
| "version": "5.0.0-beta.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are actually moving to v8. Looks like the steps to properly release v7 last month were not followed, missing the version bump and publishing release notes 😬
| "version": "5.0.0-beta.7", | |
| "version": "5.0.0-beta.8", |

Overview
Adds support for fetching components via NS CLI
Context
DIT-11281: CLI support for components
Screenshots
Screen.Recording.2025-09-19.at.12.53.20.PM.mov
Test Plan
Now the CLI config file supports a
componentsobject, that specifies afoldersfield to filter down by folder.The top-level field called
componentsis mainly for ease of distinguishing b/w project and component sources, we could have just had a top-level field calledfoldersbut that wouldn't be immediately clear to user it's for Library (confusion b/w project folders + component folders)This is for JSON formatting, so test with
vue-i18nandi18nextformats:v5-betaCLI branch, runyarncomponents: {}orcomponents: folders: []to existing config.yml pulling down from projects, runningyarn start pullshould pull down from ALL components as well as projects (with no variants filter, should see onlycomponents__base.jsonwritten to)variants: [{ id: all }]or whichever ids you want to specify, pull down, should write a components file to each variant for each group of components that has that variant (e.g. if you have components with French variant, should write tocomponents__{french_dev_id}.jsoncomponents__baseorcomponents__variantId)index.jsfile that's generated, component files are always exported last after the project-named filescomponent: folders: [<{id: string}>], should only pull components from that folder and its childrenrichText: htmlto one of your output configs, should show rich text for components with rich textoutputs, that writes to another file, specify a specific set of component folders and only those components should show up in this extra output file