-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement EDS Theming tooling #1738
Conversation
1b6508d
to
e00137b
Compare
size-limit report 📦
|
Codecov Report
@@ Coverage Diff @@
## next #1738 +/- ##
=======================================
Coverage 92.28% 92.28%
=======================================
Files 146 146
Lines 2580 2580
Branches 665 665
=======================================
Hits 2381 2381
Misses 183 183
Partials 16 16 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more 📢 Have feedback on the report? Share it here. |
e00137b
to
ffb888f
Compare
6c19d71
to
334ad8f
Compare
Created alpha version to test out on a few projects |
Two tools generate expected outputs! will add in some additional checks for reading config, then post for review |
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.
This makes sense to me! A couple questions and a nit in the readme only
} catch (e) { | ||
console.error('EDS package not installed. Using local path...'); | ||
packageRootPath = | ||
path.dirname(require.main.path) + '/src/tokens-dist/json/'; |
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.
what do we expect to be at this directory if eds is not installed?
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.
This little bit is essentially for testing WITHIN EDS. I tested most of the functionality by dog-fooding this in the repo. I can update the error message to be info
or something, and make this say something closer to that
if (config) { | ||
try { | ||
fs.copyFileSync( | ||
packageRootPath + 'theme-base.json', |
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.
where is theme-base created?
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.
theme-base.json
is generated along side the other style-dictionary output files (e.g., variables.css, et al), and gets shipped with EDS. For consumers it will live somewhere in node_modules/@chanzuckerberg/eds
, and this line will match that location
Each released version of EDS will include an updated version of this file for two uses:
- new projects will start off with a fresh copy that includes all the available tokens
- existing projects can do a diff against their copy and this one to add/remove tokens that changes from EDS version X to Y
That second thing is another reason we have people editing JSON, as it is MUCH easier to build tooling around diffing JSON object as opposed to CSS files or some other content.
|
||
`json` determines where the core theme file will be stored, and `css` determines where the resulting css token file will be stored. | ||
|
||
### eds-init-theme |
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.
nit: can we name the files generated by eds-init-theme
and specify which one to modify?
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.
👍🏾! added in file names in appropriate spots and better sequencing in the doc.s
EDIT: i forgot, rebased, and now the hashes changed, so that tag is in a detached HEAD state. which is fine. I'll just do a squash and merge like normal :) |
Tickets: [EDS-996, EDS-746, EDS-747, EDS-749] - handle initializing token override file from base - handle configuration for local paths to use - handle comparison to base in package for checksum - handle updates to themes when base has changed
- update naming for consistency - add in better ordering of commands and exception handling - sync changes to style-dictionary - add documentation for using EDS commands - update README to link to new documentation
This reverts commit 3abf575.
663a8ab
to
cf176f1
Compare
## [13.2.0](v13.1.1...v13.2.0) (2023-09-07) ### Features * **Avatar:** add in expanded size range ([#1734](#1734)) ([7af6e5e](7af6e5e)) * **tokens:** add tooling for EDS theming ([#1738](#1738)) ([91497bf](91497bf)) ### Bug Fixes * opt our rollup CJS build into TS's module interop behavior ([#1747](#1747)) ([2b0855e](2b0855e))
Summary:
This adds some utility scripts to EDS to support setting up, applying, and updating token definitions, using style-dictionary. Further enhancements will be to support reading outputs from figma into a format EDS understands, and flagging theming errors where possible. Final phase will include support for diffing against EDS updates, so that newly-added tokens are available, or deprecated tokens are flagged.
This will also include usage instructions in-repo, as this is developer tooling.
Test Plan:
along