Skip to content

Add error message and exit when there are no versionable packages - #1466

Merged
Andarist merged 4 commits into
changesets:mainfrom
marcalexiei:feat/no-verionable-packages-info
Oct 10, 2024
Merged

Andarist merged 4 commits into
changesets:mainfrom
marcalexiei:feat/no-verionable-packages-info

Conversation

@marcalexiei

@marcalexiei marcalexiei commented Sep 21, 2024 •

Copy link
Copy Markdown
Contributor

Close #1170
fix #841

I have added an informative message in the scenario where no versionable packages are found.
This should cover also the error reported in the issue linked above (public packages without version field in package).

@changeset-bot

changeset-bot Bot commented Sep 21, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ee1ff40

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

This PR includes changesets to release 1 package
Name Type
@changesets/cli 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

@codecov

codecov Bot commented Sep 21, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.04%. Comparing base (7ccb22e) to head (ee1ff40).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1466      +/-   ##
==========================================
+ Coverage   81.02%   81.04%   +0.02%     
==========================================
  Files          54       54              
  Lines        2213     2221       +8     
  Branches      654      661       +7     
==========================================
+ Hits         1793     1800       +7     
- Misses        416      417       +1     
  Partials        4        4              

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

@marcalexiei
marcalexiei force-pushed the feat/no-verionable-packages-info branch from 1c04a81 to 7e9886e Compare October 7, 2024 07:02
Comment thread packages/cli/src/commands/add/index.ts Resolved
@marcalexiei
marcalexiei force-pushed the feat/no-verionable-packages-info branch from 7e9886e to 7ff6f59 Compare October 8, 2024 12:31
@marcalexiei marcalexiei changed the title Add informative message when there are no versionable packages Add error message and exit when there are no versionable packages Oct 8, 2024
Comment thread packages/cli/src/commands/add/index.ts Resolved
@marcalexiei
marcalexiei requested a review from bluwy October 8, 2024 12:36

@bluwy bluwy left a comment

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 think the flow and fix here looks good. Not sure if others have thoughts on the error logged info.

error("No versionable packages found");
error('- Ensure the packages to version are not in the "ignore" config');
error('- Ensure that relevant package.json files have the "version" field');
throw new ExitError(1);

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 for myself: this is nicely handled here:

if (err instanceof ExitError) {
return process.exit(err.code);
}

so 👍

@marcalexiei
marcalexiei requested a review from Andarist October 9, 2024 11:38
@marcalexiei
marcalexiei requested a review from Andarist October 9, 2024 16:57
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.

Cannot read properties of undefined (reading 'packageJson') TypeError: Cannot read property 'packageJson' of undefined

3 participants