Skip to content

Commit

Permalink
Prepare v1 release (#283)
Browse files Browse the repository at this point in the history
* feat: no longer remove newlines from descriptions

* feat: remove expand util/option, use SD one instead

* feat: remove CSS shorthand transforms, use SD ones instead

* feat: adjust font-styles parser to also include fontWeight tokens

* chore: fix unit tests coverage

* feat: add align-types preprocessor to align with DTCG

* feat: refactor transforms to apply to composites

* chore: fix integration tests, add readme note expand

* chore: align index.js entrypoint exports

* feat: remove CJS, no implicit any

* chore: fix type issue preprocessedtokens

* feat: final changes for SD v4 and this pkg v1.0.0
  • Loading branch information
jorenbroekema authored Jul 1, 2024
1 parent 46a9c48 commit 67edf4b
Show file tree
Hide file tree
Showing 77 changed files with 5,158 additions and 5,237 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-shoes-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': minor
---

Adjust add-font-styles parser to also run on tokens of type fontWeight, to create a sibling token for the fontStyle if it is included in the fontWeight token.
5 changes: 5 additions & 0 deletions .changeset/giant-days-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': major
---

BREAKING: `descriptionToComment` transform no longer removes newlines, just turns carriage returns into newlines. Style Dictionary now handles comments with newlines properly in its createPropertyFormatter utility.
5 changes: 5 additions & 0 deletions .changeset/good-ties-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': major
---

BREAKING: Remove `expand` option, composite/object-value tokens must be expanded by using [Style Dictionary Expand](https://v4.styledictionary.com/reference/config/#expand).
5 changes: 5 additions & 0 deletions .changeset/new-points-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': major
---

BREAKING: remove CommonJS entrypoint and tools/scripts required to dual publish. Now that Style Dictionary v4 is ESM-only, this library will follow suit.
14 changes: 14 additions & 0 deletions .changeset/odd-phones-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@tokens-studio/sd-transforms': major
---

BREAKING: `transformFontWeights` has been renamed to `transformFontWeight` for consistency.

Apply transforms to object-value (composite) token types:

- HEXRGBa transform applies to border and shadow colors
- Px dimension transform applies to border, typography and shadow dimensions
- Letterspacing, lineheights and fontweights transforms apply to these respective typography properties
- Resolve math transform applies to all properties of border, typography and shadow tokens

This also means that all transforms except for description to comment mapping are now transitive transforms, since the math resolve transform must be transitive and all other transforms must apply after the math one.
7 changes: 7 additions & 0 deletions .changeset/polite-cobras-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@tokens-studio/sd-transforms': major
---

BREAKING: remove CSS shorthand transforms for border, typography and shadow. Use the Style Dictionary transforms instead: https://styledictionary.com/reference/hooks/transforms/predefined/#bordercssshorthand.

Note that if you're not disabling the `withSDBuiltins` option, the `tokens-studio` transformGroup will include the ones in the `css` built-in transformGroup, so you might not notice the fact that they are moved.
5 changes: 5 additions & 0 deletions .changeset/twelve-icons-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/sd-transforms': minor
---

Add an adjust-types preprocessor utility that aligns the Tokens Studio types / object-value props with the DTCG ones.
15 changes: 15 additions & 0 deletions .changeset/yellow-nails-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@tokens-studio/sd-transforms': major
---

- BREAKING: Compatible with Style Dictionary >= v4.0.0. Not compatible with anything below that SD version.

- BREAKING: `registerTransforms` function has been renamed to `register`.

- BREAKING: `transforms` array has been refactored to `getTransforms()`, which is a function you should call. Optionally pass in the new platform option as parameter `{ platform: 'css' /* or 'compose' */}`

- BREAKING: By default, registered `tokens-studio` transformGroup will include the platform's Style Dictionary built-in transforms. E.g. if you're registering for platform `css` it will include the `css` transformGroup transforms from Style Dictionary, appended to the Tokens Studio specific transforms. This behavior can be disabled by passing `{ withSDBuiltins: false }`.

- Allow passing platform to the `register()` call: `register(SD, { platform: 'compose' })`. Default value is `'css'`. This means your `tokens-studio` group will be registered for that specific platform.

- Allow passing `name` to the `register()` call to configure the transformGroup name: `register(SD, { name: 'tokens-studio-css' })`. Default value is `tokens-studio`.
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: npm run lint

- name: Install chromium
run: npx playwright install-deps chromium
run: npx playwright install --with-deps chromium

- name: Unit tests
run: npm run test:unit
Expand Down
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Contributing Guidelines

Things to know before contributing:
Any contribution is greatly appreciated. If you feel like you lack knowledge/experience, even just creating a good issue with a minimal reproduction is already huge.
If you can create a PR with a failing test showing the bug you found, even better, don't worry about putting the test in the perfect location but as a rule of thumb, if your bug is only reproducible in combination with Style Dictionary, put it in the `test/integration`, if it's more isolated to sd-transforms you can put it in `test/spec` folder.

Is TypeScript not your strength and having issues? No problem, just do what you can and I'll help you fix whatever's broken in the PR.

## Tests

Expand All @@ -15,6 +18,9 @@ To run the tests and view the coverage report, to see which things are untested.

If some line of code really cannot be covered by a test or just doesn't make sense, [see here how to ignore them](https://modern-web.dev/docs/test-runner/writing-tests/code-coverage/#ignoring-uncovered-lines).

> 100% may seem a bit crazy, but just know that it's a lot easier to retain 100% than to get it for the first time ;)
> The biggest benefit to 100% is that it makes it very easy to identify redundant code; if it's redundant, it won't be covered.
## Linting

This checks code quality with ESLint, formatting with Prettier and types with TypeScript.
Expand Down
Loading

0 comments on commit 67edf4b

Please sign in to comment.