Skip to content

Add Windows cross-platform support for npm scripts#204

Open
ExactDoug wants to merge 1 commit intomb21:masterfrom
ExactDoug:claude/add-windows-cross-platform-support-012wGT7ZHzEmuWVWfqu359Ny
Open

Add Windows cross-platform support for npm scripts#204
ExactDoug wants to merge 1 commit intomb21:masterfrom
ExactDoug:claude/add-windows-cross-platform-support-012wGT7ZHzEmuWVWfqu359Ny

Conversation

@ExactDoug
Copy link

The current npm scripts use Unix-specific syntax that fails on Windows:

  • Environment variables use Unix syntax (VAR=value) instead of cross-platform
  • The postinstall script uses Unix 'cp' command which doesn't exist on Windows
  • Windows developers cannot run npm scripts natively without WSL

This change adds proper cross-platform support:

  1. Added 'cross-env' dependency (v7.0.3)

    • Handles environment variable setting across all platforms
    • Used in: build, electron:dev, website:build scripts
  2. Added 'shx' dependency (v0.3.4)

    • Provides Unix commands (like cp) on all platforms
    • Used in: postinstall script

These are industry-standard packages for Node.js cross-platform compatibility.

Scripts updated:

  • build: Added cross-env for INLINE_RUNTIME_CHUNK
  • postinstall: Changed cp to shx cp for cross-platform file copying
  • electron:dev: Added cross-env for BROWSER and ELECTRON_IS_DEV
  • website:build: Added cross-env for BUILD_PATH, PUBLIC_URL, INLINE_RUNTIME_CHUNK

This fixes the issues reported in PR #65 and allows Windows developers to run all npm scripts without modification.

The current npm scripts use Unix-specific syntax that fails on Windows:
- Environment variables use Unix syntax (VAR=value) instead of cross-platform
- The postinstall script uses Unix 'cp' command which doesn't exist on Windows
- Windows developers cannot run npm scripts natively without WSL

This change adds proper cross-platform support:

1. Added 'cross-env' dependency (v7.0.3)
   - Handles environment variable setting across all platforms
   - Used in: build, electron:dev, website:build scripts

2. Added 'shx' dependency (v0.3.4)
   - Provides Unix commands (like cp) on all platforms
   - Used in: postinstall script

These are industry-standard packages for Node.js cross-platform compatibility.

Scripts updated:
- build: Added cross-env for INLINE_RUNTIME_CHUNK
- postinstall: Changed cp to shx cp for cross-platform file copying
- electron:dev: Added cross-env for BROWSER and ELECTRON_IS_DEV
- website:build: Added cross-env for BUILD_PATH, PUBLIC_URL, INLINE_RUNTIME_CHUNK

This fixes the issues reported in PR mb21#65 and allows Windows developers to run
all npm scripts without modification.
@mb21
Copy link
Owner

mb21 commented Dec 1, 2025

Did you test this on Windows yourself? And did you also test it on any other OS?

@ExactDoug
Copy link
Author

ExactDoug commented Jan 13, 2026

Did you test this on Windows yourself? And did you also test it on any other OS?

yes. I am only using Windows.

But no. I did not test it on any other OS.

@mb21
Copy link
Owner

mb21 commented Jan 14, 2026

Thanks for the answer. I'm inclined to say Windows devs should just use WSL. I don't have a Windows machine ready to test to properly maintain this.

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.

3 participants