Repository navigation
fix(build-scripts): make the docs edited-dates step work on Windows - #17455
Conversation
|
|
Thanks for the contribution! Initial automated review looks good. Verdict: Looks good for a final review by the team. Fixes the Checked: security (no user input reaches the shell commands), correctness (empty-string entries are filtered by Triggered by: new PR opened |
Deploying with Â
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| â
Deployment successful! View logs |
medusa-docs-api-reference | 4bfce92 | Commit Preview URL Branch Preview URL |
Oct 22 2026, 04:58 PM |
Deploying with Â
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| â Deployment failed View logs |
medusa-docs-ui | 4bfce92 | Oct 22 2026, 04:53 PM |
Deploying with Â
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| â
Deployment successful! View logs |
medusa-docs-resources | 4bfce92 | Commit Preview URL Branch Preview URL |
Oct 22 2026, 05:01 PM |
Deploying with Â
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| â
Deployment successful! View logs |
medusa-docs-user-guide | 4bfce92 | Commit Preview URL Branch Preview URL |
Oct 22 2026, 04:57 PM |
Deploying with Â
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| â
Deployment successful! View logs |
medusa-docs-cloud | 4bfce92 | Commit Preview URL Branch Preview URL |
Oct 22 2026, 05:01 PM |
Deploying with Â
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| â
Deployment successful! View logs |
medusa-docs-book | 4bfce92 | Commit Preview URL Branch Preview URL |
Oct 22 2026, 05:02 PM |
Summary
What â Makes the edited-dates step of the docs
yarn prepscript work on Windows by removing a POSIX-only shell command and normalizing the project path before comparing it with git's output.Why â
generateEditedDatesran{ git diff --name-only ; git diff --name-only --staged ; } | sort | uniqthroughchild_process.exec. On Windows,execusescmd.exe, which can't parse{ ...; }grouping, soprepcrashed for Windows contributors. Even with the command fixed,monorepoRelativePathcame from string replacement on an OS path. On Windows it kept backslashes (and a leading\), so it never matched git's forward-slash paths, and changed pages would have been silently skipped.How â In
www/packages/build-scripts/src/generate-edited-dates.ts:monorepoRelativePathis nowpath.relative(rootPath, projectBasePath)with separators normalized to/.getChangedFilesrunsgit diff --name-onlyandgit diff --name-only --stagedas separate commands, then merges and dedupes the output with aSetinstead ofsort | uniq.tsconfig.jsonnow excludes__tests__from the build, the same waydocs-utilsdoes, so tsc doesn't compile the test.Testing â Added
www/packages/build-scripts/src/__tests__/generate-edited-dates.test.ts. It mocksexecto behave like a shell that only accepts plain commands, mocksfs, and runs under bothpath.posixandpath.win32. It checks that unstaged and staged pages of the project are collected and deduped, and that pages of other projects are left out.'{ git diff --name-only ; git diff --name-only --staged ; } | sort | uniq' is not recognized as a command.[]instead of the three changed pages.Checklist
Additional Context
build-scriptsis a privatewww/package and isn't published.build-scriptshas notestscript, and thewwwworkspace dependencies weren't installed in this environment. I ran the test with the rootvitestbinary and a minimal throwaway config (environment: "node", inline esbuild tsconfig), becausewww/vitest.config.mtsneeds plugins that aren't installed.getAllProjectFilesand the untracked-files branch build keys withpath.relative, which gives backslash-separated keys. Also,file.startsWith(monorepoRelativePath)would match a sibling project whose name starts with the same prefix (e.g.www/apps/book-foo).Fixes #17249