Skip to content

Commit 51c3c03

Browse files
committed
updated development.md to cater for devcontainers and multi-platform development
1 parent 0a295e2 commit 51c3c03

File tree

1 file changed

+89
-41
lines changed

1 file changed

+89
-41
lines changed

docs/development.md

Lines changed: 89 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,126 @@
11
# AutoRest PowerShell Generator - Development
22

3-
## Requirements
3+
## Getting Started with Dev Containers (Recommended)
44

5-
Use of this project requires the following:
5+
The easiest way to get started is using the provided Dev Container configuration, which automatically sets up all required tools and dependencies.
66

7-
- [NodeJS LTS](https://nodejs.org) (currently 14.15.5) <br> I recommend that you use a tool like [nvs](https://github.com/jasongin/nvs) so that you can switch between versions of node without pain <br>&nbsp;
8-
- [AutoRest](https://aka.ms/autorest) v3 <br> `npm install -g autorest@latest ` <br>&nbsp;
9-
- [RushJS](https://rushjs.io/) manages multiple nodejs projects in a single repository. <br> `npm install -g @microsoft/rush` <br>&nbsp;
10-
- PowerShell 6.0 - If you dont have it installed, you can use the cross-platform npm package <br> `npm install -g pwsh` <br>&nbsp;
11-
- Dotnet SDK 2 or greater - If you dont have it installed, you can use the cross-platform npm package <br> `npm install -g dotnet-sdk-2.1 ` <br>&nbsp;
12-
- _Recommended_: [Visual Studio Code](https://code.visualstudio.com/)
7+
### Prerequisites
8+
- [Docker](https://www.docker.com/get-started) or [Podman](https://podman.io/)
9+
- [Visual Studio Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
1310

11+
### Setup
12+
1. Clone the repository:
13+
```bash
14+
git clone https://github.com/azure/autorest.powershell
15+
cd autorest.powershell
16+
```
1417

15-
## Cloning this repository
18+
2. Open in VS Code and reopen in container:
19+
- Open the folder in VS Code
20+
- When prompted, click "Reopen in Container" (or press `F1` and select "Dev Containers: Reopen in Container")
21+
- Wait for the container to build and initialize (this may take a few minutes on first run)
1622

17-
``` powershell
18-
# clone recursively
19-
git clone https://github.com/azure/autorest.powershell
23+
3. Once the container is ready, all tools are pre-installed and configured:
24+
- Node.js 18.20.4
25+
- Rush 5.112.2
26+
- PowerShell 7.5+
27+
- .NET SDK 2.1
2028

21-
# one-time
22-
cd autorest.powershell
23-
npm install
24-
```
29+
4. Build the project:
30+
```bash
31+
rush update
32+
rush rebuild
33+
```
2534

26-
## Using RushJS
35+
## Manual Setup (Without Dev Container)
2736

28-
This repository is built as a 'monorepo' using [RushJS](https://rushjs.io/) - which manages multiple nodejs projects in a single repository.
37+
### Requirements
2938

30-
``` powershell
31-
# install nodejs modules for all projects in the monorepo
32-
rush update
39+
Use of this project requires the following:
40+
41+
- **[Node.js LTS](https://nodejs.org)** (18.20.4) - We recommend using [nvs](https://github.com/jasongin/nvs) or [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions
42+
- **[Rush](https://rushjs.io/)** (5.112.2) - `npm install -g @microsoft/[email protected]`
43+
- **[PowerShell](https://github.com/PowerShell/PowerShell)** (7.0+) - Cross-platform, install from [GitHub releases](https://github.com/PowerShell/PowerShell/releases)
44+
- **[.NET SDK](https://dotnet.microsoft.com/download)** (2.1+) - Required for building C# components
45+
- **Recommended**: [Visual Studio Code](https://code.visualstudio.com/)
46+
47+
### Cloning this repository
48+
49+
```bash
50+
# Clone the repository
51+
git clone https://github.com/azure/autorest.powershell
52+
cd autorest.powershell
3353
```
3454

35-
Rush is used to make sure that package versions are consistent between sub-projects
55+
## Using Rush
3656

37-
``` powershell
38-
# ensure all projects are using the same versions
57+
This repository is built as a monorepo using [Rush](https://rushjs.io/), which manages multiple Node.js projects in a single repository.
58+
59+
```bash
60+
# First time setup: sync package versions
3961
rush sync-versions
4062

41-
# install modules
63+
# Install dependencies for all projects
4264
rush update
4365
```
4466

45-
## Compiling
67+
If you update dependencies in `package.json` files, run `rush update` again to install the new packages.
68+
69+
## Building
4670

47-
Rush is used to build `autorest.powershell`
71+
Build all projects in the correct dependency order:
4872

49-
``` powershell
50-
# build everything
73+
```bash
74+
# Clean build everything from scratch
5175
rush rebuild
76+
77+
# Incremental build (faster, only rebuilds changed projects)
78+
rush build
5279
```
5380

54-
You can use `watch` to compile when a file is changed, which will rebuild dependencies automatically.
55-
Just kill the process with ctrl-c to stop it.
81+
### Watch Mode
5682

57-
``` powershell
58-
# start watching
83+
For active development, you can use watch mode to automatically rebuild when files change:
84+
85+
```bash
86+
# Watch mode - rebuilds on file changes
5987
rush watch
6088
```
6189

62-
## Using your locally built version of `autorest.powershell`
90+
Press `Ctrl+C` to stop the watch process.
91+
92+
## Using Your Local Build
6393

64-
To use the locally built version of the plugin, add `--use:<path>` to the command line
94+
To use your locally built version of the plugin, use the `--use` flag with AutoRest:
6595

66-
``` powershell
67-
# using a local build
68-
> autorest --use:c:/work/autorest.powershell <...arguments>
96+
```bash
97+
# Using local build (cross-platform path)
98+
autorest --use:$PWD/powershell --powershell --input-file:path/to/spec.yaml --output-folder:./output
6999

100+
# Or with absolute path
101+
autorest --use:/path/to/autorest.powershell/powershell --powershell <...other-arguments>
70102
```
71103

72-
### Debugging
104+
**Note**: Use `$PWD` on Linux/macOS or `${PWD}` in PowerShell for the current directory. On Windows Command Prompt, use `%CD%`.
105+
106+
## Debugging
107+
108+
### Debugging AutoRest Generation
109+
110+
1. Start AutoRest with the debugger flag (it will wait for the debugger to attach):
111+
```bash
112+
autorest --use:$PWD/powershell --powershell.debugger --input-file:spec.yaml
113+
```
114+
115+
2. In VS Code:
116+
- Open the `autorest.powershell` folder
117+
- Press `F5` to attach the debugger
118+
- You'll see "Debugger attached." in the AutoRest console
119+
- Set breakpoints and debug as needed
120+
121+
### Debugging in VS Code
73122

74-
1. Start generating: `autorest --use:C:\path\to\local\autorest.powershell --powershell.debugger`. It will wait for debugger to attach.
75-
1. Start debugging: open autorest.powershell repo in vscode; press `F5`. You will see "Debugger attached." in your autorest console, then you can start debugging.
123+
The repository includes VS Code launch configurations in `.vscode/launch.json` for debugging TypeScript code.
76124

77125
### Testing
78126

0 commit comments

Comments
 (0)