Theme: Fix build failure of mode overrides plugin on Windows OS#73900
Theme: Fix build failure of mode overrides plugin on Windows OS#73900t-hamano wants to merge 1 commit into
Conversation
eec682c to
0adfa14
Compare
|
Flaky tests detected in 0adfa14. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20122155127
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
aduth
left a comment
There was a problem hiding this comment.
Thanks for the fix, and sorry for another breakage. I'll take some solace in that this doesn't feel like a particularly obvious bug 😅
To be clear, none of the comments are blocking. Would rather get the fix out and deal with those considerations later.
| } ), | ||
| pluginModeOverrides(), | ||
| pluginModeOverrides( { | ||
| filePath: '../../tokens/modes', |
There was a problem hiding this comment.
In this context I might suggest some sort of "dir" (similar to outDir above) or "base" naming, since "path" could be ambiguous to a file rather than a directory.
| ) }.${ mode }.json`; | ||
|
|
||
| const outputFilePath = join( | ||
| filePath, |
There was a problem hiding this comment.
We could probably avoid the extra option by using path.resolve if Terrazzo exposes the current working directory somehow (i.e. resolve the relative path from where Terrazzo will output by default vs. where the file we're looking at is).
|
This was fixed separately in #73911. |
What?
This PR fixes an issue where some files in the theme package fail to build on Windows OS.
Why?
This is where the error is occurring.
On Mac, outFile looks like this.
On Windows, it looks like this.
I'm not sure the exact reason, but passing an absolute path as the
outputFileargument may not work on certain OS. Indeed, it seems that a relative path is recommended.https://github.com/terrazzoapp/terrazzo/blob/d4b958faa59c8dd9279402521d818f62121fbf28/packages/parser/src/types.ts#L38
https://github.com/terrazzoapp/terrazzo/blob/d4b958faa59c8dd9279402521d818f62121fbf28/www/src/pages/docs/reference/plugin-api.md?plain=1#L399
How?
I converted the absolute path to a relative path and it seems to work.
Testing Instructions
packages\theme\tokens\modesnpm run --workspace @wordpress/theme build