Skip to content

migrate docs package manager from npm to pnpm#1301

Merged
kotAPI merged 11 commits intorad-ui:mainfrom
segundavid-dev:migrate-pnpm
Aug 7, 2025
Merged

migrate docs package manager from npm to pnpm#1301
kotAPI merged 11 commits intorad-ui:mainfrom
segundavid-dev:migrate-pnpm

Conversation

@segundavid-dev
Copy link
Copy Markdown
Contributor

@segundavid-dev segundavid-dev commented Aug 5, 2025

Please go through this and help me confirm there's no issue on your end. I ran it locally and it worked though

Summary by CodeRabbit

  • Chores
    • Enforced pnpm as the package manager during installation.
    • Updated the update script to use pnpm for the latest UI package installation.
    • Added workspace configuration to define specific built dependencies.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 5, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • docs/package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes update the docs/package.json scripts to enforce the use of pnpm as the package manager and switch the "update-rad" script from npm to pnpm. Additionally, a new pnpm-workspace.yaml file is introduced to specify @vercel/speed-insights and sharp as built dependencies within the workspace.

Changes

Cohort / File(s) Change Summary
Package Manager Enforcement & Script Update
docs/package.json
Added a "preinstall" script to require pnpm via npx only-allow pnpm and updated "update-rad" to use pnpm instead of npm.
Workspace Dependency Configuration
docs/pnpm-workspace.yaml
Added new YAML file specifying @vercel/speed-insights and sharp as the only built dependencies.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • kotAPI

Poem

A bunny hopped with gentle cheer,
To tidy scripts and make it clear:
"Use pnpm!" the preinstall cries,
And workspace rules now organize.
With built deps set and scripts anew,
The docs hop forward—thanks to you!
🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/package.json (2)

10-11: Prefer the built-in packageManager field over the preinstall guard

"preinstall": "npx only-allow pnpm" works, but pnpm can be enforced more robustly (and without an extra network call) by adding the packageManager metadata that Node ≥16.9 and Corepack understand:

   "private": true,
   "scripts": {
@@
-    "update-rad": "pnpm i @radui/ui@latest",
-    "preinstall": "npx only-allow pnpm"
+    "update-rad": "pnpm i @radui/ui@latest"
   },
+  "packageManager": "pnpm@8.15.0",

This:

• stops installs early when another package manager is used,
• avoids the extra npx invocation, and
• makes the expected pnpm version explicit and reproducible.

If you keep the preinstall hook, consider switching to pnpm dlx only-allow pnpm so it also works in environments where npm/npx is not present.


10-10: Use pnpm up --latest instead of pnpm i for upgrading

pnpm i @radui/ui@latest rewrites package.json and may reinstall node-modules unnecessarily.
A cleaner upgrade path is:

-    "update-rad": "pnpm i @radui/ui@latest",
+    "update-rad": "pnpm up --latest @radui/ui",

pnpm up updates the declared version and respects workspace ranges without doing a full reinstall, which is quicker and keeps lockfiles tidy.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f089588 and 129463f.

⛔ Files ignored due to path filters (2)
  • docs/package-lock.json is excluded by !**/package-lock.json
  • docs/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • docs/package.json (2 hunks)
  • docs/pnpm-workspace.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.
📚 Learning: in npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their co...
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.

Applied to files:

  • docs/package.json
📚 Learning: in the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and...
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.

Applied to files:

  • docs/package.json
🔇 Additional comments (1)
docs/pnpm-workspace.yaml (1)

1-3: Confirm workspace file placement

pnpm-workspace.yaml must live at the workspace root that pnpm is executed from.
Placing it inside docs/ only works if all pnpm commands are run from that folder; otherwise the file will be ignored and onlyBuiltDependencies won’t apply.

Please verify CI/dev workflows and move the file to the repository root (or adjust working directories) if needed.

Comment thread docs/pnpm-workspace.yaml
@@ -0,0 +1,3 @@
onlyBuiltDependencies:
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.

sorry not sure what this file does, i'm also new to pnpm way of doing things - what does this file mean?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was auto-generated by pnpm, It ignores install/postinstall scripts by default as a security measure. I believe these packages have scripts to run during installation. Pnpm ignores these unless explicitly approving of them which i approved. That was why the file was generated.

Comment thread docs/package.json
"lint": "next lint --fix",
"update-rad": "npm i @radui/ui@latest"
"update-rad": "pnpm i @radui/ui@latest",
"preinstall": "npx only-allow pnpm"
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.

where does this script run?

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.

and where do you think this might help us?

Copy link
Copy Markdown
Contributor Author

@segundavid-dev segundavid-dev Aug 6, 2025

Choose a reason for hiding this comment

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

The preinstall script is to ensure that only pnpm is used to install dependencies and i had to update the "update-rad" npm prefix to pnpm to install the radui package when that "update-rad" script is run

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.

got it

@kotAPI
Copy link
Copy Markdown
Collaborator

kotAPI commented Aug 6, 2025

Looks mostly good! Not seeing any issues - left some comments

@kotAPI
Copy link
Copy Markdown
Collaborator

kotAPI commented Aug 6, 2025

You can resolve the merge conflicts and its good to go @segundavid-dev

@segundavid-dev segundavid-dev force-pushed the migrate-pnpm branch 2 times, most recently from b22bcc1 to 37ce92b Compare August 6, 2025 11:40
@kotAPI
Copy link
Copy Markdown
Collaborator

kotAPI commented Aug 6, 2025

why close?

@segundavid-dev
Copy link
Copy Markdown
Contributor Author

why close?

I am trying to fix the merge conflict, i will reopen after fixing
I've been on it since, can't quite understand the problem yet

@segundavid-dev segundavid-dev reopened this Aug 6, 2025
@segundavid-dev
Copy link
Copy Markdown
Contributor Author

@kotAPI Merge conflict fixed

@kotAPI
Copy link
Copy Markdown
Collaborator

kotAPI commented Aug 7, 2025

Merging, will test this out soon and let you know how it goes!

@kotAPI kotAPI merged commit 4cae125 into rad-ui:main Aug 7, 2025
3 checks passed
@segundavid-dev segundavid-dev deleted the migrate-pnpm branch August 7, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants