Skip to content

fix(build): replace rm -rf with rimraf for Windows compatibility#26641

Closed
simiondolha wants to merge 1 commit intocalcom:mainfrom
simiondolha:fix/25812-windows-rm
Closed

fix(build): replace rm -rf with rimraf for Windows compatibility#26641
simiondolha wants to merge 1 commit intocalcom:mainfrom
simiondolha:fix/25812-windows-rm

Conversation

@simiondolha
Copy link
Contributor

Summary

  • Replaces Unix-specific rm -rf commands with cross-platform rimraf in all package.json clean scripts
  • Adds rimraf as a devDependency to enable Windows compatibility
  • Fixes build failures on Windows where rm command is not recognized

Updated packages

  • apps/api/v1
  • apps/web
  • packages/embeds/embed-core
  • packages/embeds/embed-react
  • packages/embeds/embed-snippet
  • packages/platform/atoms
  • packages/platform/enums
  • packages/platform/libraries
  • packages/platform/types
  • packages/prisma
  • Root package.json

Test plan

  • Run yarn clean on Windows to verify no errors
  • Run yarn build on Windows to verify clean scripts work

Fixes #25812

🤖 Generated with Claude Code

@simiondolha simiondolha requested review from a team as code owners January 9, 2026 20:28
@vercel
Copy link

vercel bot commented Jan 9, 2026

@simiondolha is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jan 9, 2026
@github-actions github-actions bot added the 🐛 bug Something isn't working label Jan 9, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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 12 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/embeds/embed-react/package.json">

<violation number="1" location="packages/embeds/embed-react/package.json:14">
P1: The `shx` package is not installed as a dependency, but it's being used in the build script. The build will fail because the `shx` command won't be found. Either add `shx` to devDependencies (root or this package), or use a different approach like `cp-cli` or keep the rimraf change but use Node's built-in file copy in a postbuild script.</violation>
</file>

<file name="package.json">

<violation number="1" location="package.json:32">
P1: Missing `--glob` flag for rimraf. In rimraf v5+, glob patterns are disabled by default and arguments are treated as literal paths. Without the `--glob` flag, this command will silently fail to delete anything because it will look for directories literally named `**/node_modules` instead of expanding the glob pattern.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"scripts": {
"dev": "vite --port=3101 --open",
"build": "rm -rf dist && vite build && cp ./dist/Cal.es.js ./dist/Cal.es.mjs && tsc --emitDeclarationOnly --declarationDir dist",
"build": "rimraf dist && vite build && shx cp ./dist/Cal.es.js ./dist/Cal.es.mjs && tsc --emitDeclarationOnly --declarationDir dist",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The shx package is not installed as a dependency, but it's being used in the build script. The build will fail because the shx command won't be found. Either add shx to devDependencies (root or this package), or use a different approach like cp-cli or keep the rimraf change but use Node's built-in file copy in a postbuild script.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/embeds/embed-react/package.json, line 14:

<comment>The `shx` package is not installed as a dependency, but it's being used in the build script. The build will fail because the `shx` command won't be found. Either add `shx` to devDependencies (root or this package), or use a different approach like `cp-cli` or keep the rimraf change but use Node's built-in file copy in a postbuild script.</comment>

<file context>
@@ -11,7 +11,7 @@
   "scripts": {
     "dev": "vite --port=3101 --open",
-    "build": "rm -rf dist && vite build && cp ./dist/Cal.es.js ./dist/Cal.es.mjs && tsc --emitDeclarationOnly --declarationDir dist",
+    "build": "rimraf dist && vite build && shx cp ./dist/Cal.es.js ./dist/Cal.es.mjs && tsc --emitDeclarationOnly --declarationDir dist",
     "preview": "vite preview",
     "type-check": "tsc --pretty --noEmit",
</file context>
Suggested change
"build": "rimraf dist && vite build && shx cp ./dist/Cal.es.js ./dist/Cal.es.mjs && tsc --emitDeclarationOnly --declarationDir dist",
"build": "rimraf dist && vite build && node -e \"require('fs').copyFileSync('./dist/Cal.es.js', './dist/Cal.es.mjs')\" && tsc --emitDeclarationOnly --declarationDir dist",
Fix with Cubic

package.json Outdated
"build": "turbo run build --filter=@calcom/web...",
"build:ai": "turbo run build --filter=\"@calcom/ai\"",
"clean": "find . -name node_modules -o -name .next -o -name .turbo -o -name dist -type d -prune | xargs rm -rf",
"clean": "rimraf **/node_modules **/.next **/.turbo **/dist",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Missing --glob flag for rimraf. In rimraf v5+, glob patterns are disabled by default and arguments are treated as literal paths. Without the --glob flag, this command will silently fail to delete anything because it will look for directories literally named **/node_modules instead of expanding the glob pattern.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 32:

<comment>Missing `--glob` flag for rimraf. In rimraf v5+, glob patterns are disabled by default and arguments are treated as literal paths. Without the `--glob` flag, this command will silently fail to delete anything because it will look for directories literally named `**/node_modules` instead of expanding the glob pattern.</comment>

<file context>
@@ -29,7 +29,7 @@
     "build": "turbo run build --filter=@calcom/web...",
     "build:ai": "turbo run build --filter=\"@calcom/ai\"",
-    "clean": "find . -name node_modules -o -name .next -o -name .turbo -o -name dist -type d -prune | xargs rm -rf",
+    "clean": "rimraf **/node_modules **/.next **/.turbo **/dist",
     "db-deploy": "turbo run db-deploy",
     "db-seed": "turbo run db-seed",
</file context>
Suggested change
"clean": "rimraf **/node_modules **/.next **/.turbo **/dist",
"clean": "rimraf --glob **/node_modules **/.next **/.turbo **/dist",

✅ Addressed in b60eed1

Use rimraf and shx instead of Unix-specific rm and cp commands
to ensure build scripts work cross-platform on Windows.

Updated packages:
- apps/api/v1
- apps/web
- packages/embeds/embed-core
- packages/embeds/embed-react
- packages/embeds/embed-snippet
- packages/platform/atoms
- packages/platform/enums
- packages/platform/libraries
- packages/platform/types
- packages/prisma

Fixes calcom#25812
@simiondolha simiondolha force-pushed the fix/25812-windows-rm branch from c6aa4ec to b60eed1 Compare January 9, 2026 20:40
@anikdhabal
Copy link
Contributor

Fixed by this:- #25814

@anikdhabal anikdhabal closed this Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails on Windows: 'rm' is not recognized

2 participants