Skip to content

fix: improve package.json detection#94

Merged
Andarist merged 2 commits intochangesets:masterfrom
re-taro:fix/package.json-dedect
May 8, 2026
Merged

fix: improve package.json detection#94
Andarist merged 2 commits intochangesets:masterfrom
re-taro:fix/package.json-dedect

Conversation

@re-taro
Copy link
Copy Markdown
Contributor

@re-taro re-taro commented Nov 26, 2025

Summary

  • Fix issue where root-level package.json was not being detected
  • The condition item.path.endsWith("/package.json") doesn't match package.json at the root directory, so added item.path === "package.json" check

Changes

  • get-changed-packages.ts: Add condition to properly detect root-level package.json

@re-taro re-taro requested a review from emmatown as a code owner November 26, 2025 09:03
@vercel
Copy link
Copy Markdown

vercel Bot commented Nov 26, 2025

@re-taro is attempting to deploy a commit to the Changesets Team on Vercel.

A member of the Team first needs to authorize it.

@lukasIO
Copy link
Copy Markdown
Contributor

lukasIO commented Jan 30, 2026

this should also resolve #82

@lukasIO
Copy link
Copy Markdown
Contributor

lukasIO commented Jan 30, 2026

@Andarist sorry for tagging you, but the original issue has been raised almost 2 years ago. Could we get this merged and released?

Comment thread get-changed-packages.ts Outdated
if (item.path.endsWith("/package.json")) {
if (
item.path === "package.json" ||
item.path.endsWith("/package.json")
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.

when you use slashes like this it will not work on windows machines, you should either use path.SEP or path.join, whichever suits the situation more

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.

here you could also do

path.basename(item.path) === "package.json"

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.

Oops, I missed Windows support. Fixed now.

@re-taro re-taro requested a review from Andarist as a code owner May 6, 2026 14:40
@re-taro re-taro requested a review from beeequeue May 6, 2026 14:41
@re-taro re-taro force-pushed the fix/package.json-dedect branch from eb4d3a9 to ba0b88d Compare May 6, 2026 14:49
Comment thread get-changed-packages.ts
continue;
}
if (item.path.endsWith("/package.json")) {
if (nodePath.basename(item.path) === "package.json") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be great to understand better your workspace layout to determine if this is the proper fix. How your packages are laid out and how your workspaces patterns are configured? what exactly doesnt work right now and what is the expected result with your fix in?

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.

I described one example in more detail as part of #82

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@lukasIO so basically what I put now in a test case 58f9485 ?

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.

yeah, that looks right, there's one more case that this didn't fix, I opened #111 to address it

@Andarist Andarist merged commit 871aed1 into changesets:master May 8, 2026
2 of 3 checks passed
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.

4 participants