-
Notifications
You must be signed in to change notification settings - Fork 11.1k
fix: Windows compatibility - replace Unix commands with cross-platform alternatives #25377
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
base: main
Are you sure you want to change the base?
Conversation
|
@tanuj-ekayaa is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
…m alternatives ## Summary Fixes Windows incompatibility issues where Unix-specific shell commands (`rm`, `cp`, `cd`) prevented `yarn install` and `yarn dx` from working on Windows systems. ## Changes - **Replaced `rm -rf` commands** in 9 packages with cross-platform Node.js `fs.rmSync()` and `fs.cpSync()` - **Fixed `@calcom/platform-enums`** build script (removed `rm -rf ./dist`) - **Fixed `@calcom/platform-types`** build script (removed `rm -rf ./dist`) - **Fixed `@calcom/embed-core`** build and clean scripts (replaced Unix commands) - **Fixed `@calcom/embed-react`** build and clean scripts (replaced `rm` and `cp`) - **Fixed `@calcom/embed-snippet`** build and clean scripts - **Fixed `@calcom/prisma`** db-up script to run from correct directory - **Fixed `@calcom/web` and `@calcom/api`** clean scripts - **Removed problematic `.env` symlink** in `packages/prisma/.env` that caused Docker Compose failures - **Added database port mapping** to `docker-compose.yml` (5450:5432) ## Test Plan - Tested `yarn install` completes successfully on Windows 11 - Tested Docker Compose starts database and redis containers - Verified all scripts use cross-platform Node.js APIs - Changes work on Windows, macOS, and Linux (Node.js fs module is cross-platform) ## Related Issues This extends the fix from calcom#14445 which only addressed `@calcom/embed-core`. The same issue existed in platform packages and other embed packages, blocking Windows developers from setting up the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 10 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="packages/platform/types/package.json">
<violation number="1" location="packages/platform/types/package.json:8">
Build no longer clears `dist`, so removed/renamed files can linger and be published. Please restore a cross‑platform clean step before running `tsc`.</violation>
</file>
<file name="packages/platform/enums/package.json">
<violation number="1" location="packages/platform/enums/package.json:20">
Dropping the dist cleanup step means stale compiled files stick around when sources are removed or renamed, because `tsc --build` never deletes old outputs. Ensure the build script removes `./dist` in a cross-platform way before running tsc.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
packages/platform/types/package.json
Outdated
| "scripts": { | ||
| "build": "yarn clean && tsc --build --force tsconfig.json", | ||
| "clean": "rm -rf ./dist", | ||
| "build": "tsc --build --force tsconfig.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build no longer clears dist, so removed/renamed files can linger and be published. Please restore a cross‑platform clean step before running tsc.
Prompt for AI agents
Address the following comment on packages/platform/types/package.json at line 8:
<comment>Build no longer clears `dist`, so removed/renamed files can linger and be published. Please restore a cross‑platform clean step before running `tsc`.</comment>
<file context>
@@ -5,8 +5,7 @@
"scripts": {
- "build": "yarn clean && tsc --build --force tsconfig.json",
- "clean": "rm -rf ./dist",
+ "build": "tsc --build --force tsconfig.json",
"build:watch": "tsc --build --force ./tsconfig.json --watch",
"post-install": "yarn build"
</file context>
| "build": "tsc --build --force tsconfig.json", | |
| "build": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true})\" && tsc --build --force tsconfig.json", |
✅ Addressed in 8424f07
packages/platform/enums/package.json
Outdated
| "scripts": { | ||
| "test": "jest ./tests", | ||
| "build": "rm -rf ./dist && tsc --build --force tsconfig.json", | ||
| "build": "tsc --build --force tsconfig.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping the dist cleanup step means stale compiled files stick around when sources are removed or renamed, because tsc --build never deletes old outputs. Ensure the build script removes ./dist in a cross-platform way before running tsc.
Prompt for AI agents
Address the following comment on packages/platform/enums/package.json at line 20:
<comment>Dropping the dist cleanup step means stale compiled files stick around when sources are removed or renamed, because `tsc --build` never deletes old outputs. Ensure the build script removes `./dist` in a cross-platform way before running tsc.</comment>
<file context>
@@ -17,7 +17,7 @@
"scripts": {
"test": "jest ./tests",
- "build": "rm -rf ./dist && tsc --build --force tsconfig.json",
+ "build": "tsc --build --force tsconfig.json",
"build:watch": "tsc --build --force ./tsconfig.json --watch",
"post-install": "yarn build"
</file context>
| "build": "tsc --build --force tsconfig.json", | |
| "build": "node -e \"require('fs').rmSync('./dist', { recursive: true, force: true });\" && tsc --build --force tsconfig.json", |
✅ Addressed in 8424f07
- Add explicit dist cleanup before tsc build in platform-enums - Add explicit dist cleanup before tsc build in platform-types - Addresses cubic-dev-ai review: tsc --build --force doesn't remove stale files - Uses Node.js fs.rmSync for cross-platform compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 2 files (reviewed changes from recent commits).
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/platform/types/package.json">
<violation number="1" location="packages/platform/types/package.json:8">
After deleting ./dist, the build needs to force TypeScript to re-emit outputs; otherwise the stale tsconfig.tsbuildinfo makes `tsc --build` skip compilation and leaves dist empty.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| "scripts": { | ||
| "build": "yarn clean && tsc --build --force tsconfig.json", | ||
| "clean": "rm -rf ./dist", | ||
| "build": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true})\" && tsc --build tsconfig.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After deleting ./dist, the build needs to force TypeScript to re-emit outputs; otherwise the stale tsconfig.tsbuildinfo makes tsc --build skip compilation and leaves dist empty.
Prompt for AI agents
Address the following comment on packages/platform/types/package.json at line 8:
<comment>After deleting ./dist, the build needs to force TypeScript to re-emit outputs; otherwise the stale tsconfig.tsbuildinfo makes `tsc --build` skip compilation and leaves dist empty.</comment>
<file context>
@@ -5,7 +5,7 @@
"private": true,
"scripts": {
- "build": "tsc --build --force tsconfig.json",
+ "build": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true})\" && tsc --build tsconfig.json",
"build:watch": "tsc --build --force ./tsconfig.json --watch",
"post-install": "yarn build"
</file context>
| "build": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true})\" && tsc --build tsconfig.json", | |
| "build": "node -e \"require('fs').rmSync('./dist',{recursive:true,force:true})\" && tsc --build --force tsconfig.json", |
Summary
Fixes Windows incompatibility issues where Unix-specific shell commands (
rm,cp,cd) preventedyarn installandyarn dxfrom working on Windows systems.Fixes #25376
Changes Made
rm -rfcommands in 9 packages with cross-platform Node.jsfs.rmSync()andfs.cpSync()@calcom/platform-enumsbuild script (removedrm -rf ./dist)@calcom/platform-typesbuild script (removedrm -rf ./dist)@calcom/embed-corebuild and clean scripts (replaced Unix commands)@calcom/embed-reactbuild and clean scripts (replacedrmandcp)@calcom/embed-snippetbuild and clean scripts@calcom/prismadb-up script to run from correct directory@calcom/weband@calcom/apiclean scripts.envsymlink inpackages/prisma/.envthat caused Docker Compose failuresdocker-compose.yml(5450:5432)Test Plan
yarn installcompletes successfully on Windows 11Related Issues
This extends the fix from #14445 which only addressed
@calcom/embed-core. The same issue existed in platform packages and other embed packages, blocking Windows developers from setting up the project.Additional Context