Skip to content

feat: ship raw binaries (not zips) in npm process-plugin packages - #5

Merged
dsherret merged 2 commits into
mainfrom
npm-no-zip
May 23, 2026
Merged

dsherret merged 2 commits into
mainfrom
npm-no-zip

Conversation

@dsherret

Copy link
Copy Markdown
Member

Summary

dprint now supports referencing a raw executable from a process plugin's per-platform npm sub-package, so the helper no longer needs to wrap the binary in a .zip. Two changes:

  1. Raw binaries in sub-packages. CreateDprintOrgNpmPackagesOptions.platforms[].zipFilePath is renamed to binaryPath (breaking — only one PR was using it). The file at binaryPath is copied verbatim into the sub-package under its basename, marked executable (mode 0o755) on Unix, and referenced from the main package's plugin.json as npm:<sub-package>@<version>/<basename> instead of .../plugin.zip.

  2. name and version at the top of package.json. Generated package.json files now order keys as: name, version, then caller-supplied packageJsonExtra (any fields that collide with managed keys are dropped), then managed platform/dependency fields (os/cpu/libc for sub-packages, optionalDependencies for the main).

Caveats

  • Cross-OS publishing. Running npm pack/publish from Windows packs files without the Unix executable bit, because the host filesystem can't carry that mode. CI on Ubuntu is fine; for local bootstrap publishes, use a Unix host.
  • Existing PluginFileBuilder API is unchanged — the zipFilePath/zipUrl parameter names are now slightly misleading (they accept any file) but the behavior is general and renaming would break create_plugin_file.ts style callers that still ship zips via GitHub releases.

Test plan

  • deno test -P — 7/7 pass, including a new test pinning the name/version-at-top contract and updated assertions for the new reference URL format.
  • deno check / dprint check clean.
  • After release, dprint-plugin-exec's create_npm_packages.ts will be updated to extract the platform zips and pass the binaries through to the helper.

dsherret added 2 commits May 23, 2026 12:03
dprint now supports referencing a raw executable from a process
plugin's per-platform npm sub-package (no zip wrapper required), so
`createDprintOrgNpmPackages` was placing an unnecessary intermediate
.zip into each sub-package.

Changes:
- `CreateDprintOrgNpmPackagesOptions.platforms[].zipFilePath`
  renamed to `binaryPath` (breaking).
- The binary is copied verbatim into the sub-package under its
  basename and marked executable (mode 0o755) on Unix; the main
  package's plugin.json references it as
  `npm:<sub>@<version>/<basename>` instead of `.../plugin.zip`.
- Generated `package.json` files put `name` and `version` at the
  top, then caller-supplied `packageJsonExtra`, then managed
  platform/dependency fields. Extras still can't override managed
  fields.

Tests updated to use binary fixtures and assert the new reference
format. New test pins the `name`/`version`-at-top contract.

Note: cross-OS publishing caveat — when running `npm pack` from
Windows, the binary will be packed without the Unix executable bit
because the host filesystem can't carry that mode. Publish from a
Unix host (CI is Ubuntu) for correctness.
@dsherret
dsherret merged commit df4eadd into main May 23, 2026
1 check passed
@dsherret
dsherret deleted the npm-no-zip branch May 23, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant