ServiceScaffold.psm1
Function New-Project() { [CmdletBinding()] param ( [string]$ProjectName, [switch]$AddAngular ) $folder = pwd $project = "$folder\$ProjectName" $api = "$project\api" $client = "$project\client" $testCsprojPath = "$api\test\$ProjectName.Api.Tests" $apiCsprojPath = "$api\src\$ProjectName.Api" $testCsproj = "$testCsprojPath\$ProjectName.Api.Tests.csproj" $apiCsproj = "$apiCsprojPath\$ProjectName.Api.csproj" <# Create project folders #> md $project md $api md $api\src md $api\test $additionalFolders = @("build", "client-ts", "docs", "samples", "specs") $additionalFolders | ForEach-Object { md $api\$_ ni $api\$_\.keep } # md $api\build; ni $api\build\.keep # md $api\docs # md $api\client-ts # md $api\samples # md $api\specs cd $api ni README.md cd $api\src dotnet new webapi --name $ProjectName".Api" if ($AddAngular -eq $true) { $appProject = "$ProjectName.App"; md $client cd $client ng new $appProject --minimal --routing --inline-style false --inline-template false --style=scss cd $appProject npm install } cd $api\test dotnet new xunit --name $ProjectName".Api.Tests" cd $api dotnet new sln --name $ProjectName dotnet sln add $testCsproj dotnet sln add $apiCsproj dotnet add $testCsproj reference $apiCsproj cd $api Invoke-WebRequest -Uri "https://www.gitignore.io/api/VisualStudio" | select -ExpandProperty content | Out-File -FilePath $(Join-Path -path $pwd -ChildPath ".gitignore") -Encoding ascii git init git add . git commit -m "Init" } # end of Function New-Project |