tokens-studio / sd-transforms

Custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio
MIT License
175 stars 27 forks source link

"transforms must be an array of registered value transforms" #276

Closed ipoly closed 2 months ago

ipoly commented 3 months ago

https://github.com/tokens-studio/sd-transforms/blob/376cbe605b5bd0765ba6b744d2a178078d260815/src/registerTransforms.ts#L212

The 'name/camel' here will cause an error to be thrown.

Xround2303 commented 2 months ago

Скорее всего проблема из за 4 версии style-dictionary, image

jorenbroekema commented 2 months ago

Which version of sd-transforms vs style-dictionary are you using?

remypar5 commented 2 months ago

I have the same issue. Using:

@tokens-studio/sd-transforms: 0.15.2
style-dictionary: 3.9.2

Both are latest at the time of writing.

remypar5 commented 2 months ago

If @tokens-studio/sd-transforms is depending on a specific version(-range) of style-dictionary, you might want to add that to peerDependencies

remypar5 commented 2 months ago

I fixed it for now using the following change:

diff --git a/dist/src/registerTransforms.js b/dist/src/registerTransforms.js
index 4ead120b89e8db6a98ccb1ea7513f6609ad37660..ab7e170c84f0a6161c10730909d0f70ddf261a3c 100644
--- a/dist/src/registerTransforms.js
+++ b/dist/src/registerTransforms.js
@@ -182,7 +182,7 @@ async function registerTransforms(sd, transformOpts) {
         name: 'tokens-studio',
         // add a default name transform, since this is almost always needed
         // it's easy to override by users, adding their own "transforms"
-        transforms: [...transforms, 'name/camel'],
+        transforms: [...transforms, 'name/cti/camel'],
     });
 }
jorenbroekema commented 2 months ago

I added a compatibility table in the README now and upgraded this package to 0.16.0 to be compatible with the latest Style Dictionary prerelease (27).

I used to avoid peerDependencies but I read that they're installed by default now in most package managers, so I'll give this a shot. https://github.com/tokens-studio/sd-transforms/pull/278