Skip to content

Commit 9548f0f

Browse files
committed
fix(tokens): support style-dictionary build in windows env
1 parent a1e9fa9 commit 9548f0f

File tree

8 files changed

+27
-145
lines changed

8 files changed

+27
-145
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
README.md merge=ours
1+
* text=auto eol=lf
2+
README.md merge=ours

.github/workflows/build.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ on:
2424
default: "18"
2525
experimental:
2626
required: false
27-
default: false
27+
default: "false"
2828
ref:
2929
description: "The branch or tag to checkout"
3030
required: false
@@ -148,17 +148,12 @@ jobs:
148148
else
149149
echo "Changes detected"
150150
git status
151+
git add .
152+
git diff --staged > changes.diff
151153
exit 1
152154
fi
153155
154-
# If there are changes, capture the changes and upload them as an artifact
155-
- name: Capture changes
156-
if: ${{ failure() }}
157-
id: capture-changes
158-
run: |
159-
git diff
160-
git diff > changes.diff
161-
156+
# If there are changes, capture and upload them as an artifact
162157
- name: Upload changes
163158
if: ${{ failure() }}
164159
uses: actions/upload-artifact@v4

.github/workflows/development.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
# -------------------------------------------------------------
4747
# Validate build for various environments
4848
# -------------------------------------------------------------
49+
# todo: should we limit this to run before merging?
4950
verify_builds:
5051
name: Verify
5152
# Check that the PR is not in draft mode (or if it is, that it has the run_ci label to force a build)
@@ -61,7 +62,7 @@ jobs:
6162
experimental:
6263
- false
6364
include:
64-
- node-version: 20
65+
- node-version: 21
6566
experimental: true
6667
- system: windows-latest
6768
experimental: true

tasks/mod-extractor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async function main(inputs) {
9292

9393
/* -- Markdown Output -- */
9494
/* Output as a markdown table in the metadata folder for site rendering */
95-
let destPath = `${dir}/metadata`;
95+
let destPath = path.join(dir, "metadata");
9696

9797
// If the metadata folder doesn't exist, create it
9898
if (!existsSync(destPath)) mkdirSync(destPath);
@@ -108,7 +108,7 @@ async function main(inputs) {
108108

109109
// Write the results to a markdown file in the metadata folder
110110
promises.push(
111-
writeFile(`${destPath}/mods.md`, finalResult, { encoding: "utf-8" }).then(() => {
111+
writeFile(path.join(destPath, "mods.md"), finalResult, { encoding: "utf-8" }).then(() => {
112112
console.log(`${`✓`.green} ${"metadata/mods.md".yellow} written`);
113113
}).catch((err) => {
114114
if (!err) return;
@@ -118,7 +118,7 @@ async function main(inputs) {
118118
);
119119

120120
/* -- JSON Output -- */
121-
destPath = `${dir}/dist`;
121+
destPath = path.join(dir, "dist");
122122
// If the dist folder doesn't exist yet, create it
123123
if (!existsSync(destPath)) mkdirSync(destPath);
124124

@@ -129,7 +129,7 @@ async function main(inputs) {
129129

130130
// Write the JSON output to the dist folder
131131
promises.push(
132-
writeFile(`${destPath}/mods.json`, finalResult, { encoding: "utf-8" }).then(() => {
132+
writeFile(path.join(destPath, "mods.json"), finalResult, { encoding: "utf-8" }).then(() => {
133133
console.log(`${`✓`.green} ${"dist/mods.json".yellow} written`);
134134
}).catch((err) => {
135135
if (!err) return;

tokens/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"main": "dist/index.css",
1717
"devDependencies": {
1818
"@adobe/spectrum-tokens": "12.23.3",
19-
"@nxkit/style-dictionary": "^4.0.0",
2019
"postcss": "^8.4.33",
2120
"postcss-cli": "^11.0.0",
2221
"postcss-combine-duplicated-selectors": "^10.0.3",
@@ -27,7 +26,7 @@
2726
"postcss-rgb-mapping": "^1.1.0",
2827
"postcss-sorting": "^8.0.2",
2928
"prettier": "^2.8.8",
30-
"style-dictionary": "^3.9.1",
29+
"style-dictionary": "^3.9.2",
3130
"style-dictionary-sets": "^2.3.0"
3231
},
3332
"publishConfig": {

tokens/project.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,16 @@
4646
},
4747
"style-dictionary": {
4848
"dependsOn": ["clean"],
49-
"executor": "@nxkit/style-dictionary:build",
49+
"executor": "nx:run-commands",
5050
"inputs": [
5151
"{projectRoot}/postcss.config.js",
5252
"{projectRoot}/style-dictionary.config.js",
5353
"{projectRoot}/utilities/style-dictionary.utils.js"
5454
],
5555
"options": {
56-
"deleteOutputPath": false,
57-
"outputPath": "./tokens",
58-
"platform": "CSS",
59-
"styleDictionaryConfig": "./tokens/style-dictionary.config.js",
60-
"tsConfig": "./tsconfig.json"
56+
"commands": [
57+
"style-dictionary build --config {projectRoot}/style-dictionary.config.js --platform CSS"
58+
]
6159
},
6260
"outputs": [
6361
"{projectRoot}/dist/global-vars.css",

tokens/style-dictionary.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
const path = require("path");
1515

16-
const generateFileConfig = require("./utilities/style-dictionary.utils.js");
16+
const generateFileConfig = require(path.join(__dirname, "utilities/style-dictionary.utils.js"));
1717

1818
const StyleDictionary = require("style-dictionary");
1919
const CSSSetsFormatter = require("style-dictionary-sets").CSSSetsFormatter;
@@ -38,10 +38,10 @@ const tokensDir = path.dirname(tokensPath);
3838
const setNames = ["desktop", "mobile", "light", "dark", "darkest"];
3939

4040
module.exports = {
41-
source: [`${tokensDir}/src/*.json`],
41+
source: [path.join(tokensDir, "src/*.json")],
4242
platforms: {
4343
CSS: {
44-
buildPath: "dist/css/",
44+
buildPath: path.join(__dirname, "dist/css/"),
4545
transforms: [
4646
AttributeSetsTransform.name,
4747
NameKebabTransfom.name,

0 commit comments

Comments
 (0)