-
Notifications
You must be signed in to change notification settings - Fork 3
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
Generate JavaScript tokens #790
Conversation
💥 No ChangesetLatest commit: 97554e5 Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂 If these changes should be published to npm, you need to add a changeset. Click here to learn what changesets are, and how to add one. Click here if you're a maintainer who wants to add a changeset to this PR |
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 failed for me. I added
import { textDark } from '../../design-tokens/generated/colors.js';
console.log(textDark);
to elastic-textarea.ts
and then ran npm run build
per your testing instructions.
It failed because colors.js
doesn't exist. It looks like the build
command doesn't run the preprocess
command. I think we could just add preprocess to the build command like so:
npm run clean && npm run preprocess && run-p build:*
@cloudfour/dev @calebeby My heart sank as I added
I tried following the recommendations in this Stack Overflow thread, but they don't seem to work. I'm beyond frustrated. So far, 100% of my experience with TypeScript has been resolving unhelpful errors. I don't know what else to try. |
This looks like it is an error coming from If that is the case, then I think we should find an alternative to |
@calebeby as a way to keep Tyler moving forward with this PR, could we temporarily comment out the If not, is there something we could do to help Tyler get this unblocked? I'm unfamiliar with what Basically, I think we need to prioritize getting this PR unblocked. That could mean either we fix the root problem if it's quick, or we add a short-term workaround and then file an issue to fix the problem the right way as a separate effort. |
Since we have continuous publishing to npm, I think we shouldn't merge this PR to v-next with buildTypes commented out, because that means that a release could be triggered to npm with types missing, which should be a breaking change. @tylersticka If you want I can make the changes in another PR today to switch out dts-bundle-generator |
@calebeby That would be great! Thank you for your help. |
Feedback addressed and updated with @calebeby's TypeScript improvements. Appears to work on my end once testing steps are followed. |
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.
Works great!
Overview
This is an alternative approach to #788. Instead of exposing Theo tokens directly via Rollup, the tokens are preprocessed and JavaScript versions are generated.
The drawback to this approach are that the import paths are a little longer and recompiling token changes is a bit slower.
But there are a few benefits:
types.ds
file.import
values directly instead of as a glob.Screenshots
Testing
npm run build
dist/cloudfour-patterns.js
.npm run lint
andnpm run type
to make sure there are no errors after that change was made./CC @calebeby