Skip to content

Conversation

JamesHenry
Copy link
Collaborator

@JamesHenry JamesHenry commented Oct 1, 2024

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 } )
Copy link

vercel bot commented Oct 1, 2024

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
@JamesHenry JamesHenry changed the title feat(release)!: releasePublish now returns status code per project Oct 1, 2024
@JamesHenry JamesHenry changed the title feat(release)!: releasePublish now always returns status code per project Oct 1, 2024
loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
}
);
if (status !== 0) {
Copy link
Collaborator 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
Collaborator 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
6 checks passed
@JamesHenry JamesHenry deleted the release-publish-api-change branch October 2, 2024 13:34
Copy link
Contributor

github-actions bot commented Oct 8, 2024

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

2 participants