Skip to content

Commit

Permalink
Merge 7601052 into 8892a4c
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann authored Sep 16, 2024
2 parents 8892a4c + 7601052 commit 30ff04e
Show file tree
Hide file tree
Showing 146 changed files with 4,256 additions and 3,181 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': minor
---

update to SDv4
27 changes: 0 additions & 27 deletions buildConfig.tsconfig.jsonc

This file was deleted.

34 changes: 17 additions & 17 deletions integration/baseline.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {PrimerStyleDictionary} from '../src/PrimerStyleDictionary'
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
31 changes: 18 additions & 13 deletions integration/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import {PrimerStyleDictionary} from '../src/PrimerStyleDictionary'
import {PrimerStyleDictionary} from '../src/PrimerStyleDictionary.js'
import fs from 'fs'

describe('PrimerStyleDictionary', () => {
describe('PrimerStyleDictionary', async () => {
const basePath = `./integration`
const buildPath = `${basePath}/build/integreation`
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 30ff04e

Please sign in to comment.