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
9 changes: 9 additions & 0 deletions .changeset/fix-pnpm-binary-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@googleworkspace/cli": patch
---

fix: auto-install binary on run if missing

pnpm skips postinstall when the package is already up to date.
This ensures run.js will auto-trigger install.js if the
binary is missing, fixing the 'gws binary not found' error.
10 changes: 8 additions & 2 deletions npm/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ const binPath = path.join(__dirname, "bin", platform.binary);

if (!fs.existsSync(binPath)) {
console.error(
`gws binary not found at ${binPath}\nRun "npm install -g @googleworkspace/cli" to install it.`,
`gws binary not found at ${binPath}\nAuto-installing...`
);
process.exit(1);
const install = spawnSync(process.execPath, [path.join(__dirname, "install.js")], {
cwd: __dirname,
stdio: "inherit",
});
if (install.status !== 0) {
process.exit(install.status ?? 1);
}
Comment thread
jpoehnelt marked this conversation as resolved.
}

const result = spawnSync(binPath, process.argv.slice(2), {
Expand Down
Loading