Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ready-guests-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-cline": patch
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in key: roo-cline appears to be incorrect. Did you mean roo-cli (or roo-code)?

Suggested change
"roo-cline": patch
"roo-cli": patch

---

Convert bootstrap script to esm
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"node": "20.18.1"
},
"scripts": {
"preinstall": "node scripts/bootstrap.js",
"preinstall": "node scripts/bootstrap.mjs",
"prepare": "husky",
"install": "node scripts/bootstrap.js",
"install:all": "node scripts/bootstrap.js",
"install": "node scripts/bootstrap.mjs",
"install:all": "node scripts/bootstrap.mjs",
"lint": "turbo lint --log-order grouped --output-logs new-only",
"check-types": "turbo check-types --log-order grouped --output-logs new-only",
"test": "turbo test --log-order grouped --output-logs new-only",
Expand Down
86 changes: 0 additions & 86 deletions scripts/bootstrap.js

This file was deleted.

81 changes: 81 additions & 0 deletions scripts/bootstrap.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env node

import { spawnSync } from "child_process"
import { existsSync, writeFileSync } from "fs"

if (process.env.BOOTSTRAP_IN_PROGRESS) {
console.log("⏭️ Bootstrap already in progress, continuing with normal installation...")
process.exit(0)
}

// If we're already using pnpm, just exit normally.
if (process.env.npm_execpath && process.env.npm_execpath.includes("pnpm")) {
process.exit(0)
}

console.log("🚀 Bootstrapping to pnpm...")

/**
* Run pnpm install with bootstrap environment variable.
*/
function runPnpmInstall(pnpmCommand) {
return spawnSync(pnpmCommand, ["install"], {
stdio: "inherit",
shell: true,
env: {
...process.env,
BOOTSTRAP_IN_PROGRESS: "1", // Set environment variable to indicate bootstrapping
},
})
}

/**
* Create a temporary package.json if it doesn't exist.
*/
function ensurePackageJson() {
if (!existsSync("package.json")) {
console.log("📦 Creating temporary package.json...")
writeFileSync("package.json", JSON.stringify({ name: "temp", private: true }, null, 2))
}
}

try {
// Check if pnpm is installed globally.
const pnpmCheck = spawnSync("command", ["-v", "pnpm"], { shell: true })

let pnpmInstall

if (pnpmCheck.status === 0) {
console.log("✨ Found pnpm")
pnpmInstall = runPnpmInstall("pnpm")
} else {
console.log("⚠️ Unable to find pnpm, installing it temporarily...")
ensurePackageJson()

console.log("📥 Installing pnpm locally...")

const npmInstall = spawnSync("npm", ["install", "--no-save", "pnpm"], {
stdio: "inherit",
shell: true,
})

if (npmInstall.status !== 0) {
console.error("❌ Failed to install pnpm locally")
process.exit(1)
}

console.log("🔧 Running pnpm install with local installation...")
pnpmInstall = runPnpmInstall("node_modules/.bin/pnpm")
}

if (pnpmInstall.status !== 0) {
console.error("❌ pnpm install failed")
process.exit(pnpmInstall.status)
}

console.log("🎉 Bootstrap completed successfully!")
process.exit(0)
} catch (error) {
console.error("💥 Bootstrap failed:", error.message)
process.exit(1)
}
Loading