diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..49b7fe1 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,280 @@ +# Dev Container Guide + +This guide explains how to use the Dev Container configuration to create a portable VS Code development environment. + +## What is a Dev Container? + +A Dev Container (Development Container) allows you to use a Docker container as a full-featured development environment. This ensures everyone on your team has the same tools, dependencies, and configuration, regardless of their operating system. + +## Prerequisites + +Before you can use this Dev Container, you need: + +1. **Docker Desktop** (Windows/Mac) or **Docker Engine** (Linux) + - [Download Docker Desktop for Windows](https://www.docker.com/products/docker-desktop/) + - [Download Docker Desktop for Mac](https://www.docker.com/products/docker-desktop/) + - [Install Docker Engine on Linux](https://docs.docker.com/engine/install/) + +2. **Visual Studio Code** + - [Download VS Code](https://code.visualstudio.com/) + +3. **Dev Containers Extension** + - Install from VS Code: Search for "Dev Containers" in the Extensions view (Ctrl+Shift+X) + - Or install from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) + +## What's Included + +This Dev Container provides a complete development environment with: + +### Base Environment +- **.NET 10.0 SDK** - Latest .NET development tools +- **Node.js LTS** - JavaScript runtime with npm, yarn support +- **Git** - Version control +- **PowerShell** - Cross-platform shell and scripting + +### Development Tools +- **Docker Engine** (via docker-in-docker) - Build and run containers +- **Azure CLI** - Manage Azure resources +- **GitHub CLI** - Interact with GitHub from terminal +- **kubectl & Helm** - Kubernetes management tools + +### Pre-installed Global Tools +After container creation, these are automatically installed: +- **Angular CLI** - Angular framework +- **Vite** - Next-generation frontend tooling +- **dotnet-ef** - Entity Framework Core tools +- **Data API Builder** - Microsoft Data API builder +- **SqlPackage** - SQL Server deployment tool +- **Stryker** - Mutation testing tool +- **sw** - Software CLI tool + +### VS Code Extensions (32+ extensions) +All extensions from `post-install.ps1` are pre-installed, plus: +- C# and .NET development tools +- Database tools (MSSQL, SQL Database Projects) +- GitHub Copilot and PR tools +- Docker and Kubernetes tools (including Docker DX) +- Linting, formatting, and debugging tools +- React and Angular snippets +- Accessibility tools (VS Code Speech) +- And many more... + +### Port Forwarding +Pre-configured ports for common development scenarios: +- **3000** - React/Node.js applications +- **4200** - Angular applications +- **5000** - .NET HTTP +- **5001** - .NET HTTPS +- **8080, 8081** - General development servers + +## How to Use + +### Method 1: Open in Dev Container (Recommended) + +1. **Clone this repository** + ```bash + git clone https://github.com/softwareworkercom/winget.git + cd winget + ``` + +2. **Open in VS Code** + ```bash + code . + ``` + +3. **Reopen in Container** + - VS Code will detect the `.devcontainer` configuration + - A notification will appear: "Folder contains a Dev Container configuration file" + - Click **"Reopen in Container"** + + Or manually: + - Press `F1` or `Ctrl+Shift+P` + - Type "Dev Containers: Reopen in Container" + - Press Enter + +4. **Wait for Container Build** + - First time: 5-10 minutes (downloads image and installs tools) + - Subsequent times: 30-60 seconds + - You can see progress in the VS Code notification area + +5. **Start Developing!** + - All tools and extensions are ready + - Your code is mounted and synced automatically + - Terminal opens inside the container with all tools available + +### Method 2: Use GitHub Codespaces + +1. **Open in Codespaces** + - Go to the repository on GitHub + - Click the green **"Code"** button + - Select **"Codespaces"** tab + - Click **"Create codespace on main"** + +2. **Wait for Environment Setup** + - GitHub will build and start your dev environment in the cloud + - All tools and extensions load automatically + +3. **Develop in Browser or VS Code** + - Edit code directly in the browser + - Or click **"Open in VS Code Desktop"** for local experience + +### Method 3: Clone Repository in Container Volume + +For better performance on Windows/Mac: + +1. Press `F1` or `Ctrl+Shift+P` +2. Type "Dev Containers: Clone Repository in Container Volume" +3. Enter repository URL: `https://github.com/softwareworkercom/winget.git` +4. Wait for clone and container setup + +## Verifying Installation + +Once the container is running, open a new terminal in VS Code and verify: + +```bash +# Check .NET version +dotnet --version +# Should show .NET 10.x + +# Check Node.js version +node --version +# Should show v20.x or v22.x (LTS) + +# Check Docker +docker --version +# Should show Docker version + +# Check Azure CLI +az --version + +# Check kubectl +kubectl version --client + +# Check global .NET tools +dotnet tool list --global +# Should list: dotnet-ef, microsoft.dataapibuilder, microsoft.sqlpackage, dotnet-stryker, sw + +# Check global npm packages +npm list -g --depth=0 +# Should list: @angular/cli, vite +``` + +## Working with the Container + +### File Access +- Your code is automatically synced between your host machine and the container +- Changes made in VS Code are immediately reflected in both locations +- SSH keys and Git config are mounted read-only for authentication + +### Running Commands +All commands run inside the container: + +```bash +# .NET commands +dotnet new webapi -n MyApi +dotnet run + +# Node.js commands +npm install +npm start + +# Angular commands +ng new my-app +ng serve + +# Docker commands +docker build -t myapp . +docker run -p 8080:80 myapp + +# Git commands (uses your host credentials) +git status +git commit -m "Your changes" +git push +``` + +### Opening Ports +Ports are automatically forwarded. When your app starts: +- VS Code detects the port +- Shows a notification +- Forwards it to your host machine +- Access via `localhost:PORT` in your host browser + +## Troubleshooting + +### Container Won't Start +- **Check Docker is running**: `docker ps` should work in host terminal +- **Check Docker resources**: Ensure Docker has enough memory (8GB+ recommended) +- **Rebuild container**: Command Palette → "Dev Containers: Rebuild Container" + +### Extensions Not Loading +- Wait for post-create command to finish (check terminal output) +- Manually reload: Command Palette → "Developer: Reload Window" + +### Slow Performance (Windows/Mac) +- Use "Clone Repository in Container Volume" method +- Or move code to WSL2 (Windows) for better performance + +### Missing Tools +- Check terminal output for post-create command errors +- Manually run: `npm install -g @angular/cli vite` +- Or: `dotnet tool install --global dotnet-ef` + +### Port Already in Use +- Stop other services using the same port on host +- Or change port in your application config + +## Customizing the Container + +You can customize `.devcontainer/devcontainer.json`: + +### Add More Extensions +```json +"customizations": { + "vscode": { + "extensions": [ + "existing.extensions", + "your.new-extension" + ] + } +} +``` + +### Add More Features +```json +"features": { + "ghcr.io/devcontainers/features/python:1": { + "version": "3.11" + } +} +``` + +### Change Post-Create Commands +```json +"postCreateCommand": "your custom commands here" +``` + +## Additional Resources + +- [VS Code Dev Containers Documentation](https://code.visualstudio.com/docs/devcontainers/containers) +- [Dev Container Specification](https://containers.dev/) +- [Available Dev Container Features](https://containers.dev/features) +- [GitHub Codespaces Documentation](https://docs.github.com/en/codespaces) +- [Docker Documentation](https://docs.docker.com/) + +## Benefits + +✅ **Consistent Environment** - Same setup across all machines and team members + +✅ **No Local Installation** - No need to install .NET, Node.js, or other tools on host + +✅ **Isolation** - Keep development dependencies separate from your system + +✅ **Portable** - Take your environment anywhere (Windows, Mac, Linux, cloud) + +✅ **Quick Onboarding** - New team members ready in minutes, not hours + +✅ **Version Control** - Dev environment configuration is versioned with your code + +--- + +**Need Help?** Open an issue in the repository or check the VS Code Dev Containers documentation. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..49015d5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,122 @@ +{ + "name": "WinGet Development Environment", + "image": "mcr.microsoft.com/devcontainers/dotnet:10.0", + + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "lts", + "nodeGypDependencies": true, + "installYarnUsingApt": true + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "latest", + "dockerDashComposeVersion": "v2" + }, + "ghcr.io/devcontainers/features/azure-cli:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/github-cli:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/powershell:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { + "version": "latest", + "helm": "latest", + "minikube": "none" + } + }, + + "customizations": { + "vscode": { + "settings": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "extensions": [ + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", + "ms-dotnettools.vscodeintellicode-csharp", + "ms-mssql.mssql", + "ms-mssql.sql-database-projects-vscode", + "ms-vscode-remote.remote-containers", + "ms-vscode-remote.remote-wsl", + "AmazonWebServices.aws-toolkit-vscode", + "GitHub.copilot-chat", + "GitHub.vscode-pull-request-github", + "GitHub.vscode-github-actions", + "ms-kubernetes-tools.vscode-kubernetes-tools", + "ms-playwright.playwright", + "ms-vscode.PowerShell", + "eamodio.gitlens", + "ms-azuretools.vscode-docker", + "docker.docker", + "ms-vscode.vscode-speech", + "dbaeumer.vscode-eslint", + "DavidAnson.vscode-markdownlint", + "SonarSource.sonarlint-vscode", + "garrytrinder.dev-proxy-toolkit", + "Postman.postman-for-vscode", + "esbenp.prettier-vscode", + "burkeholland.simple-react-snippets", + "dsznajder.es7-react-js-snippets", + "ms-vsliveshare.vsliveshare", + "ms-edgedevtools.vscode-edge-devtools", + "pflannery.vscode-versionlens", + "usernamehw.errorlens", + "quicktype.quicktype", + "bierner.markdown-mermaid", + "ms-dotnettools.dotnet-interactive-vscode" + ] + } + }, + + "postCreateCommand": "bash -c 'npm install -g @angular/cli vite && dotnet tool install --global dotnet-ef && dotnet tool install --global microsoft.dataapibuilder && dotnet tool install --global microsoft.sqlpackage && dotnet tool install --global dotnet-stryker && dotnet tool install --global sw'", + + "forwardPorts": [ + 3000, + 4200, + 5000, + 5001, + 8080, + 8081 + ], + + "portsAttributes": { + "3000": { + "label": "React/Node.js", + "onAutoForward": "notify" + }, + "4200": { + "label": "Angular", + "onAutoForward": "notify" + }, + "5000": { + "label": ".NET HTTP", + "onAutoForward": "notify" + }, + "5001": { + "label": ".NET HTTPS", + "onAutoForward": "notify" + }, + "8080": { + "label": "Development Server", + "onAutoForward": "notify" + }, + "8081": { + "label": "Development Server Alt", + "onAutoForward": "notify" + } + }, + + "remoteUser": "vscode", + + "mounts": [ + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,readonly,type=bind,consistency=cached", + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/home/vscode/.gitconfig,readonly,type=bind,consistency=cached" + ] +} diff --git a/.wslconfig b/.wslconfig new file mode 100644 index 0000000..ea56839 --- /dev/null +++ b/.wslconfig @@ -0,0 +1,5 @@ +[wsl2] +memory=8GB # Limits VM memory +processors=4 # Limits number of CPUs +swap=4GB # Swap file size used when memory limit is exceeded +localhostForwarding=true # Enables localhost forwarding between WSL and Windows diff --git a/README.md b/README.md index c5f6ee5..0fd86f3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ If you find this project helpful, please give it a star 🌟 ```powershell if (Test-Path 'winget-config.yaml') { Remove-Item -Path 'winget-config.yaml' -Force }; Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/softwareworkercom/winget/refs/heads/main/winget-config.yaml' -OutFile 'winget-config.yaml' -Headers @{"Cache-Control"="no-cache"}; winget configure -f winget-config.yaml +if (Test-Path '.wslconfig') { Remove-Item -Path '.wslconfig' -Force }; Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/softwareworkercom/winget/refs/heads/main/.wslconfig' -OutFile '.wslconfig' -Headers @{"Cache-Control"="no-cache"}; if (Test-Path 'post-install.ps1') { Remove-Item -Path 'post-install.ps1' -Force }; Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/softwareworkercom/winget/refs/heads/main/post-install.ps1' -OutFile 'post-install.ps1' -Headers @{"Cache-Control"="no-cache"}; .\post-install.ps1 ``` @@ -30,9 +31,9 @@ if (Test-Path 'post-install.ps1') { Remove-Item -Path 'post-install.ps1' -Force Here’s the list of applications that will be installed (based on the `winget-config.yaml`): -1. **Visual Studio 2022 Community** +1. **Visual Studio 2026 Community** 2. **Visual Studio Code** -3. **.NET Core 9 SDK** +3. **.NET Core 10 SDK** 4. **Git** 5. **GitHub Desktop** 6. **NVM for Windows** @@ -40,7 +41,7 @@ Here’s the list of applications that will be installed (based on the `winget-c 8. **Amazon NoSQL Workbench** 9. **Microsoft SQL Server Management Studio (SSMS)** 10. **Microsoft SqlPackage** -11. **Docker Desktop** +11. **Podman Desktop** 12. **Obsidian** 13. **ShareX** 14. **Nuget CLI** @@ -62,10 +63,17 @@ Here’s the list of applications that will be installed (based on the `post-ins 1. **Node.js (LTS)** via NVM 2. **Angular CLI** 3. **React CLI** -4. **Visual Studio Code Extensions** (including C#, MSSQL, Remote Containers, Remote WSL, AWS Toolkit, GitHub Copilot Chat, Kubernetes Tools, Playwright, PowerShell, and Postman) -5. **Internet Information Services (IIS)** (multiple features enabled, such as ASP.NET 4.5, CGI, WebSockets, etc.) -6. **PSReadLine** -7. **Windows Subsystem for Linux (WSL) 2** with **Ubuntu** +4. **.NET Tools** (including Entity Framework Core, Data API Builder, SqlPackage, Stryker) +5. **.NET Templates** (including Microsoft.Build.Sql.Templates for SQL Database Projects) +6. **Visual Studio Code Extensions** (including C#, MSSQL, Remote Containers, Remote WSL, AWS Toolkit, GitHub Copilot Chat, Kubernetes Tools, Playwright, PowerShell, and Postman) +7. **Internet Information Services (IIS)** (multiple features enabled, such as ASP.NET 4.5, CGI, WebSockets, etc.) +8. **PSReadLine** +9. **Windows Subsystem for Linux (WSL 2)** with **Ubuntu** +10. **WSL Configuration** - Configures WSL 2 with optimized settings: + - 8GB memory limit + - 4 CPU processors + - 4GB swap + - localhost forwarding enabled ## Documentation diff --git a/post-install.ps1 b/post-install.ps1 index 6f9f4d8..0ca0ca5 100644 --- a/post-install.ps1 +++ b/post-install.ps1 @@ -19,6 +19,9 @@ dotnet tool update --global microsoft.dataapibuilder dotnet tool update -g microsoft.sqlpackage # Required to generate DACPAC files dotnet tool update -g dotnet-stryker # https://stryker-mutator.io/docs/stryker-net/introduction/ +# Install .NET Templates +dotnet new install Microsoft.Build.Sql.Templates + ################################################################################################################################################ # Install VSCode Extensions @@ -111,11 +114,11 @@ Copy-Item -Path ".\settings.json" ` # Import Visual Studio Workloads ################################################################################################################################################ Write-Host "Download vs_community.exe to $outFilePath." -$downloadUrl = "https://aka.ms/vs/17/release/vs_community.exe" +$downloadUrl = "https://aka.ms/vs/18/release/vs_community.exe" $outFilePath = ".\vs_community.exe" Invoke-WebRequest -Uri $downloadUrl -OutFile $outFilePath -UseBasicParsing -Write-Host "Import Visual Studio 2022 Configuration" +Write-Host "Import Visual Studio 2026 Configuration" .\vs_community.exe --config ".\workloads.vsconfig" --passive --norestart ################################################################################################################################################ @@ -125,3 +128,17 @@ dism /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart wsl --install wsl --set-default-version 2 wsl --install -d Ubuntu + +# WSL Configuration +################################################################################################################################################ +Write-Host "Configure WSL settings" + +if (Test-Path ".\.wslconfig") { + Copy-Item -Path ".\.wslconfig" ` + -Destination "$env:USERPROFILE\.wslconfig" ` + -Force ` + -Verbose +} else { + Write-Warning ".wslconfig file not found in current directory" +} +################################################################################################################################################ diff --git a/winget-config.yaml b/winget-config.yaml index af279aa..d92c581 100644 --- a/winget-config.yaml +++ b/winget-config.yaml @@ -20,10 +20,10 @@ properties: - resource: Microsoft.WinGet.DSC/WinGetPackage id: vsPackage directives: - description: Install Visual Studio 2022 Community + description: Install Visual Studio 2026 Community allowPrerelease: false settings: - id: Microsoft.VisualStudio.2022.Community + id: Microsoft.VisualStudio.2026.Community source: winget - resource: Microsoft.WinGet.DSC/WinGetPackage @@ -45,12 +45,12 @@ properties: source: winget - resource: Microsoft.WinGet.DSC/WinGetPackage - id: dotnetCore9 + id: dotnetCore10 directives: - description: Install .NET Core 9 SDK + description: Install .NET Core 10 SDK allowPrerelease: false settings: - id: Microsoft.DotNet.SDK.9 + id: Microsoft.DotNet.SDK.10 source: winget - resource: Microsoft.WinGet.DSC/WinGetPackage @@ -111,12 +111,12 @@ properties: source: winget - resource: Microsoft.WinGet.DSC/WinGetPackage - id: dockerDesktopPackage + id: podmanDesktopPackage directives: - description: Install Docker Desktop + description: Install Podman Desktop allowPrerelease: false settings: - id: Docker.DockerDesktop + id: RedHat.Podman-Desktop source: winget - resource: Microsoft.WinGet.DSC/WinGetPackage diff --git a/workloads.vsconfig b/workloads.vsconfig index 1eedf8d..380d0de 100644 --- a/workloads.vsconfig +++ b/workloads.vsconfig @@ -29,6 +29,7 @@ "Component.Microsoft.Web.LibraryManager", "Component.Microsoft.WebTools.BrowserLink.WebLivePreview", "Microsoft.VisualStudio.ComponentGroup.Web", + "Microsoft.NetCore.Component.Runtime.10.0", "Microsoft.NetCore.Component.Runtime.9.0", "Microsoft.NetCore.Component.Runtime.8.0", "Microsoft.NetCore.Component.SDK", @@ -49,7 +50,7 @@ "Microsoft.VisualStudio.Component.DiagnosticTools", "Microsoft.VisualStudio.Component.EntityFramework", "Microsoft.VisualStudio.Component.Debugger.JustInTime", - "Component.Microsoft.VisualStudio.LiveShare.2022", + "Component.Microsoft.VisualStudio.LiveShare.2026", "Microsoft.VisualStudio.Component.WslDebugging", "Microsoft.VisualStudio.Component.IntelliCode", "Component.VisualStudio.GitHub.Copilot",