Skip to content

feat(create-docusaurus): add nub package manager support - #12309

Draft
colinhacks wants to merge 5 commits into
facebook:mainfrom
colinhacks:create-docusaurus-nub-support
Draft

feat(create-docusaurus): add nub package manager support#12309
colinhacks wants to merge 5 commits into
facebook:mainfrom
colinhacks:create-docusaurus-nub-support

Conversation

@colinhacks

Copy link
Copy Markdown
Contributor

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Adds nub as a selectable package manager in create-docusaurus, alongside npm/yarn/pnpm/bun. nub is pnpm-CLI-compatible and writes a nub.lock lockfile.

  • constants.ts — add nub: 'nub.lock' to LockfileNames. Everything else derives from this map: lockfile detection, the --package-manager nub flag, the interactive prompt, and the PackageManager type all pick nub up automatically.
  • utils.ts — the script tips relied on npm/yarn/pnpm/bun's implicit start shortcut (e.g. pnpm start). nub has no implicit script shortcut — nub start is an error — so every tip for nub is explicit: nub run start, nub run build, and so on. The run-prefix logic moved into a small packageManagerScriptCommand helper; output for the existing package managers is unchanged.
  • commands.ts — nub uses the bun-style nub install and colors from the terminal / FORCE_COLOR; it does not accept the space-separated --color always form the generic branch passes.

Test Plan

  • Added unit tests for packageManagerScriptCommand: nub gets an explicit run on every script; npm/bun keep start bare but prefix run elsewhere; yarn/pnpm never prefix run.
  • Verified against nub 0.4.13: nub.lock lockfile detection, user-agent detection (npm_config_user_agent is nub/0.4.13 npm/? node/…, matched by the existing startsWith), nub --version for the availability prompt, nub install succeeds, and nub install --color always fails (the reason for the bun-style branch).

Copilot AI review requested due to automatic review settings July 22, 2026 22:16
@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jul 22, 2026

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.

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit fb25e3c
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a6409a470ef9e0008607208
😎 Deploy Preview https://deploy-preview-12309--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@slorber slorber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good start but there are many other places that need to be modified in this CLI to properly bring support (types, cli help option description, our docs and maybe more)

Also you may want to add nub as an option in our docs tabs, and for that you need a PR in npm-to-yarn converters first, see for example Deno recently added: bgub/npm-to-yarn#68

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Jul 23, 2026
@slorber
slorber marked this pull request as draft July 23, 2026 10:15
@colinhacks

Copy link
Copy Markdown
Contributor Author

Thanks! Addressed:

  • CLI help + docs: the --package-manager help text (bin/index.js) and the create-docusaurus API reference now list nub.
  • Types: PackageManager is derived from LockfileNames (which this PR extends), so nub is already first-class across the type, validation, prompt, and detection — those two enumerations were the only remaining spots.
  • Docs tabs: opened feat: add nub support bgub/npm-to-yarn#69 adding nub (mirroring the recent Deno addition). Once it's released and picked up here, I'll add the nub npm2yarn tab.

Let me know if anything else is missing.

@colinhacks
colinhacks force-pushed the create-docusaurus-nub-support branch from 2336df8 to fb25e3c Compare July 25, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants