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

Add --update option to tsp-client compare #9608

Closed
wants to merge 1 commit into from

Conversation

tjprescott
Copy link
Member

@tjprescott tjprescott commented Jan 8, 2025

Fixes #9498.

This PR adds a hidden --update flag to tsp-client compare to allow for easily updating the wrapped version of @azure-tools/rest-api-diff in-place without having to uninstall and reinstall tsp-client. Because the option is hidden, the command will always end with a message describing the ability to update the command.

This tool is under active development. If you experience issues or have questions, please contact Travis Prescott direct
ly (trpresco@microsoft.com). [Tool version: 0.1.8]
Use tsp-client compare --update to update @azure-tools/rest-api-diff to the latest version

TODO

  • bump version
  • verify this works when run in a non-dev setting

@@ -52,7 +52,7 @@
"dependencies": {
"@autorest/core": "^3.10.2",
"@autorest/openapi-to-typespec": "0.10.5",
"@azure-tools/rest-api-diff": ">=0.1.0 <1.0.0",
"@azure-tools/rest-api-diff": "^0.1.8",
Copy link
Member

Choose a reason for hiding this comment

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

IIRC we had to explicitly specify the range so that minor version updates are allowed, since this package doesnt have a major version yet. If you want to specify a min version you could do:

Suggested change
"@azure-tools/rest-api-diff": "^0.1.8",
"@azure-tools/rest-api-diff": ">=0.1.8 <1.0.0",

Copy link
Member

Choose a reason for hiding this comment

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

Once the tool has a major version we should be able to simplify this

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I didn't actually manually change this file... Hmm.... I wonder if this command did.... Need to check that.

Logger.error(`Error occurred while attempting to compare: ${err}`);
process.exit(1);
if (argv["update"]) {
execSync(`npm install @azure-tools/rest-api-diff@latest`, { stdio: "inherit" });
Copy link
Member

Choose a reason for hiding this comment

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

We were just discussing this with @mikeharder in this other PR: #9602. I dont think we need to have this functionality in tsp-client. It seems if a user is at the point of knowing that they need to update the package version then they should simply run the npm update command directly.

Copy link
Member

Choose a reason for hiding this comment

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

Can this be as simple as updating your output message to be the following:

This tool is under active development. If you experience issues or have questions, please contact Travis Prescott direct
ly (trpresco@microsoft.com). [Tool version: 0.1.8]
Run npm update @azure-tools/rest-api-diff to update @azure-tools/rest-api-diff to the latest version

Copy link
Member

Choose a reason for hiding this comment

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

I believe npm update @azure-tools/rest-api-diff@latest should work as well to be very explicit but if it doesnt then npm install should be fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, the problem is from what folks have told me, running npm update doesn't actually work. It still uses the original internal version that tsp-client originally pulled down.

Copy link
Member

Choose a reason for hiding this comment

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

I have had issues with npm update myself...maybe just recommending npm install, the same as the command you're wrapping under this command would be better?

@tjprescott tjprescott closed this Jan 15, 2025
@tjprescott tjprescott deleted the tsp-client/compareUpdate branch January 21, 2025 20:54
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.

Make it easier to upgrade the version of tsp-client compare in-place
2 participants