-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Sync eng/common directory with azure-sdk-tools for PR 12060 #52711
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
85b26a7
pin tsp-client
cperaltah c3b7f18
Added a script to wrap the call to tsp-client
raych1 392b632
Used npm i to improve per
raych1 4cde315
Removed script and added readme.md
raych1 ecae466
Update eng/common/tsp-client/README.md
raych1 5557206
Update eng/common/tsp-client/README.md
raych1 5909c8f
Use npm ci for installation
raych1 0ddbe04
Added dependabot to readme
raych1 175cf51
Update eng/common/tsp-client/README.md
raych1 04629b0
Removed 'prefix' option approach from usage
raych1 c6d3c87
Fixed format issue
raych1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # TypeSpec Client Generator CLI | ||
|
|
||
| This directory contains npm package definitions for `@azure-tools/typespec-client-generator-cli` (tsp-client) with pinned versions to ensure reproducible builds across environments. | ||
|
|
||
| ## Files | ||
|
|
||
| - **`package.json`** - npm package definition with pinned tsp-client version | ||
| - **`package-lock.json`** - Lock file ensuring exact dependency versions | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - **Node.js** (with npm) - Required to install and run tsp-client | ||
|
|
||
| ## Installation | ||
|
|
||
| ### Install dependencies | ||
|
|
||
| ```bash | ||
| # Navigate to this directory | ||
| cd eng/common/tsp-client | ||
|
|
||
| # Install dependencies | ||
| npm ci | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| After installation, you can run tsp-client by navigating to the directory and using npm exec: | ||
|
|
||
| ```bash | ||
| cd eng/common/tsp-client | ||
|
|
||
| # Get help | ||
| npm exec --no -- tsp-client --help | ||
|
|
||
| # Check version | ||
| npm exec --no -- tsp-client version | ||
|
|
||
| # Generate client code | ||
| npm exec --no -- tsp-client generate --output-dir ./generated | ||
|
|
||
| # Initialize a new project | ||
| npm exec --no -- tsp-client init --tsp-config ./tspconfig.yaml | ||
| ``` | ||
|
|
||
| ## CI/CD Best Practices | ||
|
|
||
| ```bash | ||
| cd eng/common/tsp-client | ||
| npm ci | ||
| npm exec --no -- tsp-client init --update-if-exists --tsp-config https://github.com/Azure/azure-rest-api-specs/blob/dee71463cbde1d416c47cf544e34f7966a94ddcb/specification/contosowidgetmanager/Contoso.WidgetManager/tspconfig.yaml | ||
| ``` | ||
|
|
||
| ## Package Management | ||
|
|
||
| ### Automatic Updates via Dependabot | ||
|
|
||
| Dependabot is configured to automatically check for updates to `@azure-tools/typespec-client-generator-cli` daily and create pull requests with updated `package.json` and `package-lock.json` files. This ensures the package stays current with the latest versions while maintaining security through the PR review process. | ||
|
|
||
| ### Manual Version Updates | ||
|
|
||
| If you need to manually update the tsp-client version: | ||
|
|
||
| 1. Edit `package.json` to update the version: | ||
|
|
||
| ```json | ||
| { | ||
| "dependencies": { | ||
| "@azure-tools/typespec-client-generator-cli": "0.28.1" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| 2. Update the lock file: | ||
|
|
||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| 3. Commit both `package.json` and `package-lock.json` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.