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

Clean sdv4 #1055

Merged
merged 3 commits into from
Sep 19, 2024
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
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