Skip to content
Open
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
53 changes: 52 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,65 @@ jobs:
needs: Lint-and-test
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: install
run: npm ci

- name: Checkout main branch
run: |
git fetch origin main
git checkout main

- name: Install and build CSS files from main branch
run: |
npm ci
npm run test:build
mkdir -p /tmp/main-output
cp -r tests/dist/* /tmp/main-output/ || true

- name: Checkout back to current branch
run: git checkout -

- name: Test build output
run: npm run test:build

- name: Upload current branch output
uses: actions/upload-artifact@v4
with:
name: build-output
path: tests/dist
retention-days: 2

- name: Compare build CSS output files
run: |
echo "Comparing CSS files between current build branch and main..."
diff -r /tmp/main-output tests/dist || true
echo "Diff complete. If no output above, files are identical."

- name: Test package output
run: npm run test:package
run: npm run test:package

- name: Compare package CSS output files
run: |
echo "Comparing CSS files between current package branch and main..."
diff -r /tmp/main-output tests/dist || true
echo "Diff complete. If no output above, files are identical."

- name: Upload current branch output
uses: actions/upload-artifact@v4
with:
name: package-output
path: tests/dist
retention-days: 2

- name: Upload main branch output
uses: actions/upload-artifact@v4
with:
name: main-branch-output
path: /tmp/main-output
retention-days: 2
14 changes: 10 additions & 4 deletions tests/build-from-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {getIsType} from 'style-dictionary-utils/filter/getIsType.js';

const StyleDictionary = new SD();

const outdir = './tests/dist/package/';

const extendSd = await StyleDictionary.extend({
source: ["./tests/tokens/**/*.json5"],
platforms: {
css: {
buildPath: "./tests/dist/css/",
buildPath: `${outdir}/css/`,
transformGroup: "css",
files: [
{
Expand All @@ -22,7 +24,7 @@ const extendSd = await StyleDictionary.extend({
},
cssPrefixed: {
prefix: "PREFIX",
buildPath: "./tests/dist/css/",
buildPath: `${outdir}/css/`,
transformGroup: "css",
files: [
{
Expand All @@ -36,8 +38,12 @@ const extendSd = await StyleDictionary.extend({
},
cssAdvanced: {
prefix: "PREFIX",
buildPath: "./tests/dist/css/",
transformGroup: "css",
buildPath: `${outdir}/css/`,
transforms: [
"name/kebab",
"color/rgbAlpha",
"border/css"
],
files: [
{
format: "css/advanced",
Expand Down
8 changes: 5 additions & 3 deletions tests/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { StyleDictionary as SD } from "../dist/index.js";

const StyleDictionary = new SD();

const outdir = './tests/dist/local/';

const addPlatforms = (outdir) => {
return {
css: {
Expand Down Expand Up @@ -91,12 +93,12 @@ const addPlatforms = (outdir) => {
}

let extendSd = await StyleDictionary.extend({
source: ["./tests/tokens/w3c/*.json5"],
platforms: addPlatforms('./tests/dist/w3c'),
source: ["./tests/tokens/css/*.json5"],
platforms: addPlatforms(outdir),
})
extendSd = await StyleDictionary.extend({
source: ["./tests/tokens/non-w3c/*.json5"],
platforms: addPlatforms('./tests/dist/non-w3c'),
platforms: addPlatforms(outdir),
})

extendSd.cleanAllPlatforms();
Expand Down