diff --git a/.gitignore b/.gitignore index 23ba01ebf0..585bd855b7 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,4 @@ build/temp/ # eof /src/Umbraco.Web.UI.Client/TESTS-*.xml +/src/ApiDocs/api/* diff --git a/build/build-docs.ps1 b/build/build-docs.ps1 new file mode 100644 index 0000000000..8cd3f090c7 --- /dev/null +++ b/build/build-docs.ps1 @@ -0,0 +1,44 @@ +$uenv=build/build.ps1 -get + +$src = "$($uenv.SolutionRoot)\src" +$tmp = $uenv.BuildTemp +$out = $uenv.BuildOutput +$DocFxJson = "$src\ApiDocs\docfx.json" +$DocFxSiteOutput = "$tmp\_site\*.*" + +################ Do the UI docs +$uenv.CompileBelle() + +"Moving to Umbraco.Web.UI.Client folder" +cd .\src\Umbraco.Web.UI.Client + +"Generating the docs and waiting before executing the next commands" +& gulp docs | Out-Null + +# change baseUrl +$BaseUrl = "https://our.umbraco.com/apidocs/v8/ui/" +$IndexPath = "./docs/api/index.html" +(Get-Content $IndexPath).replace('location.href.replace(rUrl, indexFile)', "`'" + $BaseUrl + "`'") | Set-Content $IndexPath + +# zip it +& $uenv.BuildEnv.Zip a -tzip -r "$out\ui-docs.zip" "$src\Umbraco.Web.UI.Client\docs\api\*.*" + + +################ Do the c# docs + +# Build the solution in debug mode +$SolutionPath = Join-Path -Path $src -ChildPath "umbraco.sln" +#$uenv.CompileUmbraco() + +#restore nuget packages +$uenv.RestoreNuGet() + +# run DocFx +$DocFx = $uenv.BuildEnv.DocFx + +Write-Host "$DocFxJson" +& $DocFx metadata $DocFxJson +& $DocFx build $DocFxJson + +# zip it +& $uenv.BuildEnv.Zip a -tzip -r "$out\csharp-docs.zip" $DocFxSiteOutput diff --git a/build/build.ps1 b/build/build.ps1 index 1088da33bc..55b686c98e 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -11,6 +11,11 @@ [Alias("loc")] [switch] $local = $false, + # enable docfx + [Parameter(Mandatory=$false)] + [Alias("doc")] + [switch] $docfx = $false, + # keep the build directories, don't clear them [Parameter(Mandatory=$false)] [Alias("c")] @@ -31,7 +36,7 @@ $ubuild = &"$PSScriptRoot\build-bootstrap.ps1" if (-not $?) { return } $ubuild.Boot($PSScriptRoot, - @{ Local = $local; }, + @{ Local = $local; WithDocFx = $docfx }, @{ Continue = $continue }) if ($ubuild.OnError()) { return } @@ -424,6 +429,53 @@ Write-Host "Prepare Azure Gallery" $this.CopyFile("$($this.SolutionRoot)\build\Azure\azuregalleryrelease.ps1", $this.BuildOutput) }) + + $ubuild.DefineMethod("PrepareCSharpDocs", + { + Write-Host "Prepare C# Documentation" + + $src = "$($this.SolutionRoot)\src" + $tmp = $this.BuildTemp + $out = $this.BuildOutput + $DocFxJson = Join-Path -Path $src "\ApiDocs\docfx.json" + $DocFxSiteOutput = Join-Path -Path $tmp "\_site\*.*" + + + #restore nuget packages + $this.RestoreNuGet() + # run DocFx + $DocFx = $this.BuildEnv.DocFx + + & $DocFx metadata $DocFxJson + & $DocFx build $DocFxJson + + # zip it + & $this.BuildEnv.Zip a -tzip -r "$out\csharp-docs.zip" $DocFxSiteOutput + }) + + $ubuild.DefineMethod("PrepareAngularDocs", + { + Write-Host "Prepare Angular Documentation" + + $src = "$($this.SolutionRoot)\src" + $out = $this.BuildOutput + + $this.CompileBelle() + + "Moving to Umbraco.Web.UI.Client folder" + cd .\src\Umbraco.Web.UI.Client + + "Generating the docs and waiting before executing the next commands" + & gulp docs | Out-Null + + # change baseUrl + $BaseUrl = "https://our.umbraco.com/apidocs/v8/ui/" + $IndexPath = "./docs/api/index.html" + (Get-Content $IndexPath).replace('location.href.replace(rUrl, indexFile)', "`'" + $BaseUrl + "`'") | Set-Content $IndexPath + + # zip it + & $this.BuildEnv.Zip a -tzip -r "$out\ui-docs.zip" "$src\Umbraco.Web.UI.Client\docs\api\*.*" + }) $ubuild.DefineMethod("Build", { @@ -456,6 +508,7 @@ if ($this.OnError()) { return } $this.PostPackageHook() if ($this.OnError()) { return } + Write-Host "Done" }) diff --git a/src/ApiDocs/docfx.json b/src/ApiDocs/docfx.json index 520622a0e0..76677d45d5 100644 --- a/src/ApiDocs/docfx.json +++ b/src/ApiDocs/docfx.json @@ -2,21 +2,20 @@ "metadata": [ { "src": [ - { + { + "src": "../", "files": [ "Umbraco.Core/Umbraco.Core.csproj", "Umbraco.Web/Umbraco.Web.csproj" ], "exclude": [ "**/obj/**", - "**/bin/**", - "_site/**" - ], - "cwd": "../src" + "**/bin/**" + ] } ], - "dest": "../apidocs/api", - "filter": "../apidocs/docfx.filter.yml" + "dest": "api", + "filter": "docfx.filter.yml" } ], "build": { @@ -35,19 +34,7 @@ "*.md" ], "exclude": [ - "obj/**", - "_site/**" - ] - } - ], - "resource": [ - { - "files": [ - "images/**" - ], - "exclude": [ - "obj/**", - "_site/**" + "obj/**" ] } ], @@ -57,8 +44,7 @@ "**.md" ], "exclude": [ - "obj/**", - "_site/**" + "obj/**" ] } ], @@ -67,9 +53,9 @@ "_enableSearch": true, "_disableContribution": false }, - "dest": "_site", + "dest": "../../build.tmp/_site", "template": [ "default", "umbracotemplate" ] } -} \ No newline at end of file +}