Skip to content
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

feat: upgrade internal deps, ui, tokens, types #605

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/perfect-schools-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@tokens-studio/graph-engine-nodes-design-tokens": patch
"@tokens-studio/react-storybook-graph-engine": patch
"@tokens-studio/graph-editor": patch
"@tokens-studio/graph-engine": patch
"@tokens-studio/graph-engine-nodes-figma": patch
"@tokens-studio/graph-engine-nodes-fs": patch
"@tokens-studio/graph-engine-ui": patch
---

Upgrade @tokens-studio dependencies to latest, to avoid un-dedupable shared deps with Studio App and stitches styles from old UI leaking through.
7 changes: 3 additions & 4 deletions packages/graph-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@
"@rematch/core": "2.2.0",
"@tokens-studio/graph-engine": "*",
"@tokens-studio/icons": "^0.1.4",
"@tokens-studio/tokens": "0.3.4",
"@tokens-studio/types": "^0.2.3",
"@tokens-studio/ui": "^1.0.7",
"@tokens-studio/types": "^0.5.1",
"@tokens-studio/ui": "^1.0.10",
"@xzdarcy/react-timeline-editor": "^0.1.9",
"array-move": "^4.0.0",
"classnames": "^2.3.2",
Expand Down Expand Up @@ -140,4 +139,4 @@
"publishConfig": {
"access": "public"
}
}
}
2 changes: 1 addition & 1 deletion packages/graph-editor/src/data/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '4.3.8';
export const version = '4.3.9';
7 changes: 2 additions & 5 deletions packages/graph-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"dependencies": {
"@bundled-es-modules/deepmerge": "^4.3.1",
"@tokens-studio/types": "^0.3.0",
"@tokens-studio/types": "^0.5.1",
jorenbroekema marked this conversation as resolved.
Show resolved Hide resolved
"ajv": "^8.17.1",
"color-blind-esm": "^0.1.4",
"colorjs.io": "^0.5.2",
Expand All @@ -52,9 +52,6 @@
"uuid": "^9.0.1",
"z-schema-esm": "^6.0.1"
},
"peerDependencies": {
"@tokens-studio/types": "^0.3.0"
},
"devDependencies": {
"@babel/preset-env": "^7.21.5",
"@changesets/cli": "^2.26.0",
Expand All @@ -72,4 +69,4 @@
"tokens",
"ui"
]
}
}
2 changes: 1 addition & 1 deletion packages/graph-engine/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const flatten = (
acc.push({
name: [...keyPath, key].join('.'),
value: leaf.value,
type: leaf.type,
type: leaf.type!,
description: leaf.description
});
return acc;
Expand Down
4 changes: 2 additions & 2 deletions packages/nodes-design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
},
"dependencies": {
"@adobe/leonardo-contrast-colors": "^1.0.0",
"@tokens-studio/types": "^0.4.0",
"@tokens-studio/ui": "^0.6.9",
"@tokens-studio/types": "^0.5.1",
"@tokens-studio/ui": "^1.0.10",
"colorjs.io": "^0.5.2",
"dot-prop": "^8.0.2",
"lodash.orderby": "^4.6.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/nodes-figma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"test": "vitest run"
},
"dependencies": {
"@tokens-studio/types": "^0.4.0",
"@tokens-studio/ui": "^0.6.9",
"@tokens-studio/types": "^0.5.1",
"@tokens-studio/ui": "^1.0.10",
"dot-prop": "^8.0.2"
},
"peerDependencies": {
Expand Down Expand Up @@ -65,4 +65,4 @@
"tokens",
"ui"
]
}
}
6 changes: 5 additions & 1 deletion packages/nodes-figma/src/utils/tokenMerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export function mergeTokenExtensions(
figmaExtension: DeepPartial<FigmaExtension>
): SingleToken {
const existingExtensions = token.$extensions || {};
const existingFigmaExt = existingExtensions['com.figma'] || {};
const existingFigmaExt = (existingExtensions['com.figma'] || {}) as Record<
string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
any
>;

const mergedFigmaExt = {
...existingFigmaExt,
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes-fs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"test": "vitest run"
},
"dependencies": {
"@tokens-studio/ui": "^0.6.9",
"@tokens-studio/ui": "^1.0.10",
"mobx-react-lite": "^4.0.5"
},
"peerDependencies": {
Expand Down
8 changes: 7 additions & 1 deletion packages/nodes-fs/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
include: ['tests/**/*.test.[jt]s?(x)'],
globals: true
globals: true,
server: {
deps: {
// to ensure importing CSS files is working
inline: ['@tokens-studio/ui']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update this for the other packages?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if we're using Vitest and using our latest DS that uses CSS modules imports

}
}
}
});
6 changes: 3 additions & 3 deletions packages/storybook-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@tokens-studio/sd-transforms": "^0.15.2",
"@tokens-studio/sd-transforms": "^1.2.9",
"chokidar": "^3.6.0",
"fbp-client": "^0.4.3",
"fs-extra": "^11.2.0",
"storybook": "^8.0.10",
"style-dictionary": "^4.0.0-prerelease.38"
"style-dictionary": "^4.3.0"
}
}
}
25 changes: 10 additions & 15 deletions packages/storybook-react/scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
nodes as designNodes,
flatTokensRestoreToMap
} from '@tokens-studio/graph-engine-nodes-design-tokens';
import { registerTransforms } from '@tokens-studio/sd-transforms';
import { register } from '@tokens-studio/sd-transforms';
import StyleDictionary from 'style-dictionary';
import chokidar from 'chokidar';
import fs from 'fs-extra';
import pathLib from 'path';
import pathLib from 'node:path';
import type { IResolvedToken } from '@tokens-studio/graph-editor/index.js';

//@ts-expect-error
registerTransforms(StyleDictionary, { casing: 'kebab' });
register(StyleDictionary);

type GenerateTokens = {
component: string;
Expand All @@ -33,11 +33,7 @@ async function generateTokens(opts: GenerateTokens) {
.join(basepath, 'generated', 'tokens', `${theme}.json`)
.replace(/\\/g, '/')
],
fileHeader: {
autoGeneratedFileHeader: () => {
return [`Do not edit directly, this file was auto-generated`];
}
},
preprocessors: ['tokens-studio'],
platforms: {
css: {
transformGroup: 'tokens-studio',
Expand All @@ -48,23 +44,22 @@ async function generateTokens(opts: GenerateTokens) {
.replace(/\\/g, '/'),
format: 'css/variables',
options: {
selector: `.${component}--${theme}`,
fileHeader: 'autoGeneratedFileHeader'
selector: `.${component}--${theme}`
}
}

// component tokens, e.g. for design system developer
// ...generateComponentFiles([component], theme),
]
}
}
}));

for (const cfg of configs) {
const buildPlatforms = async cfg => {
const sd = new StyleDictionary(cfg);
await sd.cleanAllPlatforms();
await sd.buildAllPlatforms();
}
};
await Promise.all(configs.map(buildPlatforms));
}

//These are all the nodes that are available in the editor
Expand Down Expand Up @@ -166,7 +161,7 @@ ${Object.entries(meta)

type TokenFile = {
name: string;
tokens: unknown;
tokens: IResolvedToken[];
};

const tokenFiles: TokenFile[] = [];
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"@tokens-studio/graph-engine-nodes-design-tokens": "*",
"@tokens-studio/graph-engine-nodes-figma": "*",
"@tokens-studio/graph-engine-nodes-image": "*",
"@tokens-studio/icons": "0.1.4",
"@tokens-studio/tokens": "0.3.4",
"@tokens-studio/ui": "^1.0.7",
"@tokens-studio/icons": "^0.1.4",
"@tokens-studio/tokens": "^0.3.7",
"@tokens-studio/ui": "^1.0.10",
"@ts-rest/core": "^3.51.0",
"@ts-rest/open-api": "^3.51.0",
"@ts-rest/react-query": "^3.51.0",
Expand Down Expand Up @@ -104,4 +104,4 @@
"@welldone-software/why-did-you-render": "^7.0.1",
"typescript": "^5.4.5"
}
}
}
2 changes: 1 addition & 1 deletion packages/ui/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '@tokens-studio/tokens/css/ts-theme-dark.css';
import '@tokens-studio/tokens/css/ts-theme-light.css';

import '@tokens-studio/tokens/css/base.css';
import '@tokens-studio/ui/normalize.css';
import '@tokens-studio/ui/css/normalize.css';

import '@fontsource/geist-mono/400.css';
import '@fontsource/geist-mono/500.css';
Expand Down
Loading
Loading