Repository navigation
fix(cli): drop the never-produced dist/index.cjs requirement from prepublish's opencode-plugin skip check (#11787) - #11990
Merged
diegosouzapw merged 2 commits intoAug 29, 2026
Conversation
…publish's opencode-plugin skip check (#11787)
…instead of a hardcoded .bin path The old test assumed @omniroute/opencode-plugin/node_modules/.bin/tsup already existed. A fresh checkout (CI's npm ci never installs this standalone package's own deps) has no such node_modules at all, so the test failed with MODULE_NOT_FOUND in CI while passing locally on a devbox that had installed it before. Mirror scripts/build/prepublish.ts's own install-then-resolveLocalBinEntry approach.
This was referenced Sep 7, 2026
Merged
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…publish's opencode-plugin skip check (diegosouzapw#11787) (diegosouzapw#11990) * fix(cli): drop the never-produced dist/index.cjs requirement from prepublish's opencode-plugin skip check (diegosouzapw#11787) * test(build): resolve tsup/npm portably in the diegosouzapw#11787 regression test instead of a hardcoded .bin path The old test assumed @omniroute/opencode-plugin/node_modules/.bin/tsup already existed. A fresh checkout (CI's npm ci never installs this standalone package's own deps) has no such node_modules at all, so the test failed with MODULE_NOT_FOUND in CI while passing locally on a devbox that had installed it before. Mirror scripts/build/prepublish.ts's own install-then-resolveLocalBinEntry approach. --------- Co-authored-by: Markus Hartung <mail@hartmark.se>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11787
Root cause
scripts/build/prepublish.ts(Step 8.8) gated the "@omniroute/opencode-plugin already built → skip rebuild" fast path on bothdist/index.jsanddist/index.cjsexisting.@omniroute/opencode-plugin/tsup.config.tsusesformat: ["esm"]only (andpackage.jsonis"type": "module"with anexportsmap exposing only"import", no"require"), so a successfultsuprun in that package can never producedist/index.cjs. ThepluginAlreadyBuiltcheck was therefore permanentlyfalse, and everynpm run build:cli/ prepublish run re-installed and rebuilt the plugin even when its ESM-onlydist/was already correctly built.Fix
Drop the
dist/index.cjsrequirement —pluginAlreadyBuiltis nowexistsSync(opencodePluginDist)(index.js) alone, matching what the ESM-only tsup config actually emits. Removed the now-unusedopencodePluginCjsbinding.Regression test
tests/unit/prepublish-opencode-plugin-build-skip.test.ts— builds the real plugin package with the real tsup config (no mocks), confirmsdist/index.cjsis never produced, and asserts the fixed predicate correctly reports "already built" whendist/index.jsis present and "needs rebuild" whendist/is absent.Fail → pass: before the fix, the equivalent predicate (
existsSync(index.js) && existsSync(index.cjs)) assertedfalse !== trueagainst a real ESM-only tsup build output; after the fix, both test cases pass.Gates run (all green)
node --import tsx/esm --test tests/unit/prepublish-opencode-plugin-build-skip.test.ts— 2/2 passnode --import tsx/esm --test tests/unit/opencode-plugin-parses.test.ts— pass (sibling plugin test)node scripts/check/check-file-size.mjs— OKnode scripts/check/check-complexity.mjs— OK (2672 violations, baseline 2774)node scripts/check/check-cognitive-complexity.mjs— OK (1192 violations, baseline 1223)node scripts/check/check-changelog-integrity.mjs— OKnpm run typecheck:core— exit 0npx eslint --suppressions-location config/quality/eslint-suppressions.json scripts/build/prepublish.ts tests/unit/prepublish-opencode-plugin-build-skip.test.ts— exit 0 (0 errors)Diff is scoped to
scripts/build/prepublish.ts(one predicate + comment), the new test, and the changelog fragment — no drive-by changes.