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

Update Build to incorporate version number in Rust and Node.js Packages #40

Merged
merged 10 commits into from
May 24, 2023

Conversation

timjroberts
Copy link
Collaborator

@timjroberts timjroberts commented May 23, 2023

This PR implements #11 by adding a custom Nx Executor that will first compute a SemVer compatible version number; and then use it to update the appropriate 'package.json' and 'Cargo.toml' files.

The version number is based on the major and minor values defined in a new 'version.json' file that is present in the root of the repository. This file will be used to control the product version that we require a build for, while the Nx Executor will suffix the version with either: a) the commit height for releasable branches, or b) the current commit id for all other branches.

Updating the version numbers is an explicit task. It is run via npm run set-version (which should be run before the build or package script variants). I would expect this to be typical in a CI context.

@timjroberts timjroberts marked this pull request as ready for review May 24, 2023 10:14
@AndrewF001 AndrewF001 linked an issue May 24, 2023 that may be closed by this pull request
Copy link
Contributor

@AndrewF001 AndrewF001 left a comment

Choose a reason for hiding this comment

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

Much better approach than the one I took. I've added PR to development of #11

await writeTomlManifest(packageTargetPath, version);
}
else {
logger.fatal(`Unsupported package target: '${packageTargetPath}'.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

When I was debugging for Windows, this print was not displaying. However, when I changed it to logger.info(), it started working. I also tried giving nx the --output-style=static flag, but it didn't work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, OK. Perhaps the default level doesn't include fatal. I'll try it with logger.error(). Also, perhaps it should be more fatal and the build should fail. I'll take a look at whether you can inform Nx that the build should fail via the API.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've updated this so that it now reports the failure to Nx which then fails the build.

@timjroberts timjroberts merged commit eff1daf into main May 24, 2023
@timjroberts timjroberts deleted the timjroberts/build-sem-ver branch May 24, 2023 14:23
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.

Update Build to incorporate semantic versioning
2 participants