Skip to content

chore(packaging): trim packaged node_modules - #3529

Draft
setchy wants to merge 2 commits into
mainfrom
chore/trim-packaged-node-modules
Draft

setchy wants to merge 2 commits into
mainfrom
chore/trim-packaged-node-modules

Conversation

@setchy

@setchy setchy commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

The packaged app hand-included node_modules/**/*, overriding electron-builder's production dependency collector. It also declared four renderer-only packages (cn, react, react-dom, react-router-dom) as runtime dependencies even though Vite bundles them.

This lets electron-builder collect the runtime closure and classifies dependencies by whether they are loaded from disk at runtime.

  • Remove the node_modules/**/* glob from electron-builder.js.
  • Move cn, react, react-dom, and react-router-dom to devDependencies.
  • Keep electron-log, electron-menubar, and electron-updater external and in dependencies; do not bundle them.
  • Add scripts/verifyPackagedDependencies.js and run it in the build and publish matrices.
  • Replace the vite.config.mts TODO with the documented decision.
  • Document the rule in CONTRIBUTING.md.

Measured on macOS: packaged node_modules went from 17.2 MB / 26 packages to 2.3 MB / 18 packages.

Test plan

  • pnpm install --frozen-lockfile
  • pnpm check
  • pnpm test — 204 files, 1,974 tests
  • pnpm build
  • node scripts/verifyPackagedDependencies.js dist/mac-arm64/Gitify.app — PASS, 18 packages / 2.3 MB
  • Packaged macOS app launched; renderer loaded notifications, log written, updater ran, no MODULE_NOT_FOUND
  • Windows, Linux, and macOS CI packaging + verification — all passed

Draft for review. The --dir build lacks app-update.yml, so its update check logs the expected ENOENT; a full packaged build provides the file.

Let electron-builder's pnpm production collector own the dependency closure, reclassify renderer-only packages as dev dependencies, and verify the packaged asar in CI.
@github-actions github-actions Bot added chore Miscellaneous tasks dependency Dependency updates labels Oct 25, 2026
statFile could not resolve normalized paths on Windows; traverse the archive header instead.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Miscellaneous tasks dependency Dependency updates

Development

Successfully merging this pull request may close these issues.

1 participant