Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: 🚀 Release
on:
push:
branches:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 🧪 Test

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Enable debug logging
run: echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "pnpm"

- name: Install Dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Run GitHub Action
uses: ./
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
dist/
dist/
lib/
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: 'DS Pro - Transform Design Tokens'
description: 'Transform design tokens using Style Dictionary'
inputs:
tokens-path:
description: 'Path to the tokens.json file'
description: 'Path to the tokens.json file. Defaults to repo root.'
required: true
default: ''
default: './tokens'
output-path:
description: 'Path to output the transformed tokens'
required: true
default: 'dist'
default: './lib'
runs:
using: 'node20'
main: 'dist/index.js'
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "GitHub Action to transform design tokens using Style Dictionary",
"main": "dist/index.cjs",
"scripts": {
"start": "ncc run src/index.ts",
"build": "tsc && ncc build src/index.ts --minify --source-map"
},
"keywords": [
Expand Down
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as core from "@actions/core";
import StyleDictionary from "style-dictionary";
import * as nodefs from "fs";
import * as path from "path";

async function run(): Promise<void> {
try {
const tokensPath = core.getInput("tokens-path");
const outputPath = core.getInput("output-path");
const tokensPath = core.getInput("tokens-path") || "./tokens";
const outputPath = core.getInput("output-path") || "./lib";

core.debug(`Running transformation on ${tokensPath}`);

Expand All @@ -24,12 +26,14 @@ async function run(): Promise<void> {
},
});

styleDictionary.log.verbosity = "verbose";

core.debug("Initializing Style Dictionary");
await styleDictionary.hasInitialized;

core.debug("Cleaning platforms");
await styleDictionary.cleanAllPlatforms();
core.debug("Building platforms");
core.debug(`Building platforms to ${outputPath}`);
await styleDictionary.buildAllPlatforms();

core.debug("Done");
Expand Down
File renamed without changes.