Skip to content

feat(release)!: releasePublish always returns status code per project#28224

Merged
JamesHenry merged 1 commit into
masterfrom
release-publish-api-change
Oct 2, 2024
Merged

feat(release)!: releasePublish always returns status code per project#28224
JamesHenry merged 1 commit into
masterfrom
release-publish-api-change

Conversation

@JamesHenry

@JamesHenry JamesHenry commented Oct 1, 2024

Copy link
Copy Markdown
Contributor

BREAKING CHANGE

In v19 of nx, the programmatic usage of await releasePublish({ ... }) would throw in the case that any project failed to publish. It would return the number 0 (to represent the overall exit code) in the case that all projects were successfully published.

Now, in v20, the programmatic usage of await releasePublish({ ... }) will always return a PublishProjectsResult object, which is a mapping of project names to an object of { code: number } for each project. This allows consumers to make informed decisions about which projects failed to publish and decide how to handle it in their release scripts.

For example, where there are projects called "pkg-a" and "pkg-b" and "pkg-a" is successfully published and "pkg-b" fails:

const result = await releasePublish({
  dryRun: false
});
// result is set to { "pkg-a": { code: 0 }, "pkg-b": { code: 1 } )

@vercel

vercel Bot commented Oct 1, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 2:58pm

@nx-cloud

nx-cloud Bot commented Oct 1, 2024

Copy link
Copy Markdown
Contributor

@JamesHenry JamesHenry changed the title feat(release)!: releasePublish now returns status code per project feat(release)!: releasePublish now always returns status code per project Oct 1, 2024
@JamesHenry JamesHenry changed the title feat(release)!: releasePublish now always returns status code per project feat(release)!: releasePublish always returns status code per project Oct 1, 2024
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
}
);
if (status !== 0) {

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.

This never actually did anything after the throw was added at some point

loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
}
);
if (status !== 0) {

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.

This never actually did anything after the throw was added at some point

@JamesHenry JamesHenry marked this pull request as ready for review October 1, 2024 16:58
@JamesHenry JamesHenry requested a review from a team as a code owner October 1, 2024 16:58
@JamesHenry JamesHenry requested a review from AgentEnder October 1, 2024 16:58
@JamesHenry JamesHenry merged commit 69e9bb9 into master Oct 2, 2024
@JamesHenry JamesHenry deleted the release-publish-api-change branch October 2, 2024 13:34
@github-actions

github-actions Bot commented Oct 8, 2024

Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants