Don't publish too much of ClientApp (#672)

* Don't publish too much of ClientApp

* Fix scripts and remove extra publish items
This commit is contained in:
Ryan Brandenburg 2018-08-13 16:21:50 -07:00 коммит произвёл GitHub
Родитель 9618a59485
Коммит a431f8efa1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 15 добавлений и 28 удалений

Просмотреть файл

@ -1,7 +1,6 @@
$customHive = "$PSScriptRoot/CustomHive"
function Test-Template($templateName, $templateNupkg, $isSPA)
{
function Test-Template($templateName, $templateNupkg, $isSPA) {
$tmpDir = "$PSScriptRoot/tmp"
Remove-Item -Path $tmpDir -Recurse -ErrorAction Ignore
@ -13,18 +12,15 @@ function Test-Template($templateName, $templateNupkg, $isSPA)
New-Item -ErrorAction Ignore -Path $tmpDir -ItemType Directory
Push-Location $tmpDir
try {
Run-DotnetNew $templateName
if($isSPA)
{
Push-Location "ClientApp"
try {
npm install
}
finally {
Pop-Location
}
}
dotnet run
Run-DotnetNew $templateName, "--no-restore"
$csproj = "$tmpDir/tmp.csproj"
$csprojContent = Get-Content -Path $csproj -Raw
$csprojContent = $csprojContent -replace ('<Project Sdk="Microsoft.NET.Sdk.Web">', "<Project Sdk=""Microsoft.NET.Sdk.Web"">`n<Import Project=""$PSScriptRoot/../test/Templates.Test/bin/Release/netcoreapp2.2/TemplateTests.props"" />")
$csprojContent | Set-Content $csproj
dotnet publish
dotnet run bin\Release\netcoreapp2.2\publish\tmp.dll
}
finally {
Pop-Location

Просмотреть файл

@ -28,10 +28,7 @@
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**"
Exclude="$(SpaRoot)node_modules\**"
CopyToPublishDirectory="PreserveNewest"
CopyToOutputDirectory="PreserveNewest" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<!--/-:cnd:noEmit -->
@ -54,7 +51,7 @@
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**; $(SpaRoot)package.json" />
<DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
<DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>

Просмотреть файл

@ -25,10 +25,7 @@
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**"
Exclude="$(SpaRoot)node_modules\**"
CopyToPublishDirectory="PreserveNewest"
CopyToOutputDirectory="PreserveNewest" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<!--/-:cnd:noEmit -->

Просмотреть файл

@ -25,10 +25,7 @@
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**"
Exclude="$(SpaRoot)node_modules\**"
CopyToPublishDirectory="PreserveNewest"
CopyToOutputDirectory="PreserveNewest" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<!--/-:cnd:noEmit -->
@ -50,7 +47,7 @@
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)build\**; $(SpaRoot)build-ssr\**; $(SpaRoot)package.json" />
<DistFiles Include="$(SpaRoot)build\**; $(SpaRoot)build-ssr\**" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>