Skip to content

Add nub to recognised package managers#14595

Merged
NuroDev merged 12 commits into
cloudflare:mainfrom
colinhacks:add-nub-package-manager
Jul 21, 2026
Merged

Add nub to recognised package managers#14595
NuroDev merged 12 commits into
cloudflare:mainfrom
colinhacks:add-nub-package-manager

Conversation

@colinhacks

@colinhacks colinhacks commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Sorry for the turnover here. Nub has now added its own nub.lock lockfile (was previously piggybacking on other lockfiles) so best practices for detection have changed. Thanks!


Adds a NubPackageManager descriptor to @cloudflare/workers-utils so projects managed by nub are recognised.

nub is a package manager with a pnpm-compatible CLI. Its lock file is nub.lock (pnpm-v9 lockfile format). The new descriptor lets lock-file-based detection identify a nub-managed project, alongside the existing npm/pnpm/yarn/bun entries.

The change is additive:

  • NubPackageManager in packages/workers-utils/src/package-manager.ts, mirroring the bun descriptor's shape (npx: "nubx", dlx: ["nubx"], lockFiles: ["nub.lock"]), with "nub" added to the PackageManager["type"] union.
  • Exported from the package's index.ts.
  • A test covering the descriptor and its lock-file detection.

Scoped to @cloudflare/workers-utils only.


Open in Devin Review

Add a NubPackageManager descriptor so projects with a nub.lock lock file are detected as nub-managed.
Copilot AI review requested due to automatic review settings July 8, 2026 03:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b1741c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@cloudflare/workers-utils Minor
@cloudflare/autoconfig Minor
wrangler Minor
@cloudflare/cli-shared-helpers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
@cloudflare/workers-auth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod
workers-devprod requested review from a team and edmundhung and removed request for a team July 8, 2026 03:29
@workers-devprod

workers-devprod commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/nub-package-manager.md: [@cloudflare/wrangler]
  • packages/cli/packages.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/index.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/package-manager.ts: [@cloudflare/wrangler]
  • packages/workers-utils/tests/package-manager.test.ts: [@cloudflare/wrangler]

devin-ai-integration[bot]

This comment was marked as resolved.

Per REVIEW.md, changesets target users rather than maintainers and should
avoid naming internal constructs. Drops the `NubPackageManager` descriptor
reference flagged in review.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 0 new potential issues.

Open in Devin Review

Adding one entry to the recognised-package-manager list is additive,
same scale as the D1-bindings validation changeset (cloudflare#14530), not a
headline feature on the order of cloudflare#14474 (cache options for
WorkerEntrypoint exports) — patch fits workers-utils' own convention
better than minor.
devin-ai-integration[bot]

This comment was marked as resolved.

Widening the shared PackageManager["type"] union to include "nub" left
the install helpers in @cloudflare/cli-shared-helpers narrowed to
npm/pnpm/yarn/bun, so passing packageManager.type into installWrangler
and installPackages failed to type-check (TS2345 at autoconfig
src/run.ts:182), breaking the workspace build and every downstream job.

Teach installPackages, getWorkspaceInstallRootFlag, and installWrangler
about nub, mirroring pnpm's CLI (nub is pnpm-CLI-compatible):
--workspace-root at the workspace root and --no-frozen-lockfile on a
full install.
@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14595

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14595

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14595

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14595

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14595

miniflare

npm i https://pkg.pr.new/miniflare@14595

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14595

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14595

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14595

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14595

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14595

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14595

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14595

wrangler

npm i https://pkg.pr.new/wrangler@14595

commit: b1741c0

@edmundhung

Copy link
Copy Markdown
Member

Hi @colinhacks. I see that you add Nub support to create-cloudflare in #14499, while this PR doesn't seem to change any user-facing behavior by itself. Can you help me understand the plan here and how these two PRs fit together?

…autoconfig nub.lock

The NubPackageManager descriptor was inert. Detect nub in wrangler from its
npm_config_user_agent (checked before npm, which nub's UA also contains) and an
installed nub binary; detect nub projects in autoconfig via nub.lock, since
@netlify/build-info doesn't recognise it.
@workers-devprod

workers-devprod commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/nub-package-manager.md: [@cloudflare/wrangler]
  • packages/autoconfig/src/details/framework-detection.ts: [@cloudflare/wrangler]
  • packages/autoconfig/tests/details/framework-detection/package-manager-detection.test.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/index.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/package-manager.ts: [@cloudflare/wrangler]
  • packages/workers-utils/tests/package-manager.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/package-manager.ts: [@cloudflare/wrangler]

@colinhacks

Copy link
Copy Markdown
Contributor Author

Re: #14499 — Oops, you're right. The descriptor on its own didn't change any behaviour. The two PRs cover different detection paths:

  • feat(create-cloudflare): detect nub package manager #14499 handles invocation-time detection in create-cloudflare: when C3 is run through nub, which-pm-runs reports nub and C3 emits nub commands.
  • This PR adds nub to the shared @cloudflare/workers-utils descriptors so the rest of the SDK can recognise a nub project.

I've now wired it in: wrangler detects nub via getPackageManager()/sniffUserAgent() the same way it does bun, and @cloudflare/autoconfig picks up nub projects by their nub.lock (since @netlify/build-info doesn't recognise it). The packages/cli/packages.ts edits overlap with #14499 and will drop out once that lands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

⚠️ 1 issue in files not directly in the diff

⚠️ Command suggestions show wrong executable name for nub users (packages/wrangler/src/deployment-bundle/entry.ts:205-213)

The npx-equivalent lookup falls through to the default case for the newly added "nub" agent (sniffUserAgent() at packages/wrangler/src/deployment-bundle/entry.ts:205), so nub users see suggestions using npx instead of nubx.

Impact: Users running nub as their package manager receive incorrect copy-paste command suggestions.

getNpxEquivalent does not handle the new "nub" return value from sniffUserAgent

The PR adds "nub" to the return type of sniffUserAgent() at packages/wrangler/src/package-manager.ts:127-133, but getNpxEquivalent() at packages/wrangler/src/deployment-bundle/entry.ts:204-214 only has cases for "pnpm", "yarn", and "npm". The "nub" value (and also "bun", pre-existing) falls through to default, returning "npx". For nub, the correct equivalent is "nubx" as defined in NubPackageManager.npx at packages/workers-utils/src/package-manager.ts:61.

View 1 additional finding in Devin Review.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread packages/autoconfig/src/details/framework-detection.ts Outdated
Comment thread .changeset/nub-package-manager.md Outdated
Comment thread packages/workers-utils/tests/package-manager.test.ts
@github-project-automation github-project-automation Bot moved this from Untriaged to In Review in workers-sdk Jul 15, 2026
…view

- packages/cli/packages.ts: drop the duplicate `case "nub"` left by merging
  main; the file now matches main's version from cloudflare#14499, resolving the
  no-duplicate-case lint error.
- autoconfig: move the nub.lock check into convertDetectedPackageManager,
  with a TODO to remove it once netlify/build#7124 (nub in
  @netlify/build-info) is merged and released.
- changeset: bump the affected packages minor instead of patch.
- tests: cover nub.lock absent and malformed lock file cases in
  workers-utils, and nub detection via detectFramework in autoconfig.
devin-ai-integration[bot]

This comment was marked as resolved.

@colinhacks

Copy link
Copy Markdown
Contributor Author

All addressed!

  • autoconfig: moved the nub.lock fallback into convertDetectedPackageManager with a TODO referencing feat: add nub package manager detection netlify/build#7124, so it drops out once @netlify/build-info detects nub natively.
  • changeset: bumped to minor.
  • tests: added no-nub.lock and corrupted-nub.lock cases.

Also removed a duplicate case "nub" in packages/cli/packages.ts that the #14499 merge left behind — that file now matches main.

devin-ai-integration[bot]

This comment was marked as resolved.

@NuroDev NuroDev added the ci:skip-pr-description-validation Skip validation of the required PR description format label Jul 16, 2026
@edmundhung
edmundhung requested review from NuroDev and removed request for edmundhung July 20, 2026 11:31
@workers-devprod

workers-devprod commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from In Review to Approved in workers-sdk Jul 21, 2026
@NuroDev
NuroDev merged commit 2b390d7 into cloudflare:main Jul 21, 2026
66 of 67 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:skip-pr-description-validation Skip validation of the required PR description format

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants