Skip to content

Commit 599520c

Browse files
JohnMcLearclaude
andauthored
fix(release): unbreak Linux deb + Snap + Windows builds post-monorepo (#47)
Three regressions surfaced when v0.4.0 (the first release-please run under the new monorepo layout) tried to build: 1. Linux `.deb` — fpm failed with "Parent directory does not exist: .../release/@etherpad". electron-builder defaults the deb artifact path + executable name to `package.json#name`, which is now the scoped `@etherpad/desktop`. The `/` from the scope became a directory in the output path. 2. Snap — `expected argument for flag '--executable'` followed by `ERR_ELECTRON_BUILDER_CANNOT_EXECUTE`. Same root cause as deb: the snap `--executable` argument can't carry a scoped name. 3. Windows — `[fetch-etherpad] failed: spawn pnpm ENOENT`. The embedded-server fetch script spawned `pnpm` without going through a shell, but on Windows pnpm resolves to `pnpm.cmd` which Node's `child_process.spawn` won't find without `shell: true`. Fixes: - Add `linux.executableName: etherpad-desktop` to `packages/desktop/build/electron-builder.yml`. That pins a slash-free name for both deb and snap targets in one shot. - Add `shell: process.platform === 'win32'` to the `spawn` call in `packages/desktop/scripts/fetch-etherpad.mjs`. Same pattern we used upstream in ether/etherpad's `admin/scripts/gen-api.mjs`. These are pre-existing post-#29/#30 regressions; v0.3.2 was built before the monorepo move, so its non-scoped root name shielded it. The macOS build + Linux AppImage already succeed at v0.4.0, so this PR's verification is the next tag rebuild. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 150d987 commit 599520c

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

packages/desktop/build/electron-builder.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ linux:
3636
- AppImage
3737
- deb
3838
- snap
39+
# `package.json#name` is `@etherpad/desktop` (scoped). electron-builder
40+
# uses that as the default executable + artifact basename for the deb
41+
# and snap targets, and the `/` in the scope becomes a directory in
42+
# the output path — so deb/snap builds crash with "Parent directory
43+
# does not exist: release/@etherpad". Snap additionally crashes
44+
# earlier with "expected argument for flag '--executable'" because
45+
# the scoped name doesn't satisfy the snap binary-naming rules.
46+
# Pinning a slash-free executable name fixes both.
47+
executableName: etherpad-desktop
3948
category: Office
4049
icon: build/icons/
4150
description: Native desktop client for Etherpad

packages/desktop/scripts/fetch-etherpad.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ async function exists(p) {
4444

4545
async function run(cmd, args, opts = {}) {
4646
return new Promise((resolveP, rejectP) => {
47-
const child = spawn(cmd, args, { stdio: 'inherit', ...opts });
47+
// On Windows, pnpm/tar/etc. resolve to .cmd or .ps1 shims, and Node's
48+
// spawn() won't find them without going through a shell. Use shell:true
49+
// on win32 only to avoid Node's DEP0190 warning elsewhere. All cmd/arg
50+
// values here are hardcoded by us, so the shell variant is not an
51+
// injection risk.
52+
const child = spawn(cmd, args, {
53+
stdio: 'inherit',
54+
shell: process.platform === 'win32',
55+
...opts,
56+
});
4857
child.on('exit', (code) => {
4958
if (code === 0) resolveP();
5059
else rejectP(new Error(`${cmd} ${args.join(' ')} exited ${code}`));

0 commit comments

Comments
 (0)