Sync eng/common directory with azure-sdk-tools for PR 12060 (#6747)

* pin tsp-client

* Added a script to wrap the call to tsp-client

* Used npm i to improve per

* Removed script and added readme.md

* Update eng/common/tsp-client/README.md

Co-authored-by: Mike Harder <mharder@microsoft.com>

* Update eng/common/tsp-client/README.md

Co-authored-by: Mike Harder <mharder@microsoft.com>

* Use npm ci for installation

* Added dependabot to readme

* Update eng/common/tsp-client/README.md

Co-authored-by: Mike Harder <mharder@microsoft.com>

* Removed 'prefix' option approach from usage

* Fixed format issue

---------

Co-authored-by: catalinaperalta <caperal@microsoft.com>
Co-authored-by: ray chen <raychen@microsoft.com>
Co-authored-by: Mike Harder <mharder@microsoft.com>
This commit is contained in:
Azure SDK Bot 2025-09-18 17:19:45 -07:00 committed by GitHub
parent 871d322ea6
commit be594f38c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2375 additions and 0 deletions

View File

@ -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`

2290
eng/common/tsp-client/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
{
"dependencies": {
"@azure-tools/typespec-client-generator-cli": "0.28.1"
}
}