dsh-plugin-toolkit 0.20.35 → 0.20.36

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 0.20.36
2
+
3
+ - **`audit --remote` no longer reads an arbitrary `build` script as a pre-pack
4
+ hook.** The remote audit skipped the patch, client and root-export file
5
+ checks whenever `scripts` had a `build` entry, but npm never runs a plain
6
+ `build` script during `npm pack`; only its lifecycle hooks do. A repository
7
+ whose only hook was `scripts.build` therefore passed with no `client.js` in
8
+ the tree even though the tarball contained no bundle either. Build evidence
9
+ now comes only from `prepack` and `prepare` (which run for `npm pack`) and
10
+ `prepublishOnly` (which runs before `npm publish` packs), and an empty hook
11
+ is not evidence. `test/audit-remote-build-hooks.test.mjs` crosses both
12
+ process boundaries: it asks npm what three build-only fixtures actually
13
+ ship, runs the shipped CLI against the same committed tree, and requires exit
14
+ `1` with a failure naming `client.js`; each fixture's `build` script would
15
+ create the client if npm ran it, so the test also proves `npm pack` leaves it
16
+ alone. A `prepack` fixture and a `prepare` fixture that create the file in
17
+ the tarball still exit `0` with the skipped-files note, and a committed
18
+ client beside a `build` script stays clean without the built note. The
19
+ README and `docs/repair.md` state the same rule.
20
+
1
21
  ## 0.20.35
2
22
 
3
23
  - **The compatibility answer now has a reproducible machine-readable form.**
package/README.md CHANGED
@@ -435,10 +435,13 @@ What it can see, and what it cannot:
435
435
  declares. A repository whose checkout fails `readme` fails the remote check
436
436
  too, with the same sentence.
437
437
  - File checks (does `exports["./client"]` point at a file that exists, does the
438
- root export `apply`) need the tree. A package that runs `prepack`,
439
- `prepublishOnly`, `prepare` or `build` publishes files it does not commit, so
440
- those checks are **skipped with a note** instead of calling a working plugin
441
- broken.
438
+ root export `apply`) need the tree. npm runs `prepack` and `prepare` before
439
+ `npm pack` creates the tarball, and `prepublishOnly` before `npm publish`
440
+ does, so a package whose lifecycle hook builds those files publishes files it
441
+ does not commit: those checks are **skipped with a note** instead of calling a
442
+ working plugin broken. A plain `build` script is not a lifecycle hook and is
443
+ not evidence by itself, because npm never runs it unless `prepack` or
444
+ `prepare` calls it; put the build there if it produces shipped files.
442
445
  - Public repositories work anonymously, but GitHub allows 60 requests an hour.
443
446
  Export `GH_TOKEN` (or `GITHUB_TOKEN`) to audit more than one or two.
444
447
 
package/lib/benchmark.mjs CHANGED
@@ -34,7 +34,7 @@ const MANIFEST = {
34
34
  name: 'benchmark-plugin',
35
35
  version: '1.2.3',
36
36
  main: 'index.js',
37
- scripts: { build: 'node build.mjs' },
37
+ scripts: { prepack: 'node build.mjs' },
38
38
  engines: { dsh: '>=0.2.0' },
39
39
  dsh: { bundle: { patch: 'cordis.patch.yml' }, client: { platform: 'web' } },
40
40
  exports: { '.': './index.js', './client': './client.js' },
package/lib/remote.mjs CHANGED
@@ -400,8 +400,17 @@ export async function auditRemote(
400
400
  // tarball will contain: `lib/` is output, not source. Asking GitHub whether
401
401
  // those paths exist would call a working plugin broken, so the file-level
402
402
  // checks are reported as skipped instead of failed.
403
- const BUILD_HOOKS = ['prepack', 'prepublishOnly', 'prepare', 'build'];
404
- const builds = BUILD_HOOKS.filter((hook) => typeof manifest.scripts?.[hook] === 'string');
403
+ //
404
+ // Only npm's own lifecycle hooks are evidence. `prepack` and `prepare` run
405
+ // during `npm pack`, and `prepublishOnly` runs before `npm publish` creates
406
+ // its tarball. A plain `build` script is not a lifecycle hook: npm never runs
407
+ // it unless one of those hooks (or a person) calls it, so a repository whose
408
+ // only script is `scripts.build` ships exactly what is committed.
409
+ const BUILD_HOOKS = ['prepack', 'prepublishOnly', 'prepare'];
410
+ const builds = BUILD_HOOKS.filter((hook) => {
411
+ const script = manifest.scripts?.[hook];
412
+ return typeof script === 'string' && script.trim() !== '';
413
+ });
405
414
  const built = builds.length > 0;
406
415
 
407
416
  // `engines.dsh` deserves the wording the installer actually uses: a host that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-toolkit",
3
- "version": "0.20.35",
3
+ "version": "0.20.36",
4
4
  "description": "Preflight, release and test DeepSeek Harness plugins: check a folder or any GitHub repository, wait for npm to actually serve the version, and keep the market index honest.",
5
5
  "type": "module",
6
6
  "bin": {