Skip to content

Check @geastack dependency ranges before publishing - #5

Merged
dashersw merged 2 commits into
geastack:mainfrom
moersoy:fix/publish-dependency-check
Oct 16, 2026
Merged

dashersw merged 2 commits into
geastack:mainfrom
moersoy:fix/publish-dependency-check

Conversation

@moersoy

@moersoy moersoy commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Problem

CLI 0.1.97 requires @geastack/targets ^0.1.97, but the newest version on npm is 0.1.95. The targets repo is not checked out under the collection root, so scripts/publish-private-packages.mjs found only cli and would have published it with a dependency nobody can install.

Change

Before anything is published, and also under --plan and --dry-run, every @geastack/* range in a selected package's dependencies and optionalDependencies
must be met in one of two ways:

  1. Same publish: a package in this run has a local version that satisfies the range (^, ~, exact, >=). It is published first because of the existing dependency order. npm is not queried.
  2. Already on npm: npm view <name>@<range> version finds a match. npm resolves the range itself, so no new dependency was added.

If neither holds, the script stops and nothing is published. The error says which case applies:

  • the dependency is in this publish but at a version that does not match
  • it was found locally but left out by --package / --from
  • it has no checkout under the collection root

An npm query that fails for any other reason, such as a timeout, also stops the publish.

  • --skip-dep-check skips the check.
  • peerDependencies are not checked, matching how they are left out of the publish order.

Example against the current collection root:

error: unresolved @geastack dependencies:
  - @geastack/cli@0.1.97 needs @geastack/targets@^0.1.97
      npm has no version matching ^0.1.97 (latest: 0.1.95)
      @geastack/targets is not in this publish (no checkout under /Users/moe/Workspaces; pass --root or publish it first)
pass --skip-dep-check to publish anyway

Testing

  • node --test test/publish-private-packages.test.mjs: 12/12 pass. The 9 new tests cover a range that resolves nowhere (in both --yes and --plan), a same-publish version that matches and one that does not, a dependency left out by --package, a range already on npm, an npm query failure, --skip-dep-check, and caret/tilde/exact semantics including 0.x and prereleases.
  • The full npm test has unrelated failures in this checkout because node_modules
    is not installed (Cannot find package '@clack/prompts').

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23ad1856-cc1a-4ea5-94d6-1cf0afb1a0a8
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA.
Posted by the CLA Assistant Lite bot.

@moersoy

moersoy commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

CLI 0.1.97 requires @geastack/targets ^0.1.97, but npm only had 0.1.95. The
targets repo was not checked out under the collection root, so the publish
script found only cli and would have published it with a dependency nobody
can install.

Before anything is published, and also under --plan and --dry-run, every
@geastack range in a selected package's dependencies and optionalDependencies
must now be met. Either a package in the same publish has a local version that
satisfies the range, or `npm view <name>@<range>` finds a match. Otherwise the
script stops without publishing. The error says whether the dependency is in
this publish with the wrong version, left out by --package/--from, or has no
checkout at all. An npm query that fails for another reason, such as a timeout,
also stops the publish. --skip-dep-check skips the check. peerDependencies are
not checked, matching how they are left out of the publish order.

publish-private-packages tests pass (12/12). Against the real collection root,
--plan now reports the missing targets ^0.1.97.
@moersoy
moersoy force-pushed the fix/publish-dependency-check branch from 76bf40d to 10e3ff1 Compare October 16, 2026 17:19
The CLI depends on @geastack/debugger, but the publish script did not look in
the debugger repo, so the debugger was released by hand and could fall behind
the range the CLI needs. It is now in the default repo list, ahead of cli, and
the publish order puts it before the CLI.
@dashersw
dashersw merged commit 088b68b into geastack:main Oct 16, 2026
2 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants