-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2232f12
commit e12b1d2
Showing
15 changed files
with
173 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Testing custom transforms, formats, etc. for Style Dictionary | ||
|
||
on: | ||
pull_request: | ||
branches-ignore: | ||
- 'changeset-release/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
changes: | ||
uses: ./.github/workflows/hasChanged.yml | ||
|
||
build: | ||
needs: changes | ||
if: needs.changes.outputs.buildConfig == 'true' || github.event_name == 'workflow_dispatch' | ||
name: Test if custom transforms, formats, etc. are working | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm i --no-audit --no-fund --ignore-scripts | ||
|
||
- name: Run test | ||
run: | | ||
npm run test:integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ coverage/ | |
docs/public/ | ||
color-contrast-check.json | ||
blob-report | ||
integration/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {PrimerStyleDictionary} from '../src/PrimerStyleDictionary' | ||
import fs from 'fs' | ||
|
||
describe('PrimerStyleDictionary', () => { | ||
const basePath = `./integration` | ||
const extendedSD = PrimerStyleDictionary.extend({ | ||
source: [`${basePath}/tokens/**/*.json5`], | ||
platforms: { | ||
css: { | ||
prefix: 'PREFIX', | ||
transformGroup: 'css', | ||
buildPath: `${basePath}/build/css/`, | ||
files: [ | ||
{ | ||
options: { | ||
showFileHeader: false, | ||
}, | ||
destination: 'variables.css', | ||
format: 'css/variables', | ||
}, | ||
], | ||
}, | ||
advancedCss: { | ||
prefix: 'PREFIX', | ||
transformGroup: 'css', | ||
buildPath: `${basePath}/build/css/`, | ||
files: [ | ||
{ | ||
options: { | ||
showFileHeader: false, | ||
}, | ||
destination: 'advanced.css', | ||
format: 'css/advanced', | ||
}, | ||
], | ||
}, | ||
}, | ||
}) | ||
|
||
extendedSD.cleanAllPlatforms() | ||
extendedSD.buildAllPlatforms() | ||
|
||
it('it should transform with css/variables format', () => { | ||
const output = fs.readFileSync(`${basePath}/build/css/variables.css`, 'utf8') | ||
const expectedOutput = `:root { | ||
--prefix-base-color-blue-500: #2C29FF; /* The primary color for interactive elements. */ | ||
--prefix-fg-color-link: #2C29FF; | ||
} | ||
` | ||
expect(output).toBe(expectedOutput) | ||
}) | ||
|
||
it('it should transform with css/advanced format', () => { | ||
const output = fs.readFileSync(`${basePath}/build/css/advanced.css`, 'utf8') | ||
const expectedOutput = `:root { | ||
--prefix-base-color-blue-500: #2c29ff; /* The primary color for interactive elements. */ | ||
--prefix-fg-color-link: #2c29ff; | ||
} | ||
` | ||
expect(output).toBe(expectedOutput) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
base: { | ||
color: { | ||
blue: { | ||
"500": { | ||
"$value": '#2C29FF', | ||
"$type": 'color', | ||
"$description": 'The primary color for interactive elements.', | ||
}, | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
fgColor: { | ||
link: { | ||
$value: '{base.color.blue.500}', | ||
$type: 'color', | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:root { | ||
--prefix-base-color-blue-500: #2c29ff; /* The primary color for interactive elements. */ | ||
--prefix-fg-color-link: #2c29ff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters