chore: run publint before publishing packages - #2906
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a pinned Publint validation gate before npm and pkg.pr.new publishing, including support for packages published from configured directories.
Changes:
- Derives effective package publish paths.
- Runs lifecycle preparation and Publint validation.
- Publishes with scripts disabled after validation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Summary | Findings |
|---|---|---|
scripts/publish.ts |
Prepares, validates, and publishes npm packages. | Critical: the lifecycle invocation does not pass the package publish tag, causing prerelease publishing to fail before validation or publishing. |
scripts/publish-pkg-pr.ts |
Validates packages before pkg.pr.new publication. | No final comments. |
scripts/_utils.ts |
Adds publish-path metadata and Publint arguments. | No final comments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
ℹ️ No blocking issues — the publint gate is real and correctly wired (publint's CLI exits non-zero on error-level findings) and the sequencing is sound: explicit
prepublishOnlytransforms the artifact, publint validates it, thenpublish --ignore-scriptspublishes without re-running. A couple of rough edges worth a look are inline and below.
Reviewed changes
scripts/_utils.ts— adds pinnedPUBLINT_PACKAGE, reads each package'spublishConfig.directoryintoPackageInfo.publishPath, and exportsgetPublintArgs()which passes--pack=falsefor packages that publish from a subdirectory and the plain path for root-published ones.scripts/publish-pkg-pr.ts— after the existing sharedprepublishOnly --skip-publish-tag-checkbuild, runs publint once per package about to be published.scripts/publish.ts— in the per-package loop, explicitly runsprepublishOnly, then publint, thenpnpm publish --provenance --no-git-checks --ignore-scripts [--tag] [--dry-run].
ℹ️ The gate only hard-fails on error-level findings
publint v0.3.24's formatMessages sets process.exitCode = 1 only when errors.length > 0; warnings and suggestions print but do not fail the run (default --level suggestion). That satisfies the "run publint before publishing" goal, but it is weaker than the repo's own lint hygiene — oxlint is enforced with --max-warnings=0 elsewhere in this workspace. A package that ships with a warning (e.g. one missing type, a suggestion-level finding here) will still pass the gate. Confirm that error-only is the intended threshold, or the gate may not catch what you'd consider "dirty" packages.
Technical details
# Consider whether the publint gate should fail on warnings/suggestions ## Affected sites - scripts/publish.ts (per-package publint in the publish loop) - scripts/publish-pkg-pr.ts (per-package publint after the shared build) ## Required outcome - Decide and enforce the gate's intended strictness for the publish path. ## Suggested approach (optional) - Pass `--strict` so warnings escalate to errors. Note publint suggestions still won't fail a run even under `--strict`, so if a fully clean package is required, add an assertion on the message output.
ℹ️ Nitpicks
- Root-published packages (
eslint-plugin-typegpu,tgpu-gen,typegpu-cli,create-typegpu) flow through publint'sautopack; only@typegpu/color/dist(--pack=false) andcreate-typegpuwere exercised in the PR's verification list. The gate could newly fail on a previously-published package at release time — worth a one-time publint dry-run across the remaining public packages before merge.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Followed up on the non-blocking review items:
The prerelease tag issue from the earlier review is fixed in 0fb487f and its inline thread is resolved. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior Pullfrog review (ac48461), two commits landed:
scripts/publish.ts— preserve prerelease tag through the lifecycle. The per-packageenvnow setsnpm_config_tag: tag(for all but thelatesttag) and is threaded through both the explicitpnpm run prepublishOnlyand the finalpnpm publish, instead of the prior bare{ ...process.env, SKIP_TESTS: 'true' }. This resolves the blocked prerelease publish path:prepublishOnly'stgpu-dev-cli prepackcallsverifyPublishTag()(viaprepack.mjs:132), which readsprocess.env.npm_config_taginverify-publish-tag.mjs:15and throws when it doesn't match the version's prerelease tag. Before this fix, a prerelease package (e.g.0.1.0-alpha.1) would fail validation under the mismatched/undefined tag; now the explicit lifecycle step and the real publish share the same tag.latestcorrectly sets no tag and passes no--tag.scripts/publish— documented the lifecycle invariant. The new comment records thatprepublishOnlyis the only publish-time transform used by public packages, justifying--ignore-scriptson the publish step.
Verification: verifyPublishTag() reads npm.tags_tag/npm_config_tag and throws only when the version contains a prerelease marker that doesn't match. Setting the same tag in both the validation step and the publish call is consistent and resolves the sequencing concern raised earlier.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Summary
publishConfig.directorydistartifacts directly while letting root-published packages use their normal pack file list--ignore-scriptsso the gate sits before the irreversible publish stepFixes #2866
Verification
oxfmt --check scripts/_utils.ts scripts/publish.ts scripts/publish-pkg-pr.tsoxlint -c oxlint.config.ts --max-warnings=0 scripts/_utils.ts scripts/publish.ts scripts/publish-pkg-pr.tsSKIP_TESTS=true pnpm --filter @typegpu/color run prepublishOnly --skip-publish-tag-check@typegpu/color/dist(--pack=false)create-typegpu(normalpnpm pack)pnpm publish --ignore-scripts --dry-runfor both publish-directory and package-root flowsgit diff --check