Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unversioned private package handling, tagging of ignored #1361

Merged
merged 19 commits into from
May 28, 2024

Conversation

jakebailey
Copy link
Contributor

@jakebailey jakebailey commented May 21, 2024

This works for version and tag, at least in my testing for microsoft/TypeScript-Website#3116.

However, there seem to be other places that should be checking this, but have less convenient access to actual Package objects. That and it's not clear to me if the other cases actually matter.

Also, needs tests... And to figure out where to move this shared code as there is no common package for these besides types which is types only.

Copy link

changeset-bot bot commented May 21, 2024

🦋 Changeset detected

Latest commit: bd83660

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

This PR includes changesets to release 4 packages
Name Type
@changesets/assemble-release-plan Patch
@changesets/apply-release-plan Patch
@changesets/cli Patch
@changesets/get-release-plan 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

Copy link

codesandbox-ci bot commented May 21, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@jakebailey
Copy link
Contributor Author

Tests fail for me, but also fail on main. Not sure what I'm doing wrong.

@jakebailey jakebailey closed this May 22, 2024
@jakebailey jakebailey reopened this May 22, 2024
@romankulkovsf
Copy link

App

@jakebailey jakebailey changed the title Try and fix unversioned private package handling Fix unversioned private package handling, tagging of ignored releases May 22, 2024
@jakebailey jakebailey changed the title Fix unversioned private package handling, tagging of ignored releases Fix unversioned private package handling, tagging of ignored May 22, 2024
@jakebailey jakebailey marked this pull request as ready for review May 22, 2024 23:34
packages/apply-release-plan/src/index.ts Outdated Show resolved Hide resolved
packages/assemble-release-plan/src/utils.ts Outdated Show resolved Hide resolved
packages/cli/src/run.ts Outdated Show resolved Hide resolved
packages/cli/src/run.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented May 23, 2024

Codecov Report

Attention: Patch coverage is 97.05882% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 80.23%. Comparing base (ffb9d97) to head (eda05e2).

Current head eda05e2 differs from pull request most recent head bd83660

Please upload reports for the commit bd83660 to get more accurate results.

Files Patch % Lines
packages/cli/src/run.ts 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1361      +/-   ##
==========================================
+ Coverage   80.05%   80.23%   +0.18%     
==========================================
  Files          53       54       +1     
  Lines        2201     2206       +5     
  Branches      647      648       +1     
==========================================
+ Hits         1762     1770       +8     
+ Misses        435      432       -3     
  Partials        4        4              

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

@jakebailey jakebailey force-pushed the fix-private-unversioned branch from 2f5f69d to 2b0ac15 Compare May 23, 2024 21:50
@@ -30,7 +31,7 @@ describe("tag command", () => {
(git.getAllTags as jest.Mock).mockReturnValue(new Set());

expect(git.tag).not.toHaveBeenCalled();
await tag(cwd);
await tag(cwd, defaultConfig);
Copy link
Member

Choose a reason for hiding this comment

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

i'd probably go with readConfig like in the status' tests but this is fine too. Our test suite isn't particularly consistent when it comes to this

await tag(cwd);
await tag(cwd, {
...defaultConfig,
privatePackages: { version: true, tag: true },
Copy link
Member

Choose a reason for hiding this comment

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

hm, doesn't this change mean it's a breaking change? 🤔 note to myself: i need to recheck the current defaults

Copy link
Member

Choose a reason for hiding this comment

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

the current default is privatePackages: { version: true, tag: false }. The current behavior was broken and this adjustment just reflects that the bug was fixed

Choose a reason for hiding this comment

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

Hey @Andarist - Would this be the cause of my private packages no longer receiving tags with the default value of privatePackages (i.e. unset in my config)?

Some documentation for privatePackages would be a massive help - I wasn't able to find any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's effectively what this change did... I didn't realize the default option here was tag: false, but if it's tag: false, surely that means it shouldn't be tagging, right? So you should just set it to true?

Choose a reason for hiding this comment

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

surely that means it shouldn't be tagging, right? So you should just set it to true?

Yes, I'm just asking to make sure because a default behaviour has changed on a patch version increment, on an undocumented property :)

I have tested it with tag: true, and we're back to the previous behaviour.

Copy link
Member

Choose a reason for hiding this comment

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

Some documentation for privatePackages would be a massive help - I wasn't able to find any.

I agree... PRs are more than welcome 😉

Sorry for the breaking your workflow here. I had to recheck this myself when reviewing this PR but I concluded it was a bug. IIRC, older versions of the CLI didn't tag private packages - at some point that was broken.

Choose a reason for hiding this comment

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

Not a problem! Was just checking I wasn't going mad. It must have been broken for a fair few months (i.e. since before we integrated changesets!)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it might be. The last year wasn't a particularly active year when it comes to the development of this package 😅

Copy link

Choose a reason for hiding this comment

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

Hi. This was a breaking change because:

  1. My repo which I don't publish (thus private) stopped tagging versions.
  2. The referenced privatePackages configuration is not documented, so it doesn't matter what the default was if nobody using the library knew the configuration existed.

Do I add privatePackages: { version: true, tag: true } to my .changeset/config.json to make it tag again? I see it is in the $schema.

Choose a reason for hiding this comment

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

Hi guys,

An issue #1383 and a pull request #1385 were created to talk about the documentation of this item

@@ -65,6 +65,41 @@ describe("cli", () => {
);
});

it("should not throw if dependents of unversioned private packages are not explicitly listed in the ignore array", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

note to myself: recheck what this test is about and how it behaves today

Copy link
Member

Choose a reason for hiding this comment

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

i guess what i'm surprised here is that this test has no changesets, it just tests a "dry" version run

Copy link
Member

Choose a reason for hiding this comment

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

So it turns out that version has some validation logic in it already so this throws an error on main:

"The package "pkg-a" depends on the ignored package "pkg-b", but "pkg-a" is not being ignored. Please pass "pkg-a" to the `--ignore` flag."

The test, indeed, validates a fixed behavior 👍

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.

7 participants