-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[Eng] Improve typespec devexp with Update-DevTSPModule
#28954
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
598f2c4
b62eb3c
d563459
d214897
31dc9b1
7bc1936
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| $module = 'AzDev' | ||
| $artifacts = "$PSScriptRoot/../../artifacts" | ||
|
|
||
| rm -r "$artifacts/$module" | ||
|
||
| dotnet publish $PSScriptRoot/src --sc -o "$artifacts/$module/bin" | ||
| Copy-Item "$PSScriptRoot/$module/*" "$artifacts/$module" -Recurse -Force | ||
| Copy-Item "$PSScriptRoot/$module/*" "$artifacts/$module" -Recurse -Force | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,91 @@ | ||||||
| # Update-DevTSPModule | ||||||
|
|
||||||
| `Update-DevTSPModule` is a PowerShell cmdlet designed to help manage TypeSpec (TSP) configurations for Azure PowerShell development. It facilitates the setup and update of `tspconfig.yaml` by resolving locations from local paths, remote URLs, or specific repository details. Then finally generate Azure-PowerShell module from TypeSpec configured. | ||||||
|
|
||||||
| ## Terminology | ||||||
|
|
||||||
| - **TSP (TypeSpec)**: The language used for defining APIs: https://github.com/Azure/azure-rest-api-specs/tree/main/specification | ||||||
| - **TSP Location**: The source of truth for the TypeSpec configuration. It can be a remote URL (e.g., GitHub) or a local file path. There must be ***tspconfig.yaml*** and ***typespec files*** under this location. | ||||||
| - ***remote*** | ||||||
| - ***local*** | ||||||
| - ***tsp-location.yaml***: Will be calculated from `./tsp-location.yaml` if not provided and tsp-location.yaml exists. See [`tsp-location.yaml`](#tsp-location-yaml) | ||||||
| - **AzPSConfig**: An optional, additional TypeSpec configuration file (typically `tspconfig.yaml` in the local directory) that is merged with the main TSP configuration. This allows for Azure PowerShell-specific overrides or extensions. Will look for `./tspconfig.yaml` if not provided. | ||||||
| - <a id="tsp-location-yaml"></a>**tsp-location.yaml**: A local file generated by this cmdlet to persist the source location of the TypeSpec configuration. This allows subsequent runs to resolve the configuration without needing to re-specify the location parameters. | ||||||
| - ***directory***: Directory to tsp location, e.g. `specification\azuredependencymap\DependencyMap.Management` | ||||||
| - ***commit***: Commit id. Empty when last generation was from local tsp | ||||||
| - ***repo***: `{ForkName}/{RepositoryName}`, e.g. `Azure/azure-rest-api-specs`. Empty when last generation was from local tsp | ||||||
| - **RepoRoot**: Root directory of local azure-powershell. Can be provided in below ways | ||||||
| - ***Execute this cmdlet anywhere under $RootDirectory without explicitly providing it***: Run this cmdlet under any subdirectory of azure-powershell, `RepoRoot` will be calculated. | ||||||
| - ***Pass by parameter***: `Update-DevTSPModule -RepoRoot $RootDirectory` | ||||||
| - ***AzDev Cmdlet***: `Set-DevContext -RepoRoot $RootDirectory` | ||||||
| - **Emitter**: The tool responsible for generating PowerShell code from the TypeSpec definition. This cmdlet specifically works witapprovedh the `@azure-tools/typespec-powershell` emitter. | ||||||
|
||||||
| - **Emitter**: The tool responsible for generating PowerShell code from the TypeSpec definition. This cmdlet specifically works witapprovedh the `@azure-tools/typespec-powershell` emitter. | |
| - **Emitter**: The tool responsible for generating PowerShell code from the TypeSpec definition. This cmdlet specifically works with the `@azure-tools/typespec-powershell` emitter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From which directory should I run the command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any directory under azure-powershell should work, or anywhere under your file system with reporoot provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Unix-style
rmcommand is not compatible with PowerShell 5.1 on Windows and violates cross-platform compatibility guidelines. While it works in PowerShell 7+, this is a build script that should work on all platforms with PowerShell 5.1+.Recommendation: Use the cross-platform PowerShell cmdlet:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense