Skip to content

Conversation

@luisadame
Copy link

@luisadame luisadame commented Dec 18, 2025

Context

Allows changesets to be executed from deeply nested folders within a monorepo that has the .changeset folder at the root of it.

A common example of this is a monorepo with two packages: frontend and backend. These packages might have different scripts that people run within those folders. When they finish some piece of work, they have to change directories back to the root to create a changeset.

This change helps exactly with that, but also, with most of the changeset commands.

Implementation details

I've added a new package to determine the root of the project: @manypkg/find-root. This package gets dynamically imported when the current directory doesn't have a changeset folder. Then, it will try to determine if the root has a changeset folder or not. Otherwise the same behavior as always executes, which is throwing an error.

Questions/Unknowns

The new package is an ES module and therefore I've had some issues using it here, in terms of typings, execution, and testing.

  • The types can't be determined because the current TS module resolution can't work with ESM (as typescript compiler said when I run it).
  • I initially imported the package at the top of the file, but that doesn't work well in CJS. However, the dynamic import seems to bypass that issue.
  • Because it uses that dynamic import now the test suite has to run with a special node flag to enable that feature.

My question is, are we ok with this? I'm open to other ideas or suggestions.

Related issue: #545

@changeset-bot
Copy link

changeset-bot bot commented Dec 18, 2025

🦋 Changeset detected

Latest commit: 0254443

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

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

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.31%. Comparing base (3cb9982) to head (0254443).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1806      +/-   ##
==========================================
+ Coverage   81.33%   82.31%   +0.97%     
==========================================
  Files          54       54              
  Lines        2277     2290      +13     
  Branches      684      686       +2     
==========================================
+ Hits         1852     1885      +33     
+ Misses        420      400      -20     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@luisadame luisadame force-pushed the feature/#545--find-changeset-root-folder branch from 5aa603c to 4fbd2bd Compare December 18, 2025 20:47
@luisadame luisadame changed the title Feature/#545 find changeset root folder feat(cli): allow changesets to be executed from nested non-root folders (#545) Dec 18, 2025
@luisadame luisadame marked this pull request as ready for review December 18, 2025 22:35
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.

1 participant