Skip to content

fix: cross-platform compatibility for build scripts #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sanjayr-12
Copy link

@sanjayr-12 sanjayr-12 commented Sep 25, 2024

Description:

This PR resolves an issue with the build scripts that were not functioning properly on Windows due to the use of Unix-specific commands (mkdir -p and rm -rf). The following changes were made to ensure the build works seamlessly across both Unix and Windows environments:

  • Replaced the mkdir -p command with the mkdirp package for cross-platform directory creation.
  • Replaced the rm -rf command with the rimraf package for cross-platform directory removal.
  • Created a moveFiles.js script to handle moving build directories (React and Next.js) and cleaning up temporary directories (distreact and distnextjs)

Error Faced:

When executing npm install or the build script in Windows Command Prompt, the following errors occurred:

  • rm is not recognized as an internal or external command,
    When executing npm install or the build script on bash, the following errors occurred:
  • A subdirectory or file -p already exists. Error occurred while processing: -p.
  • A subdirectory or file dist already exists. Error occurred while processing: dist.

Changes:

  • Updated the package.json build scripts to use mkdirp for directory creation and rimraf for directory removal.
  • Added the moveFiles.js script to encapsulate the logic for moving directories and cleaning up.

Testing:

  • Manually tested the build and directory operations on both cmd and bash to confirm functionality.

Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
convex-auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 25, 2024 8:44am

@thomasballinger
Copy link
Contributor

Hi @sanjayr-12, are you actively developing with this on Windows? We're open to changes like this coming from contributors who work on Windows without using a bash shell and would find this convenient but we'd want these to be maintained; we need someone contributing actively to know this will keep working. Or we need a Windows CI task to check this works.

@sanjayr-12
Copy link
Author

sanjayr-12 commented Dec 11, 2024

Hi @sanjayr-12, are you actively developing with this on Windows? We're open to changes like this coming from contributors who work on Windows without using a bash shell and would find this convenient but we'd want these to be maintained; we need someone contributing actively to know this will keep working. Or we need a Windows CI task to check this works.

Hi @thomasballinger, Yes, I work on Windows using Command Prompt and PowerShell, so I ran into these issues and fixed them. I don’t have experience setting up a Windows CI task yet, but I’m open to learning or working with others to get it done. I’m happy to help test and keep these changes working on Windows.

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.

2 participants