Skip to content

Conversation

@sidgaikwad
Copy link
Contributor

@sidgaikwad sidgaikwad commented Oct 7, 2025

PR: Make packages/core Build Cross-Platform

Description

This PR updates the packages/core build scripts to be cross-platform using rimraf and cpy-cli instead of Unix-specific commands.

Changes

  • Installed rimraf and cpy-cli as dev dependencies:
pnpm add -D rimraf cpy-cli
  • Updated packages/core/package.json scripts:
"scripts": {
  "python-setup": "python3 -m venv python_modules && python_modules/bin/pip install -r requirements.txt",
  "move:python": "cpy src/python/*.py dist/src/python --parents",
  "move:rb": "cpy src/ruby/*.rb dist/src/ruby --parents",
  "move:steps": "cpy src/steps/*.ts dist/src/steps --parents",
  "build": "rimraf dist && tsc && npm run move:python && npm run move:rb && npm run move:steps",
  "clean": "rimraf python_modules dist"
}

How to Test

  1. Run the build on Windows:
pnpm run build
  1. Verify that:

    • The dist folder is created correctly.
    • Python, Ruby, and step files are copied as expected.
    • No errors occur during build.

Screenshots:

image image

Fixes: #787

Notes

  • This change is fully cross-platform and works on Windows, macOS, Linux, and CI/CD pipelines.

@vercel
Copy link

vercel bot commented Oct 7, 2025

@sidgaikwad is attempting to deploy a commit to the motia Team on Vercel.

A member of the Team first needs to authorize it.

@ytallo ytallo force-pushed the Fixes/Build-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd branch from 0baadc2 to 66132e8 Compare October 7, 2025 17:39
@github-actions github-actions bot added the size/M label Oct 7, 2025
@ytallo ytallo force-pushed the Fixes/Build-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd branch from 66132e8 to 20b6de2 Compare October 7, 2025 17:51
@ytallo ytallo force-pushed the Fixes/Build-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd branch from 20b6de2 to 33fdb36 Compare October 8, 2025 12:21
@sergiofilhowz
Copy link
Contributor

Thank you, I plan to test it later today on a windows machine

@sidgaikwad
Copy link
Contributor Author

Thank you, I plan to test it later today on a windows machine

yeah thanks

…uild-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd
…-sidd' of https://github.com/sidgaikwad/motia into Fixes/Build-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd
…uild-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd
…uild-Fails-on-Windows-Due-to-Unix-Shell-Commands-sidd
@rohitg00
Copy link
Contributor

hey @sidgaikwad , Sergio is looking into this - sorry for some delay in this review.

matrixNeo76 pushed a commit to matrixNeo76/motiaMatrix that referenced this pull request Nov 16, 2025
…Dev#787)

This commit fixes Issue MotiaDev#787 where the build process fails on Windows
due to Unix-specific shell commands that are not available in Windows
CMD or PowerShell.

Changes Made:

1. **Root package.json**:
   - Added cross-platform dependencies: rimraf, cpy-cli, mkdirp
   - Updated clean script to use rimraf instead of rm -rf

2. **packages/core/package.json**:
   - Replaced mkdir -p with mkdirp
   - Replaced cp commands with cpy
   - Replaced rm -rf with rimraf
   - All move:* and build scripts now cross-platform compatible

3. **packages/workbench/package.json**:
   - Replaced rm -rf with rimraf
   - Replaced sh post-build.sh with node post-build.js

4. **packages/workbench/post-build.js** (NEW):
   - Cross-platform replacement for post-build.sh
   - Implements file/directory copying using Node.js fs module
   - Performs text replacement in HTML files
   - Works on Windows, macOS, and Linux

5. **playground/package.json**:
   - Replaced rm -rf with rimraf in clean script

6. **Documentation**:
   - ISSUE_787_ANALYSIS.md: Detailed problem analysis
   - ISSUE_787_FIX_SUMMARY.md: Complete fix documentation
   - fix-windows-scripts.js: Automated fix script for remaining packages

Impact:
- Windows developers can now build without WSL or Git Bash
- Consistent behavior across all operating systems
- Improved CI/CD compatibility
- Better developer experience

Testing:
All scripts should now work on Windows PowerShell, CMD, and Unix shells.

Related: MotiaDev#787, MotiaDev#788
Co-authored-by: PR MotiaDev#788 analysis
@ytallo ytallo changed the base branch from main to release/community-contributions November 20, 2025 20:44
@rohitg00
Copy link
Contributor

Hey @sidgaikwad 👋 How's it going? I know you reached out to me recently. I checked with the team and they're going to review this PR and merge if everything pass successfully. Sorry for delay caused.

@rohitg00
Copy link
Contributor

Hey @sidgaikwad, please resolve the conflicts so we can merge this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Fails on Windows Due to Unix Shell Commands

3 participants