Skip to content

Commit

Permalink
fix: absolute paths in Node env (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Jun 28, 2024
1 parent 19514e6 commit 8720c42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-snakes-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Fix scenario of passing absolute paths in Node env, do not remove leading slash in absolute paths.
7 changes: 5 additions & 2 deletions lib/utils/combineJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ export default async function combineJSON(
files = files.concat(new_files);
}

// adjust for browser env glob results have leading slash
files = files.map((f) => f.replace(/^\//, ''));
if (typeof window === 'object') {
// adjust for browser env glob results have leading slash
// make sure we dont remove these in Node, that would break absolute paths!!
files = files.map((f) => f.replace(/^\//, ''));
}

for (let i = 0; i < files.length; i++) {
const filePath = files[i];
Expand Down

0 comments on commit 8720c42

Please sign in to comment.