Skip to content

Commit 86fb96b

Browse files
azure-sdkcperaltahraych1mikeharder
authored
Sync eng/common directory with azure-sdk-tools for PR 12060 (#25285)
* 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 <[email protected]> * Update eng/common/tsp-client/README.md Co-authored-by: Mike Harder <[email protected]> * Use npm ci for installation * Added dependabot to readme * Update eng/common/tsp-client/README.md Co-authored-by: Mike Harder <[email protected]> * Removed 'prefix' option approach from usage * Fixed format issue --------- Co-authored-by: catalinaperalta <[email protected]> Co-authored-by: ray chen <[email protected]> Co-authored-by: Mike Harder <[email protected]>
1 parent e11997b commit 86fb96b

File tree

3 files changed

+2375
-0
lines changed

3 files changed

+2375
-0
lines changed

eng/common/tsp-client/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# TypeSpec Client Generator CLI
2+
3+
This directory contains npm package definitions for `@azure-tools/typespec-client-generator-cli` (tsp-client) with pinned versions to ensure reproducible builds across environments.
4+
5+
## Files
6+
7+
- **`package.json`** - npm package definition with pinned tsp-client version
8+
- **`package-lock.json`** - Lock file ensuring exact dependency versions
9+
10+
## Prerequisites
11+
12+
- **Node.js** (with npm) - Required to install and run tsp-client
13+
14+
## Installation
15+
16+
### Install dependencies
17+
18+
```bash
19+
# Navigate to this directory
20+
cd eng/common/tsp-client
21+
22+
# Install dependencies
23+
npm ci
24+
```
25+
26+
## Usage
27+
28+
After installation, you can run tsp-client by navigating to the directory and using npm exec:
29+
30+
```bash
31+
cd eng/common/tsp-client
32+
33+
# Get help
34+
npm exec --no -- tsp-client --help
35+
36+
# Check version
37+
npm exec --no -- tsp-client version
38+
39+
# Generate client code
40+
npm exec --no -- tsp-client generate --output-dir ./generated
41+
42+
# Initialize a new project
43+
npm exec --no -- tsp-client init --tsp-config ./tspconfig.yaml
44+
```
45+
46+
## CI/CD Best Practices
47+
48+
```bash
49+
cd eng/common/tsp-client
50+
npm ci
51+
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
52+
```
53+
54+
## Package Management
55+
56+
### Automatic Updates via Dependabot
57+
58+
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.
59+
60+
### Manual Version Updates
61+
62+
If you need to manually update the tsp-client version:
63+
64+
1. Edit `package.json` to update the version:
65+
66+
```json
67+
{
68+
"dependencies": {
69+
"@azure-tools/typespec-client-generator-cli": "0.28.1"
70+
}
71+
}
72+
```
73+
74+
2. Update the lock file:
75+
76+
```bash
77+
npm install
78+
```
79+
80+
3. Commit both `package.json` and `package-lock.json`

0 commit comments

Comments
 (0)