@anizoptera/publish-clean 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +147 -212
  2. package/dist/cli.js +443 -305
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,23 +1,21 @@
1
1
  # @anizoptera/publish-clean
2
2
 
3
- Publish npm packages with a consumer-only `package.json`. Refuses to ship a `.env`, a
4
- private key, or an unresolved workspace dependency.
3
+ Pre-publish npm package cleaner that strips common useless noise and crap from
4
+ `package.json`; prevents accidental publication of unwanted things and unresolved
5
+ dependencies. No deps, one JS file.
5
6
 
6
7
  [![npm version](https://img.shields.io/npm/v/@anizoptera/publish-clean?label=npm)](https://www.npmjs.com/package/@anizoptera/publish-clean)
7
8
  [![Signed provenance](https://img.shields.io/badge/provenance-signed-2ea44f?logo=npm&logoColor=white)](https://www.npmjs.com/package/@anizoptera/publish-clean#provenance)
8
9
  [![CI](https://github.com/Anizoptera/publish-clean/actions/workflows/check.yml/badge.svg?branch=main)](https://github.com/Anizoptera/publish-clean/actions/workflows/check.yml)
9
- [![License](https://img.shields.io/github/license/Anizoptera/publish-clean)](LICENSE)
10
-
10
+ [![Node >=22](https://img.shields.io/badge/node-%3E%3D22-339933?logo=node.js&logoColor=white)](package.json)
11
11
  [![Runtime deps](https://img.shields.io/badge/runtime_deps-0-2ea44f)](package.json)
12
- [![Node >=20](https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&logoColor=white)](package.json)
13
- [![pnpm pack + npm publish](https://img.shields.io/badge/pnpm_pack%20%2B%20npm_publish-f69220?logo=pnpm&logoColor=white)](https://pnpm.io/cli/pack)
14
- [![Bun checked](https://img.shields.io/badge/Bun-checked-000000?logo=bun&logoColor=white)](https://bun.sh/docs/cli/test)
12
+ [![License](https://img.shields.io/github/license/Anizoptera/publish-clean)](LICENSE)
15
13
 
16
14
  When you run `npm publish`, two things ship that you probably did not mean to ship.
17
15
 
18
- The first is your `package.json`. It is a development manifest. It lists devDependencies,
19
- config blocks for your test runner and linter and formatter, `packageManager`,
20
- `workspaces`, `pnpm` settings, release-tool settings, and every script you run locally.
16
+ The first is your `package.json`. It is a development manifest: devDependencies, config
17
+ blocks for your test runner, linter and formatter, `packageManager`, `workspaces`, `pnpm`
18
+ settings, release-tool settings, and every script you run locally.
21
19
  npm sends all of it, unchanged, to everyone who installs your package. In a pnpm
22
20
  workspace it can also send `workspace:*` and `catalog:` specs that were never resolved,
23
21
  and those break the install for every consumer.
@@ -27,50 +25,53 @@ tests, `.github/`, a lockfile. You do not see the tarball before it goes out, an
27
25
  version is published you cannot edit it. Unpublishing only works for a short window and
28
26
  under conditions npm decides.
29
27
 
30
- `publish-clean` packs the package, rewrites the manifest of the extracted copy down to
31
- what consumers actually use, packs that, and publishes the result. Your working tree is
32
- never modified. If the artifact still has something in it that should not ship, or
33
- declares a `main`, `exports`, or `bin` path that is not in the tarball, it fails instead
34
- of publishing.
28
+ `publish-clean` packs the package once, rewrites the `package.json` inside that tarball
29
+ down to what consumers actually use, checks the result, and publishes those exact bytes.
30
+ Your working tree is never modified. If the artifact still has something in it that should
31
+ not ship, or declares a `main`, `exports`, or `bin` path that is not in the tarball, it
32
+ fails instead of publishing.
35
33
 
36
- It uses pnpm to pack and npm to publish, and cleans the manifest in between. The
37
- reasoning behind that is in [Why it works this way](#why-it-works-this-way).
34
+ It packs with pnpm and publishes with npm, and cleans the manifest in between. Both
35
+ choices are argued, with measurements, in
36
+ [why pnpm packs and npm publishes](docs/why-pnpm-and-npm.md).
38
37
 
39
38
  ## Install
40
39
 
41
- ```bash
42
- pnpm add -D @anizoptera/publish-clean
43
- ```
40
+ | Project | Install | Run |
41
+ | ------- | --------------------------------------- | ------------------------- |
42
+ | pnpm | `pnpm add -D @anizoptera/publish-clean` | `pnpm exec publish-clean` |
43
+ | Bun | `bun add -d @anizoptera/publish-clean` | `bunx publish-clean` |
44
+ | npm | `npm i -D @anizoptera/publish-clean` | `npm exec publish-clean` |
45
+ | Yarn | `yarn add -D @anizoptera/publish-clean` | `yarn publish-clean` |
46
+
47
+ **Whatever you start it with, `pnpm` prepares the package and `npm` uploads it, so both
48
+ must be on `PATH`.** A Bun, npm or Yarn project needs pnpm installed too, including in CI.
49
+
50
+ Node.js 22+ runs it. npm provenance additionally needs 22.14+, because below that npm
51
+ cannot mint it.
44
52
 
45
53
  That installs one package and nothing else. `publish-clean` has zero runtime
46
- dependencies: it is a single file that talks to `pnpm`, `npm` and `tar` through the
47
- tools you already have. For something that sits on your publish path and handles your
54
+ dependencies: it is a single file that talks to `pnpm` and `npm`, and reads and rewrites
55
+ the tarball itself, so there is nothing else to have on the machine.
56
+
57
+ For something that sits on your publish path and handles your
48
58
  registry credentials, that matters. A publishing tool with a dependency tree is a
49
59
  supply-chain risk of its own, and this one has no transitive code to audit.
50
60
 
51
- Needs Node.js 20+, and `pnpm`, `npm` and `tar` on `PATH`.
52
-
53
- `--provenance` also needs Node.js 22.14+, npm 11.5.1+, and a cloud CI runner. npm will
54
- not sign a publish that came from your laptop.
61
+ `--provenance` additionally needs npm 11.5.1+ and a cloud CI runner. npm will not sign a
62
+ publish that came from your laptop.
55
63
 
56
64
  ## Package managers
57
65
 
58
- Start `publish-clean` with any package manager and it still packs with `pnpm` and
59
- publishes with `npm`. So both have to be installed even if your project uses neither. The
60
- reasons are in [Why it works this way](#why-it-works-this-way).
66
+ Why pnpm packs and npm publishes: pnpm is the only packer that resolves every workspace
67
+ layout correctly, and npm is the only client that can sign a release. The measurements are
68
+ in [why pnpm packs and npm publishes](docs/why-pnpm-and-npm.md).
61
69
 
62
- | Your project | How to run it | What to expect |
63
- | ------------ | ------------------------- | --------------------------------------------------------- |
64
- | pnpm | `pnpm exec publish-clean` | Everything works, no warning. |
65
- | npm | `npm exec publish-clean` | Works. Prints an advisory that packing goes through pnpm. |
66
- | Yarn | `yarn publish-clean` | Same as npm. |
67
- | Bun | `bunx publish-clean` | Same as npm. |
70
+ Started with anything other than pnpm, it prints an advisory on stderr saying so. That is
71
+ a warning, not an error. Nothing behaves differently because of it, and there is no flag
72
+ to silence it.
68
73
 
69
- The advisory is a warning on stderr, not an error. Nothing behaves differently because of
70
- it and there's no flag to silence it. Worth seeing once if the rest of your pipeline runs
71
- on something other than pnpm.
72
-
73
- For a single package all four behave the same, since nothing in the manifest needs
74
+ For a single package every manager behaves the same, since nothing in the manifest needs
74
75
  resolving before it ships.
75
76
 
76
77
  Monorepos are where it matters. `pnpm pack` resolves `workspace:` and `catalog:` specs by
@@ -159,8 +160,8 @@ publishes its own tarball, so you get the checks and not the cleaned manifest.
159
160
  pnpm exec publish-clean --dry-run
160
161
  ```
161
162
 
162
- Prints the paths of the cleaned package and the exact tarball that would be uploaded, and
163
- leaves both on disk. Run `tar tzf` on the tarball and read the rewritten `package.json`.
163
+ Prints every file that would ship and the cleaned `package.json`, then deletes its temp
164
+ tree. Add `--tarball-out DIR` to keep the tarball itself.
164
165
 
165
166
  ### Publishing a restricted package
166
167
 
@@ -181,98 +182,43 @@ publish-clean packages/my-lib -- --access public --tag next
181
182
 
182
183
  ```mermaid
183
184
  flowchart TD
184
- A[Your package directory] -->|pnpm pack| B[Tarball - pnpm decides the file set]
185
- B --> C[Extract into a temp directory]
186
- C --> D{No leaked files?}
187
- D --> E[Clean package.json for consumers]
188
- E --> F{Every declared main/exports/bin/types path exists?}
189
- F -->|replace the package.json member| G[Same tarball, cleaned manifest]
190
- G --> H{Same files, expected manifest, still no leaks?}
191
- H --> I[npm publish that tarball]
192
- ```
193
-
194
- Any gate that fails exits non-zero and nothing is published. `--dry-run` and
195
- `--guard-only` run the whole pipeline and stop before the publish.
196
-
197
- ## Why it works this way
198
-
199
- ### Why pnpm does the packing
200
-
201
- Not for file selection. pnpm, npm and Bun pick the same files: same `files` field, same
202
- `.npmignore`, same packlist defaults. There are no file rules of this tool's own either,
203
- so that part behaves however your package manager already behaves.
204
-
205
- Workspaces are the reason. A dependency written as `"@acme/utils": "workspace:*"` means
206
- "whatever version of that package is in this repo right now". It has to become a real
207
- version range before it ships, because to a stranger installing from the registry
208
- `workspace:*` means nothing.
209
-
210
- npm never adopted the protocol. It won't even install it:
211
-
212
- ```
213
- npm error code EUNSUPPORTEDPROTOCOL
214
- npm error Unsupported URL Type "workspace:": workspace:*
215
- ```
216
-
217
- `npm pack` on that same package exits 0 and writes `workspace:*` straight into the
218
- tarball. It neither resolves it nor refuses it, and silently publishing something you
219
- can't install is the one behaviour a release tool can't be built on.
220
-
221
- pnpm and Bun both resolve it, and both stop loudly when they can't. Their output matches
222
- down to `workspace:^` and `workspace:~` in `peerDependencies` and `optionalDependencies`,
223
- and `catalog:` entries too. On correctness there is nothing to choose between them.
224
-
225
- ### Why pnpm rather than Bun
226
-
227
- They resolve from different places, and that decides it.
228
-
229
- pnpm looks for the dependency in the packing package's own `node_modules` and resolves it
230
- from there. It never asks who put it there, so a Bun workspace, which gives every package
231
- its own `node_modules`, packs as readily as pnpm's own. Yarn hoists to the root instead
232
- and needs the one-time setup above.
233
-
234
- Bun reads `bun.lock`. It resolves the workspaces Bun installed and refuses the others:
235
-
236
- ```
237
- error: Failed to resolve workspace version for "@acme/utils" in `dependencies`.
238
- Run `bun install` and try again.
185
+ A[Your package directory] -->|pnpm pack| B[Tarball, file set chosen by pnpm]
186
+ B --> C[Copy it, rewriting only the package.json inside]
187
+ C --> D[Final tarball]
188
+ D --> E{Checks, all reading this tarball}
189
+ E -->|any fails| F[Exit non-zero, publish nothing]
190
+ E -->|all pass| G[npm publish this same tarball]
239
191
  ```
240
192
 
241
- That message is accurate and useless, because in a pnpm repo `bun install` is not
242
- something you want to be told to run. A tool that executes in other people's
243
- repositories has to cope with the repository it finds, so it packs with the one that
244
- reads all of them.
193
+ The checks are listed under [What it checks](#what-it-checks). The point of the shape is
194
+ that they all read the tarball that gets uploaded, so what passed the checks and what
195
+ reached the registry are the same bytes, not two things that ought to match.
245
196
 
246
- There's a correctness gap too, and it's the quiet kind. An aliased workspace dependency,
247
- `"utils": "workspace:@acme/utils@*"`, has to come out the other side as an npm alias.
248
- pnpm writes `"npm:@acme/utils@1.2.3"`. Bun 1.3.14 writes `"@acme/utils@*"`: the `npm:`
249
- prefix is dropped and the range was never resolved. npm won't take it.
197
+ `--dry-run` and `--guard-only` run the whole pipeline and stop before the publish.
250
198
 
251
- ```
252
- npm error code EINVALIDTAGNAME
253
- npm error Invalid tag name "is-odd@3.0.1" of package "aliased@is-odd@3.0.1"
254
- ```
199
+ ## Why it works this way
255
200
 
256
- `bun pm pack` exits 0 either way, so nothing tells you until someone tries to install the
257
- release.
201
+ ### Why pnpm packs, and npm publishes
258
202
 
259
- One silent way to publish a broken manifest is one too many for the step you can't take
260
- back.
203
+ pnpm because of workspaces. A dependency written `"@acme/utils": "workspace:*"` has to
204
+ become a real version range before it ships, and pnpm is the only packer that does that
205
+ for every layout it might find, including a Bun one. npm writes `workspace:*` into the
206
+ tarball unchanged and exits 0, publishing a package nobody can install. Bun resolves only
207
+ what Bun installed, and quietly mangles an aliased workspace dependency.
261
208
 
262
- pnpm also applies `publishConfig` field overrides. If your manifest points `main`, `types`
263
- and `exports` at source for local development and overrides them to `dist` for publishing,
264
- pnpm swaps them on the way out and drops `publishConfig` itself. npm and Bun both ignore
265
- those overrides and publish the development paths. That one is a pnpm extension rather
266
- than a bug in the other two, but the effect on the release is the same.
209
+ npm because of provenance. The signed attestation behind the "Built and signed on GitHub
210
+ Actions" badge is minted by the npm CLI talking to Sigstore, and trusted publishing, which
211
+ removes the long-lived token entirely, is npm's own exchange with the registry. No other
212
+ client does either one. `npm publish` also takes a tarball directly, which is what the
213
+ packing step already produced.
267
214
 
268
- Everything else we compared came out identical: file modes including the executable bit on
269
- `bin`, negated `files` patterns, dropped symlinks, prerelease versions, pinned
270
- `workspace:1.2.3` ranges, named catalogs, and refusing a catalog entry that doesn't exist.
215
+ The measurements behind both choices, and the one thing packing with pnpm costs you, are
216
+ in [why pnpm packs and npm publishes](docs/why-pnpm-and-npm.md).
271
217
 
272
218
  ### Why the manifest is cleaned on a copy
273
219
 
274
- The tarball gets extracted into a temp directory and rewritten there. Your working tree
275
- is never touched.
220
+ The manifest is read out of the packed tarball and written back into a copy of it, in a
221
+ temp directory. Your working tree is never touched.
276
222
 
277
223
  The obvious alternative is what a lot of hand-rolled release scripts do: edit
278
224
  `package.json`, publish, edit it back. That's fine until something dies in the middle,
@@ -294,63 +240,54 @@ then has nothing left to select with, falls back to your `.gitignore`/`.npmignor
294
240
  exclusion, and quietly drops files the first pack included. A package shipping a
295
241
  `.gitignore` that excludes any other shipped file loses it.
296
242
 
297
- Editing avoids the whole question. Only the `package/package.json` member is replaced;
298
- every other entry is copied without being decoded, so the file set stays exactly what pnpm
299
- chose and entry shapes this tool does not model (pax headers for long paths, prefix
300
- splitting) pass through untouched. It also keeps pnpm's normalised metadata — owner `0:0`,
301
- a fixed timestamp, mode 644 — which a plain `tar` invocation would replace with the build
302
- machine's own user and group names.
243
+ Editing avoids the question. Only the `package/package.json` member is replaced. Every
244
+ other entry is copied without being decoded, so the file set stays exactly what pnpm chose,
245
+ and entry shapes this tool does not model (pax headers for long paths, prefix splitting)
246
+ pass through untouched. It also keeps pnpm's normalised metadata: owner `0:0`, a fixed
247
+ timestamp, mode 644. A plain `tar` invocation would replace those with whatever the build
248
+ machine happens to have.
303
249
 
304
250
  Lifecycle scripts run once, at the first pack. `pnpm pack` runs your `prepare` and
305
251
  `prepack`, which is how build output reaches the package at all. Nothing runs afterwards:
306
252
  npm skips `prepack`/`postpack` when it is handed a tarball rather than a directory, so
307
253
  nothing can alter the artifact after it was checked.
308
254
 
309
- ### Why npm does the publishing
310
-
311
- Provenance is an npm feature. The signed attestation behind the "Built and signed on
312
- GitHub Actions" badge is minted by the npm CLI talking to Sigstore, and trusted
313
- publishing, which removes the long-lived token entirely, is npm's own OIDC exchange with
314
- the registry.
315
-
316
- No other client mints it. `bun publish` offers `--access`, `--tag`, `--otp` and
317
- `--auth-type`, and nothing at all for provenance or attestation, so publishing through it
318
- would cost both the badge and the tokenless path. That trade isn't on the table here:
319
- verifiable provenance is why this package exists.
320
-
321
- `npm publish` also takes a tarball directly, which is exactly what the previous step
322
- produced.
323
-
324
255
  ## What it checks
325
256
 
326
- `publish-clean` refuses to continue when:
327
-
328
- - the package is `private: true`
329
- - the source package has uncommitted changes, unless disabled
330
- - the package has no non-empty `files` array, unless disabled
331
- - the tarball contains critical leaks like `.env`, `.npmrc`, `.git`,
332
- `node_modules`, or private-key files
333
- - dependency specs still use `catalog:`, `workspace:`, `link:`, or `portal:`
334
- - declared export, type, import, browser, bin, or side-effect paths are missing
335
- from the cleaned package
336
- - the final npm tarball drops files that were present in the cleaned package
337
- - trusted GitHub publication uses `--provenance` but package repository metadata
338
- does not match the workflow repository
339
-
340
- It warns, without stopping, when it was started by npm, Yarn or Bun rather than pnpm.
341
- The packing still goes through pnpm, but the warning is there because the rest of your
342
- release probably should too.
343
-
344
- Leak checks cannot be turned off by any flag or config key.
257
+ `publish-clean` stops, and publishes nothing, when:
258
+
259
+ - the package is marked `private: true`
260
+ - the working tree has uncommitted changes (`--no-git-checks` to allow it)
261
+ - the package has no non-empty `files` array (`--skip-file-check` to allow it)
262
+ - the tarball holds tests, CI config, a lockfile or a `tsconfig` (`--allow-suspicious` to
263
+ allow it — a separate switch from the one above, so waiving a manifest convention never
264
+ silently disarms the artifact scan)
265
+ - the tarball holds something that should never ship: a `.env`, an `.npmrc`, `.git`,
266
+ `node_modules`, or a private key. This one has no off switch, by any flag or config key
267
+ - a dependency is still written as `catalog:`, `workspace:`, `link:` or `portal:`, which
268
+ nobody outside your repo can install
269
+ - the manifest points `exports`, `types`, `main`, `browser`, `bin` or `sideEffects` at a
270
+ path that is not in the tarball
271
+ - rewriting the manifest changed anything else in the tarball
272
+ - you asked for `--provenance` from GitHub Actions, but the `repository` in your manifest
273
+ is not the repository the workflow is running in
274
+
275
+ It warns, without stopping, when it was started by npm, Yarn or Bun rather than pnpm. The
276
+ packing still goes through pnpm, but the warning is there because the rest of your release
277
+ probably should too.
345
278
 
346
279
  ## What the cleaned manifest keeps
347
280
 
348
281
  Everything a consumer or a registry reads survives: `name`, `version`, `license`,
349
282
  `dependencies`, `peerDependencies` and their meta, `exports`, `main`, `module`, `types`,
350
- `bin`, `files`, `engines`, `os`, `cpu`, `sideEffects`, `publishConfig`, and the rest of
351
- the public surface.
283
+ `bin`, `engines`, `os`, `cpu`, `sideEffects`, `publishConfig`, and the rest of the public
284
+ surface.
352
285
 
353
- What goes: `devDependencies`, `workspaces`, `pnpm`, `packageManager`, `overrides`,
286
+ `files` goes, because it is spent: it told the packer what to include, the tarball already
287
+ exists, nothing re-selects afterwards, and an install extracts every entry unfiltered. npm
288
+ agrees — its registry drops the field from the metadata it serves.
289
+
290
+ What else goes: `devDependencies`, `workspaces`, `pnpm`, `packageManager`, `overrides`,
354
291
  `resolutions`, and the config blocks belonging to test runners, linters, formatters,
355
292
  coverage tools, build systems and release tools. Scripts go too, apart from the install
356
293
  lifecycle ones a consumer actually runs: `preinstall`, `install`, `postinstall`,
@@ -374,40 +311,21 @@ hear about it from a stranger's broken build rather than from your own release.
374
311
  Add your own with `devFields`. Better still, run `--dry-run` and read the manifest that
375
312
  would ship instead of trusting this list.
376
313
 
377
- ## Options
314
+ ## Options and config
378
315
 
379
316
  ```bash
380
317
  publish-clean [options] [package-dir] [-- npm-publish-args]
381
318
  ```
382
319
 
383
- - `--dry-run`: pack, check, clean, and print the cleaned package and final
384
- tarball paths.
385
- - `--guard-only`: run the full pack, clean, and final-tarball guard without
386
- publishing.
387
- - `--registry URL`: set `publishConfig.registry` on the cleaned manifest.
388
- - `--skip-file-check`: skip suspicious-file checks and the required `files`
389
- array check. Critical leak checks still run.
390
- - `--no-git-checks`: skip the source git cleanliness check.
391
- - `--tarball-out DIR`: copy the final tarball into `DIR` before publishing. The bytes
392
- kept are the ones that were published, so a release pipeline can attach them to a
393
- GitHub Release or sign them with build-provenance attestation.
394
- - `-h`, `--help`: print usage.
395
-
396
- Arguments after `--` go to `npm publish`, which publishes the final cleaned
397
- tarball.
398
-
399
- Pass the npm dist-tag explicitly. For normal public releases, use
400
- `--tag latest`.
401
-
402
- ## Package config
403
-
404
- Stable project defaults can live in `package.json`:
320
+ Most settings can be a flag or a `package.json` key. Flags win, so keep per-release
321
+ choices like dist-tags on the command line and stable project policy in the manifest:
405
322
 
406
323
  ```json
407
324
  {
408
325
  "publish-clean": {
409
326
  "registry": "https://registry.npmjs.org",
410
327
  "skipFileCheck": false,
328
+ "allowSuspicious": false,
411
329
  "noGitChecks": false,
412
330
  "devFields": ["customBuildOnlyField"],
413
331
  "keepFields": ["contributes"]
@@ -415,35 +333,54 @@ Stable project defaults can live in `package.json`:
415
333
  }
416
334
  ```
417
335
 
418
- `registry` is written as `publishConfig.registry` on the cleaned manifest and passed to
419
- `npm publish`, so the package cannot end up on whatever registry the machine happens to
420
- be pointed at.
336
+ | Flag | `package.json` | What it does |
337
+ | -------------------- | ----------------- | ------------------------------------------------------------------------------------------ |
338
+ | `--dry-run` | - | Run everything up to the publish, then print the file list and the cleaned `package.json`. |
339
+ | `--guard-only` | - | Run everything up to the publish and exit, printing nothing. |
340
+ | `--tarball-out DIR` | - | Copy the final tarball into `DIR` before publishing. |
341
+ | `--registry URL` | `registry` | Set `publishConfig.registry` on the cleaned manifest, and publish to it. |
342
+ | `--skip-file-check` | `skipFileCheck` | Allow a manifest with no `files` array. |
343
+ | `--allow-suspicious` | `allowSuspicious` | Allow tests, CI config, lockfiles or `tsconfig` in the artifact. |
344
+ | `--no-git-checks` | `noGitChecks` | Allow publishing from a dirty working tree. |
345
+ | - | `devFields` | Extra manifest fields to strip. |
346
+ | - | `keepFields` | Fields that belong in the published package, so stop reporting them. |
347
+ | `-h`, `--help` | - | Print usage, every flag, and the config keys. |
348
+ | `-v`, `--version` | - | Print the installed version. |
349
+
350
+ Arguments after `--` go to `npm publish`. Pass the dist-tag explicitly: `--tag latest` for
351
+ a normal public release.
421
352
 
422
- `skipFileCheck` drops the suspicious-file check and the requirement for a `files` array.
423
- Leak checks keep running; those cannot be turned off.
353
+ A few of these deserve a sentence more.
424
354
 
425
- `noGitChecks` allows publishing from a dirty working tree. You need it when you publish
426
- from a build directory or a checkout that is not a git repository.
355
+ `--tarball-out` keeps the bytes that were published, so a release pipeline can attach them
356
+ to a GitHub Release or sign them with build-provenance attestation. The copy happens in
357
+ every mode, before the publish, so you get the validated artifact even if the upload fails.
427
358
 
428
- `devFields` lists extra manifest fields to strip, for tooling this package has not heard
429
- of. Fields that npm or your consumers actually use, like `exports`, `bin`, `engines` and
430
- the dependency maps, are rejected here, so a typo cannot quietly break your package.
359
+ `registry` pins where the package goes, so it cannot end up on whatever registry the
360
+ machine happens to be pointed at.
431
361
 
432
- `keepFields` is the other answer to the same report: the field belongs in the published
433
- package, stop mentioning it. A VS Code extension needs `contributes` and `publisher` in
434
- the artifact to work, and no generic publishing tool is ever going to know that.
362
+ `skipFileCheck` and `allowSuspicious` are deliberately two switches. A missing `files`
363
+ array is a manifest convention some packages do not follow; tests or a lockfile in the
364
+ tarball is content nobody meant to ship. Neither touches the leak checks, which have no
365
+ off switch at all.
435
366
 
436
- Command-line flags override this block. Keep per-release choices such as dist-tags on the
437
- command line.
367
+ `noGitChecks` is what you need when you publish from a build directory, or from a checkout
368
+ that is not a git repository at all.
369
+
370
+ `devFields` refuses fields that npm or your consumers actually read, like `exports`, `bin`,
371
+ `engines` and the dependency maps, so a typo cannot quietly break your package.
372
+
373
+ `keepFields` answers the unrecognised-field report the other way: the field belongs in the
374
+ published package, stop mentioning it. A VS Code extension needs `contributes` and
375
+ `publisher` in the artifact to work, and no generic publishing tool is ever going to know
376
+ that.
438
377
 
439
378
  ## What it does not do
440
379
 
441
380
  It isn't a release manager. It won't pick your version number, write a changelog, tag
442
- anything, push a commit, create a GitHub release, or set up trusted publishing for you.
443
- It also doesn't check that your entry points resolve correctly for consumers, which is
444
- what `publint` and `@arethetypeswrong/cli` are for.
445
-
446
- Pick a release manager and a validator to go with it. The next section covers which.
381
+ anything, push a commit, create a GitHub release, or set up trusted publishing for you. It
382
+ also doesn't check that your entry points resolve correctly for consumers. Pair it with a
383
+ release manager and a validator; the next section names them.
447
384
 
448
385
  It can't publish a package that uses `bundleDependencies`. pnpm links dependencies rather
449
386
  than copying them, so it has nothing to bundle and refuses:
@@ -454,9 +391,7 @@ Add "nodeLinker: hoisted" to pnpm-workspace.yaml or delete bundleDependencies
454
391
 
455
392
  Doing what it says makes the package publishable again. This is the one thing you give up
456
393
  by packing with pnpm, and it's a fair trade: `bundleDependencies` is rare, and the failure
457
- is loud and tells you the fix. npm and Bun bundle correctly for a standalone package, and
458
- neither bundles anything for a package inside a workspace, because the dependency hoists
459
- to the workspace root where the package can't see it.
394
+ is loud and tells you the fix.
460
395
 
461
396
  ## How it compares
462
397