Skip to content

Commit

Permalink
use dist instead of tokens-next-private (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann authored Apr 8, 2024
1 parent 59a906a commit 93e8ac1
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 22 deletions.
7 changes: 3 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
tokens-v2-private/
tokens-next-private/
dist/
.cache/
docs/public/
# next line needed for <Note> reference
docs/content/colors.mdx
.changeset/*.md
coverage/
storybook-static

# Ignore all files relating to v1 tokens
# TODO: Remove after v1 tokens have been removed
data/
dist/
tokens-next-private/
tokens-v2-private/
2 changes: 1 addition & 1 deletion docs/storybook/stories/Color/DataVis/Charts.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import colorTokens from '../../../../../tokens-next-private/docs/functional/themes/light.json'
import colorTokens from '../../../../../dist/docs/functional/themes/light.json'
import {ColorTokenSwatch} from '../../StorybookComponents/ColorTokenSwatch/ColorTokenSwatch'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../../StorybookComponents/InlineCode/InlineCode'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import colorTokens from '../../../../../tokens-next-private/docs/functional/themes/light.json'
import colorTokens from '../../../../../dist/docs/functional/themes/light.json'
import {ColorTokenSwatch} from '../../StorybookComponents/ColorTokenSwatch/ColorTokenSwatch'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../../StorybookComponents/InlineCode/InlineCode'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import colorTokens from '../../../../../tokens-next-private/docs/functional/themes/light.json'
import colorTokens from '../../../../../dist/docs/functional/themes/light.json'
import {ColorTokenSwatch} from '../../StorybookComponents/ColorTokenSwatch/ColorTokenSwatch'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../../StorybookComponents/InlineCode/InlineCode'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import colorTokens from '../../../../../tokens-next-private/docs/functional/themes/light.json'
import colorTokens from '../../../../../dist/docs/functional/themes/light.json'
import {ColorTokenSwatch} from '../../StorybookComponents/ColorTokenSwatch/ColorTokenSwatch'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../../StorybookComponents/InlineCode/InlineCode'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import cssShadowVars from './DeprecatedShadowTokensMap.json'
// eslint-disable-next-line import/extensions
import noChangeCssVars from './NoChangeTokensMap.json'
// eslint-disable-next-line import/extensions
import fallbackVars from '../../../../../tokens-next-private/fallbacks/color-fallbacks.json'
import fallbackVars from '../../../../../dist/fallbacks/color-fallbacks.json'
import {DataTable, Table} from '@primer/react/drafts'

export default {
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Size/Border.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/size/border.json'
import sizeTokens from '../../../../dist/docs/functional/size/border.json'
import {SizeTokenSwatch} from '../StorybookComponents/SizeTokenSwatch/SizeTokenSwatch'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Size/Breakpoints.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/size/breakpoints.json'
import sizeTokens from '../../../../dist/docs/functional/size/breakpoints.json'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
import {getTokensByName} from '../utilities/getTokensByName'
Expand Down
6 changes: 3 additions & 3 deletions docs/storybook/stories/Size/Control.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/size/size.json'
import sizeTokensFine from '../../../../tokens-next-private/docs/functional/size/size-fine.json'
import sizeTokensCoarse from '../../../../tokens-next-private/docs/functional/size/size-coarse.json'
import sizeTokens from '../../../../dist/docs/functional/size/size.json'
import sizeTokensFine from '../../../../dist/docs/functional/size/size-fine.json'
import sizeTokensCoarse from '../../../../dist/docs/functional/size/size-coarse.json'
import {ControlSizeDemo} from '../StorybookComponents/ControlSizeDemo/ControlSizeDemo'
import {ControlStackDemo} from '../StorybookComponents/ControlStackDemo/ControlStackDemo'
import {TouchTargetDemo} from '../StorybookComponents/TouchTargetDemo/TouchTargetDemo'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Size/Overlay.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/size/size.json'
import sizeTokens from '../../../../dist/docs/functional/size/size.json'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
import {getTokensByName} from '../utilities/getTokensByName'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Size/Space.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/base/size/size.json'
import sizeTokens from '../../../../dist/docs/base/size/size.json'
import {SizeTokenSwatch} from '../StorybookComponents/SizeTokenSwatch/SizeTokenSwatch'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Size/Stack.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/size/size.json'
import sizeTokens from '../../../../dist/docs/functional/size/size.json'
import {StackDemo} from '../StorybookComponents/StackDemo/StackDemo'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Size/ViewportRange.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/size/viewport.json'
import sizeTokens from '../../../../dist/docs/functional/size/viewport.json'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
import {getTokensByName} from '../utilities/getTokensByName'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Typography/Base.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/base/typography/typography.json'
import sizeTokens from '../../../../dist/docs/base/typography/typography.json'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
import {TypographyDemo} from '../StorybookComponents/TypographyDemo/TypographyDemo'
Expand Down
2 changes: 1 addition & 1 deletion docs/storybook/stories/Typography/Functional.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import sizeTokens from '../../../../tokens-next-private/docs/functional/typography/typography.json'
import sizeTokens from '../../../../dist/docs/functional/typography/typography.json'
import {DataTable, Table} from '@primer/react/drafts'
import {InlineCode} from '../StorybookComponents/InlineCode/InlineCode'
import {TypographyDemo} from '../StorybookComponents/TypographyDemo/TypographyDemo'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
// eslint-disable-next-line import/extensions
import colorData from '../../../../tokens-next-private/docs/functional/themes/light.json'
import colorData from '../../../../dist/docs/functional/themes/light.json'
import {ColorTokenSwatch} from '../StorybookComponents/ColorTokenSwatch/ColorTokenSwatch'

const extractNameAndValue = Object.entries(colorData)
Expand Down
2 changes: 1 addition & 1 deletion e2e/storybook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {type Page, test, expect} from '@playwright/test'
// eslint-disable-next-line import/extensions, import/no-unresolved
import data from '../docs/storybook/storybook-static/stories.json'
// eslint-disable-next-line import/extensions, import/no-unresolved
import colorData from '../tokens-next-private/docs/functional/themes/light.json'
import colorData from '../dist/docs/functional/themes/light.json'

const extractNameAndValue = Object.entries(colorData)
.map(([_key, details]) => ({
Expand Down
7 changes: 7 additions & 0 deletions scripts/buildFallbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import fs from 'fs'

const storybookFallbacks = Object.entries(colorFallbacks).map(([key, value]) => [key, value])

fs.mkdirSync('dist/fallbacks', {recursive: true})
fs.writeFileSync(
'dist/fallbacks/color-fallbacks.json',
JSON.stringify(Object.fromEntries(storybookFallbacks), null, 2),
'utf8',
)
// build in tokens-next-private until it can be removed
fs.mkdirSync('tokens-next-private/fallbacks', {recursive: true})
fs.writeFileSync(
'tokens-next-private/fallbacks/color-fallbacks.json',
Expand Down

0 comments on commit 93e8ac1

Please sign in to comment.