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

Renomeia a pasta build/tokens para built-tokens #22

Merged
merged 2 commits into from
Aug 24, 2023
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
node_modules/

#Build folder
build/
built-tokens/

# TypeScript cache
*.tsbuildinfo
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build
built-tokens
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Atualmente usamos:

## Como rodar

Primeiro, garanta que os tokens foram gerados corretamente, rodando o script: `yarn build-tokens` - _Você pode conferir os tokens gerados na pasta `/build/tokens`_.
Primeiro, garanta que os tokens foram gerados corretamente, rodando o script: `yarn build-tokens` - _Você pode conferir os tokens gerados na pasta `/built-tokens`_.

Depois, para inicializar o storybook, rode o script: `yarn storybook`.

Expand Down Expand Up @@ -87,7 +87,7 @@ A **resposta rápida** é: rode o script

`yarn build-tokens`

E os tokens serão construídos na pasta `/build/tokens`.
E os tokens serão construídos na pasta `/built-tokens`.

Usamos um script customizado, para garantir que exportamos um arquivo correto para documentar os tokens no storybook. Detalharemos esse assunto um pouco mais à frente.

Expand All @@ -107,7 +107,7 @@ As platforms são definidas no formato:
"platforms": {
"scss": {
"transformGroup": "scss",
"buildPath": "build/tokens/scss/",
"buildPath": "built-tokens/scss/",
"files": [
{
"destination": "_variables.scss",
Expand All @@ -125,7 +125,7 @@ Já no _script de build_ temos definidos um [custom-transform](https://amzn.gith
Como já comentado anteriormente, criamos um processo um pouco mais automatizado para criar os tokens e documentá-los no storybook.

Nesse processo, usamos um addon para o storybook - [storybook-design-token](https://github.com/UX-and-I/storybook-design-token) - que consegue documentar e gerar previews dos tokens.
Esse addon precisa de um arquivo, em um formato específico, chamado de [presenters](https://github.com/UX-and-I/storybook-design-token/tree/v3#available-presenters) pelo addon, que é criado na construição dos tokens - através do style-dictionary - encontrado na pasta `/build/tokens/scss/_variables_with_headers.scss`. Esse formato é definido no _script de build_, em `DESIGN_TOKEN_CATEGORIES_BY_PREFIX`.
Esse addon precisa de um arquivo, em um formato específico, chamado de [presenters](https://github.com/UX-and-I/storybook-design-token/tree/v3#available-presenters) pelo addon, que é criado na construição dos tokens - através do style-dictionary - encontrado na pasta `/built-tokens/scss/_variables_with_headers.scss`. Esse formato é definido no _script de build_, em `DESIGN_TOKEN_CATEGORIES_BY_PREFIX`.

Então, para **documentar um token**, após terminar o processo descrito anteriormente, vale conferir se o _script de build_ já tem a categoria necessária - se não, criá-la de acordo com os [presenters](https://github.com/UX-and-I/storybook-design-token/tree/v3#available-presenters) suportados pelo addon.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"node": ">=16.17.1"
},
"files": [
"build/**",
"built-tokens/**",
"helpers/**",
"token-presets/**",
"tokens.ts"
Expand Down
2 changes: 1 addition & 1 deletion token-presets/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DSA_LINE_HEIGHT_S,
DSA_LINE_HEIGHT_XL,
DSA_LINE_HEIGHT_XS,
} from '../build/tokens/ts/tokens';
} from '../built-tokens/js/tokens';

/* Headings */
export const DSA_BASIC_HEADING_H1_STYLE = {
Expand Down
2 changes: 1 addition & 1 deletion token-presets/ludic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
DSA_LINE_HEIGHT_S,
DSA_LINE_HEIGHT_XL,
DSA_LINE_HEIGHT_XS,
} from '../build/tokens/ts/tokens';
} from '../built-tokens/js/tokens';

/* Headings */
export const DSA_LUDIC_HEADING_H1_STYLE = {
Expand Down
2 changes: 1 addition & 1 deletion token-presets/reading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
DSA_LETTER_SPACING_NORMAL,
DSA_LINE_HEIGHT_M,
DSA_LINE_HEIGHT_S,
} from '../build/tokens/ts/tokens';
} from '../built-tokens/js/tokens';

/* Body (large) */
export const DSA_READING_BODY_L_NORMAL_STYLE = {
Expand Down
2 changes: 1 addition & 1 deletion tokens.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './build/tokens/ts/tokens';
export * from './built-tokens/js/tokens';
export * from './helpers/webOnlyHelpers';
4 changes: 2 additions & 2 deletions tokens/config/style-dictionary-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"platforms": {
"scss": {
"transformGroup": "custom/scss",
"buildPath": "build/tokens/scss/",
"buildPath": "built-tokens/scss/",
"prefix": "dsa",
"files": [
{
Expand All @@ -18,7 +18,7 @@
},
"ts": {
"transformGroup": "custom/js",
"buildPath": "build/tokens/ts/",
"buildPath": "built-tokens/js/",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Como após o processo de build do TS (num próximo commit) essa pasta vai ter arquivos JS optei por chamar ela mais genericamente de js em vez de ts.

"prefix": "dsa",
"files": [
{
Expand Down