Skip to content

Fix unversioned private package handling, tagging of ignored - #1361

Merged
Andarist merged 19 commits into
changesets:mainfrom
jakebailey:fix-private-unversioned
May 28, 2024
Merged

Andarist merged 19 commits into
changesets:mainfrom
jakebailey:fix-private-unversioned

Conversation

@jakebailey

@jakebailey jakebailey commented May 21, 2024 •

Copy link
Copy Markdown
Contributor

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.

@changeset-bot

changeset-bot Bot commented May 21, 2024 •

Copy link
Copy Markdown

🦋 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

@codesandbox-ci

codesandbox-ci Bot commented May 21, 2024 •

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Comment thread packages/cli/src/run.ts Resolved
Comment thread packages/cli/src/run.ts Resolved
@codecov-commenter

codecov-commenter commented May 23, 2024 •

Copy link
Copy Markdown

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

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

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.

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
Copy Markdown
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
Copy Markdown
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

Copy link
Copy Markdown

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
Copy Markdown
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?

Copy link
Copy Markdown

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
Copy Markdown
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.

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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.

Copy link
Copy Markdown

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

Comment thread packages/cli/src/commands/tag/index.ts Resolved
Comment thread packages/cli/src/run.test.ts Outdated
);
});

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

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.

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

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.

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

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.

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 👍

Comment thread .changeset/sharp-humans-battle.md Resolved
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