Skip to content

Fix Windows (WSL) build#58

Open
chrisglein wants to merge 1 commit into
brewingcode:masterfrom
chrisglein:fixWindows
Open

Fix Windows (WSL) build#58
chrisglein wants to merge 1 commit into
brewingcode:masterfrom
chrisglein:fixWindows

Conversation

@chrisglein

Copy link
Copy Markdown
Collaborator

Changes made by agents to get local WSL testing and hosting working. Which for me has never worked in this repo ever, as documented in #42, and will enable me to iterate on the site more directly and more confidently.

Changes

  • Rewrite songs-to-json (python) as songs-to-json.js (node) to drop the python/shebang dependency
  • Replace shell 'cp' in build with a cross-platform node fs.cpSync call
  • Quote nodemon -e pattern with double quotes for cmd/PowerShell
  • Add patch-package + postinstall and patches/ for pug-pack coffeescript compilation

Fixes #42

More detailed agent description below. My main 🤨 to the whole thing was it's struggles with Python, which I very much have access to in other environments so I don't know what's up with that. But moving it to JS seems... 🤷‍♂️ fine. I was just happy to finally be able to host the site.


Fix Windows build

Why

The build didn't run on Windows. Three hard blockers:

  • ./songs-to-json is a Python script (#!/usr/bin/env python3) — requires Python and a POSIX shell; cmd/PowerShell can't exec it.
  • cp Songbook.pdf dist uses the Unix cp, which doesn't exist on Windows.
  • nodemon -e '*' uses single quotes, which Windows cmd treats literally (breaks the watch glob).

Plus pug-pack failed to compile the :coffeescript blocks in index.pug because it relied on pug hoisting jstransformer-coffeescript to the top level, which didn't resolve here.

What changed

  • songs-to-json → songs-to-json.js: same logic in Node (already a build dependency). Reads UTF-8 with a latin-1 fallback like before, and now normalizes CRLF→LF so output is byte-identical regardless of checkout line endings.
  • build script: cp replaced with a Node fs.cpSync one-liner.
  • dev script: -e '*'-e "*".
  • patch-package + pug-pack+1.11.0.patch: patches pug-pack to compile :coffeescript blocks with its bundled compiler instead of depending on module hoisting. Applied automatically via a postinstall hook.

Compatibility outside Windows

No regressions on macOS/Linux — every replacement uses cross-platform tooling:

  • Node (fs.cpSync, the JS script) is already required to build and behaves identically on all platforms.
  • Double quotes are valid in POSIX shells, so -e "*" is unchanged behavior there.
  • patch-package is a standard cross-platform npm tool; the patch changes pug-pack's behavior the same way everywhere, making it more robust (no reliance on dependency hoisting), not Windows-specific.
  • The only removed dependency is the Python interpreter, which the rest of the toolchain never needed.

Net: unblocks Windows, changes nothing observable for existing Unix users.

- Rewrite songs-to-json (python) as songs-to-json.js (node) to drop the python/shebang dependency
- Replace shell 'cp' in build with a cross-platform node fs.cpSync call
- Quote nodemon -e pattern with double quotes for cmd/PowerShell
- Add patch-package + postinstall and patches/ for pug-pack coffeescript compilation
@chrisglein chrisglein mentioned this pull request Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testing locally on Windows

1 participant