Skip to content

feat(maker-pkg)!: write PKGs to arch subdirectories - #4383

Merged
erickzhao merged 1 commit into
nextfrom
pkg-arch-subdir
Sep 11, 2026
Merged

feat(maker-pkg)!: write PKGs to arch subdirectories#4383
erickzhao merged 1 commit into
nextfrom
pkg-arch-subdir

Conversation

@erickzhao

@erickzhao erickzhao commented Sep 11, 2026

Copy link
Copy Markdown
Member

BREAKING CHANGE: maker-pkg now writes the distributable to arch-specific subdirectories

Every other maker writes into `<maker>/<arch>` under the make directory;
the PKG maker was the last one writing flat into `out/make`. Match the
layout that #4275 gave the DMG maker so parallel makers cannot collide
and downstream tooling can rely on one shape.

BREAKING CHANGE: `.pkg` files are now written to `out/make/pkg/<arch>/`
instead of directly into `out/make/`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ThYQswo8p2Rixc5sYLkDF5
@github-actions github-actions Bot added the next label Sep 11, 2026
@erickzhao
erickzhao marked this pull request as ready for review September 11, 2026 21:59
@erickzhao
erickzhao requested a review from a team as a code owner September 11, 2026 21:59
@erickzhao
erickzhao enabled auto-merge (squash) September 11, 2026 22:02
@erickzhao
erickzhao merged commit 3db77f0 into next Sep 11, 2026
25 checks passed
@erickzhao
erickzhao deleted the pkg-arch-subdir branch September 11, 2026 22:04

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

const name =
this.config.name || `${appName}-${packageJSON.version}-${targetArch}`;
const outPath = path.resolve(makeDir, `${name}.pkg`);
const outPath = path.resolve(makeDir, 'pkg', targetArch, `${name}.pkg`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟣 Pre-existing: outPath is namespaced only by targetArch (pkg/{targetArch}/{name}.pkg), not by targetPlatform, and the default name ${appName}-${version}-${targetArch} also omits platform. Building both darwin and mas for the same arch (a common flow: notarized direct-download build plus App Store build) still writes to the identical path, so ensureFile() silently deletes/overwrites the other platform's .pkg. Fix: include targetPlatform in the arch subdirectory or default name so darwin/mas outputs never collide, same as the arch fix just applied.

Extended reasoning...

make.ts calls maker.make() once per CLI invocation with a single platform, so building darwin then mas (e.g. two sequential electron-forge make --platform=X runs, or a CI pipeline producing both distributables) reuses the same persistent actualOutDir/make makeDir. Both runs compute outPath = makeDir/pkg/{targetArch}/{appName}-{version}-{targetArch}.pkg — identical for darwin and mas since neither the new subdirectory nor the default name includes platform. The second run's ensureFile() does fs.rm() on that exact path before flat() writes the mas .pkg, silently destroying the darwin .pkg artifact with no warning to the user. This is the same defect that existed pre-diff (old path was makeDir/{name}.pkg, also platform-agnostic); the diff touches this exact line to fix the arch axis but leaves the platform axis with the identical unresolved collision.

Verification: pre-existing. The defect is real: outPath at MakerPKG.ts:36 (path.resolve(makeDir, 'pkg', targetArch, ${name}.pkg)) and the default name at line 34-35 (${appName}-${packageJSON.version}-${targetArch}) both omit targetPlatform. makeDir = actualOutDir/make (make.ts:348) has no platform component either. So a darwin build and a mas build for the same arch both resolve to… | pre-existing: The…

@erickzhao erickzhao mentioned this pull request Sep 11, 2026
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants