Skip to content

Commit

Permalink
Clean sdv4 (#1055)
Browse files Browse the repository at this point in the history
* update to sdv4 with async

* fix esbuild

* trying to fix esbuild
  • Loading branch information
lukasoppermann authored Sep 19, 2024
1 parent 9c3b2c8 commit 7806a4c
Show file tree
Hide file tree
Showing 128 changed files with 1,816 additions and 1,279 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-stingrays-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/primitives': major
---

update to SDv4
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed blob-report/report.zip
Binary file not shown.
32 changes: 16 additions & 16 deletions integration/baseline.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {PrimerStyleDictionary} from '../src/PrimerStyleDictionary.js'
import fs from 'fs'

describe('PrimerStyleDictionary', () => {
describe('PrimerStyleDictionary', async () => {
const basePath = `./integration`
const buildPath = `${basePath}/build/baseline`

beforeAll(() => {
const extendedSD = PrimerStyleDictionary.extend({
beforeAll(async () => {
const extendedSD = await PrimerStyleDictionary.extend({
source: [`${basePath}/tokens/**/*.json5`],
platforms: {
css: {
Expand Down Expand Up @@ -39,7 +39,7 @@ describe('PrimerStyleDictionary', () => {
jsonFlat: {
prefix: 'PREFIX',
buildPath: `${buildPath}/json/`,
transforms: ['name/cti/pascal'],
transforms: ['name/pathToPascalCase'],
files: [
{
options: {
Expand All @@ -53,15 +53,15 @@ describe('PrimerStyleDictionary', () => {
},
})

extendedSD.cleanAllPlatforms()
extendedSD.buildAllPlatforms()
await extendedSD.cleanAllPlatforms()
await extendedSD.buildAllPlatforms()
})

it('runs baseline css/variables format', () => {
const output = fs.readFileSync(`${buildPath}/css/variables.css`, 'utf8')
const expectedOutput = `:root {
--prefix-base-color-aqua-blue-500: #2C29FF; /* The primary color for interactive elements. */
--prefix-fg-color-link-rest-01: #2C29FF;
--prefix-base-color-aqua-blue-500: #2c29ff; /* The primary color for interactive elements. */
--prefix-fg-color-link-rest-01: #2c29ff;
}
`
expect(output).toBe(expectedOutput)
Expand All @@ -74,15 +74,15 @@ describe('PrimerStyleDictionary', () => {
"color": {
"aquaBlue": {
"500": {
"value": "#2C29FF",
"$value": "#2C29FF",
"$type": "color",
"comment": "The primary color for interactive elements.",
"$description": "The primary color for interactive elements.",
"filePath": "integration/tokens/base.json5",
"isSource": true,
"original": {
"value": "#2C29FF",
"$value": "#2C29FF",
"$type": "color",
"comment": "The primary color for interactive elements."
"$description": "The primary color for interactive elements."
},
"name": "500",
"attributes": {},
Expand All @@ -98,12 +98,12 @@ describe('PrimerStyleDictionary', () => {
},
"fgColor": {
"link-rest-01": {
"value": "#2C29FF",
"$value": "#2C29FF",
"$type": "color",
"filePath": "integration/tokens/functional.json5",
"isSource": true,
"original": {
"value": "{base.color.aquaBlue.500}",
"$value": "{base.color.aquaBlue.500}",
"$type": "color"
},
"name": "link-rest-01",
Expand All @@ -122,8 +122,8 @@ describe('PrimerStyleDictionary', () => {
it('runs baseline flat json format', () => {
const output = fs.readFileSync(`${buildPath}/json/flat.json`, 'utf8')
const expectedOutput = `{
"PrefixBaseColorAquaBlue500": "#2C29FF",
"PrefixFgColorLinkRest01": "#2C29FF"
"PREFIXBaseColorAquaBlue500": "#2C29FF",
"PREFIXFgColorLinkRest01": "#2C29FF"
}
`
expect(output).toBe(expectedOutput)
Expand Down
27 changes: 16 additions & 11 deletions integration/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import {PrimerStyleDictionary} from '../src/PrimerStyleDictionary.js'
import fs from 'fs'

describe('PrimerStyleDictionary', () => {
describe('PrimerStyleDictionary', async () => {
const basePath = `./integration`
const buildPath = `${basePath}/build/integration`

beforeAll(() => {
const extendedSD = PrimerStyleDictionary.extend({
beforeAll(async () => {
const extendedSD = await PrimerStyleDictionary.extend({
source: [`${basePath}/tokens/**/*.json5`],
platforms: {
advancedCss: {
prefix: 'PREFIX',
usesDtcg: true,
transforms: [
'name/pathToKebabCase',
'color/hex',
Expand All @@ -36,6 +37,7 @@ describe('PrimerStyleDictionary', () => {
},
commonJs: {
prefix: 'PREFIX',
usesDtcg: true,
transforms: [
'color/hex',
'color/hexMix',
Expand All @@ -59,6 +61,7 @@ describe('PrimerStyleDictionary', () => {
},
javascriptEsm: {
prefix: 'PREFIX',
usesDtcg: true,
buildPath: `${buildPath}/js/`,
transforms: [
'color/hex',
Expand All @@ -82,6 +85,7 @@ describe('PrimerStyleDictionary', () => {
},
jsonFigma: {
prefix: 'PREFIX',
usesDtcg: true,
buildPath: `${buildPath}/json/`,
transforms: [
'color/rgbaFloat',
Expand All @@ -104,6 +108,7 @@ describe('PrimerStyleDictionary', () => {
},
jsonNestedPrefixed: {
prefix: 'PREFIX',
usesDtcg: true,
buildPath: `${buildPath}/json/`,
transforms: [
'color/hex',
Expand Down Expand Up @@ -150,8 +155,8 @@ describe('PrimerStyleDictionary', () => {
},
})

extendedSD.cleanAllPlatforms()
extendedSD.buildAllPlatforms()
await extendedSD.cleanAllPlatforms()
await extendedSD.buildAllPlatforms()
})

it('runs css/advanced format', () => {
Expand Down Expand Up @@ -208,30 +213,30 @@ describe('PrimerStyleDictionary', () => {
const output = fs.readFileSync(`${buildPath}/json/figma.json`, 'utf8')
const expectedOutput = `[
{
"name": "PREFIX/base/color/aquaBlue/500",
"name": "PREFIX/fgColor/link-rest-01",
"value": {
"r": 0.17254901960784313,
"g": 0.1607843137254902,
"b": 1,
"a": 1
},
"type": "COLOR",
"description": "The primary color for interactive elements.",
"refId": "PREFIX/base/color/aquaBlue/500",
"refId": "PREFIX/fgColor/link-rest-01",
"reference": "PREFIX/base/color/aquaBlue/500",
"mode": "default",
"scopes": ["ALL_SCOPES"]
},
{
"name": "PREFIX/fgColor/link-rest-01",
"name": "PREFIX/base/color/aquaBlue/500",
"value": {
"r": 0.17254901960784313,
"g": 0.1607843137254902,
"b": 1,
"a": 1
},
"type": "COLOR",
"refId": "PREFIX/fgColor/link-rest-01",
"reference": "PREFIX/base/color/aquaBlue/500",
"description": "The primary color for interactive elements.",
"refId": "PREFIX/base/color/aquaBlue/500",
"mode": "default",
"scopes": ["ALL_SCOPES"]
}
Expand Down
Loading

0 comments on commit 7806a4c

Please sign in to comment.