-
Notifications
You must be signed in to change notification settings - Fork 38
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: support colors as args for create tokens #2290
Conversation
🦋 Changeset detectedLatest commit: e6ab6fb The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Preview deployments for this pull request: 📖 Storybook See all deployments at https://dev.designsystemet.no |
beca00f
to
8a20dd5
Compare
Still abit of work left on the CLI for scaling this to multiple themes and typography, but this serves currently as a good start. Also works in Figma with Token Studio. Suggest we have a small demo+talk about whats been done here, and the way further @eirikbacker @Barsnes @Thuneer |
3c2be3d
to
e84089b
Compare
tokenCmd | ||
.command('build') | ||
.description('Build Designsystemet tokens') | ||
.option('-t, --tokens <string>', `Path to ${chalk.blue('design-tokens')}`, './design-tokens') |
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.
her har vi -t
/ --tokens
på kommando tokens build
og senere kommer -w
/ --write
på kommando tokens create
Om jeg forstår rett er begge hvilken mappe tokens skal legges i?
Skulle vi kjørt den mer konvensjonelle --dir
eller --out
i såfall? :)
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.
Det var en av tinga jeg ville ta opp i demoen :)
Jeg brukte --out
tidligere, men ble litt inspirert av biomejs sin --write
.
Slik den fungere nå:
cmd --write
-> skriver til default (./design-tokens
)cmd --write ./my-path-for-tokens
-> skriver til ønsket sticmd
-> token generes, men ingenting skrives til disk. Returnere json objekt med tokens. Dette kan være nyttig for de som vil pipe output selv en plass (f.eks,cmd > tokens.json
,cmd | pbcopy
)
Du kan og forsåvidt kjøre dette skriptet direkte fra kode
import { createTokens } from "@digdir/designsystemet/tokens"
const tokens = createTokens({colors:…})
.option('-b3, --brand3 <number>', `Brand3 hex color`) | ||
.option('-f, --font-family <string>', `Font family`) | ||
.action(async (opts) => { | ||
// const out = typeof opts.out === 'string' ? opts.out : './dist/tokens'; |
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.
Kommentert ut?
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"designsystemet": "tsx ./bin/designsystemet.ts", | ||
"build:tokens": "yarn clean:theme && yarn designsystemet tokens -p -t ../../design-tokens -o ../../packages/theme/brand", | ||
"build:tokens:debug": "yarn clean:theme && tsx --inspect-brk ./bin/designsystemet.ts tokens -p -t ../../design-tokens -o ../../packages/theme/brand", | ||
"build:tokens": "yarn clean:theme && yarn designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand", |
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.
Veldig minor: Skulle vi skrevet ut parameter i fullversjon i våre egne scripts? Dersom noen utenifra skal bidra inn i prosjektet, så er det lettere å lese tokens build --preview
enn å gjette hva -p
betyr <3
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.
ja, men ikke glad i den optionen, har lyst å ta livet av den 😅 Men det gjøres i egen PR :)
// 'primitives/size/compact': TokenSetStatus.ENABLED, | ||
// }, | ||
// group: 'Size', | ||
// }, |
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.
Stored for later? :)
'primitives/modes/typography/default', | ||
'primitives/size/default', | ||
'primitives/modes/typography/primary/theme', | ||
'primitives/modes/typography/secondary/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.
Æ skjønne det itj helt, men det er nok fordi jeg ikke har vært nok borti dette helt enda :)
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.
Dette er fil for Token Studio pluginen :)
}, | ||
bold: { | ||
$type: 'fontWeights', | ||
$value: 'Medium', |
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.
Dette er for vårt theme eller bare nysgerrig hvorfor mappingen? :)
bold => medium
extra-bold => semi bold
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.
Dette har med Token Studio vs Figma å gjøre. @Febakke kan best svare på dette :)
|
||
for (const file of files) { | ||
const path_ = path.resolve(file.path); | ||
const filePath = path.resolve(file.filePath); |
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.
er file.path
det samme som dirPath
og file.filePath
med filnavn? I såfall, kan path_
være dirPath
? 😇
Merging this in to avoid further conflicts on work for theme. Will continue work on this in a new PR. |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to next, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `next` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `next`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @digdir/[email protected] ### Minor Changes - Fix design-token warning contrast color reference ([#2339](#2339)) - New create tokens script with color options support ([#2290](#2290)) ## @digdir/[email protected] ### Patch Changes - Chip: Support wrapping in group ([#2324](#2324)) ## @digdir/[email protected] ## @digdir/[email protected] Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
resolves #2269
Use theme-builder to select desired colors
Paste provided cli command in a terminal to generate desired design-tokens