Repository navigation
fix: make build script work on Windows - #170
hrithik577 wants to merge 3 commits into
Conversation
|
Thanks for the fix, @hrithik577. Replacing the shell Looks good to me. One small suggestion: please make sure the script resolves Also worth confirming CI passes on Linux as well, since the Windows run is |
|
Hi @Oaklaan, Thanks for the suggestions! I have updated scripts/copy-404.js: Project-root relative paths: Paths are now resolved relative to import.meta.url using path.resolve(__dirname, '..', 'dist') (matching scripts/fetch-metadata.js), making execution independent of the working directory. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the shell-dependent copy step has been replaced with a cross-platform Node.js utility that includes validation and error handling.
No open issues 🎉
What changed in this PR
This pull request makes the production build cross-platform by replacing the shell-dependent cp command with a Node.js script that copies Vite’s generated index.html to dist/404.html.
Changes:
- Added
scripts/copy-404.jsusing platform-independent Node.js filesystem APIs. - Updated the production build script to invoke the new copy utility.
- Added validation and error handling for missing files or failed copies.
| File | Description |
|---|---|
scripts/copy-404.js |
Validates and copies dist/index.html to dist/404.html using Node.js APIs. |
package.json |
Replaces the shell-specific cp command in the production build pipeline. |
Review effort: Lite
PratikMane0112
left a comment
There was a problem hiding this comment.
@hrithik577 WDYT on these points ?
|
@PratikMane0112 and @hrithik577. I’d like to help with some follow-ups that build on #170 and don’t overlap with the review comments above. I’m happy to adjust the scope, since I don’t know what’s already covered: Windows CI check. If there isn’t one already, add a windows-latest job running npm ci && npm run build, so this kind of regression gets caught automatically Test for the copy logic. A test in the repo’s existing test setup covering the success case and the missing index.html case Docs. A short note in the README or CONTRIBUTING file about building on Windows. |
|
Hi @PratikMane0112, Thanks again for your suggestions! I've addressed all three points in the latest commit (b112dbe):
I've also verified the production build, lint, Prettier, and missing-file error handling. The full test suite encountered two timeout failures in an integration test under parallel execution on Windows; that test file passed when run independently. I've pushed the changes to the existing PR. Thanks for your review! |
@Oaklaan you can create separate issues for this & feel free to contribute as well, if interested. Lets keep the scope of this pr upto adding a node script. |
PratikMane0112
left a comment
There was a problem hiding this comment.
@hrithik577 Thanks for pointing out issue & providing a fix. LGTM
|
Hi @PratikMane0112, Thanks for reviewing and approving PR #170. Just checking whether anything else is needed from my side before it can be merged. All checks are passing, and I'm happy to make any further changes if required. Thanks! |
Summary
cpcommand in the build script with a small Node.js script usingnode:fs/promisesandcopyFile.dist/404.htmlwork cross-platform in Windows shells while retaining existing build behavior.Fixes #169
Validation
npm run build).dist/index.htmlanddist/404.htmlare generated and verified identical in content.npm run lint).npx prettier --check scripts/copy-404.js package.json).npm test: 33 test files, 325 tests passed).