Go back to checked-in minified .js files (#56982)

* Go back to checked-in minified .js files

* Remove update-npm-deps script

* Remove CompareMinifiedJsFiles script

* Undo signalr changes

* Fix again

* Undo more stuff

* Try installing node

* Add update-npm-deps back
This commit is contained in:
William Godbe 2024-07-25 12:27:40 -07:00 коммит произвёл GitHub
Родитель d98caa8994
Коммит 98fca5e3b0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
18 изменённых файлов: 52 добавлений и 85 удалений

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

@ -459,7 +459,6 @@ stages:
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
installNodeJs: false
disableComponentGovernance: true
artifacts:
- name: Linux_musl_x64_Logs_Attempt_$(System.JobAttempt)
@ -556,9 +555,6 @@ stages:
beforeBuild:
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
displayName: Setup IISExpress test certificates and schema
afterBuild:
- powershell: ./eng/scripts/CompareMinifiedJsFiles.ps1
displayName: Check for changes in generated minified .js files
artifacts:
- name: Windows_Test_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/

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

@ -524,7 +524,6 @@ extends:
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
installNodeJs: false
disableComponentGovernance: true
artifacts:
- name: Linux_musl_x64_Logs_Attempt_$(System.JobAttempt)

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

@ -25,8 +25,6 @@ variables:
value: true
- name: _TeamName
value: AspNetCore
- name: npm_config_cache
value: src/submodules/Node-Externals/cache
- name: PUPPETEER_SKIP_DOWNLOAD
value: 1
- template: /eng/common/templates/variables/pool-providers.yml
@ -45,7 +43,7 @@ jobs:
displayName: Update submodules
- script: ./restore.sh
displayName: Run restore.sh
- script: npm ci --offline
- script: npm ci
displayName: NPM install
- script: npm run build
displayName: Build JS

3
.github/dependabot.yml поставляемый
Просмотреть файл

@ -45,9 +45,6 @@ updates:
commit-message:
prefix: "[main] "
include: scope
ignore:
# Don't auto-update the Node-Externals submodule
- dependency-name: "src/submodules/Node-Externals"
labels:
- area-infrastructure

11
.gitmodules поставляемый
Просмотреть файл

@ -5,13 +5,4 @@
[submodule "src/submodules/MessagePack-CSharp"]
path = src/submodules/MessagePack-CSharp
url = https://github.com/aspnet/MessagePack-CSharp.git
branch = master
[submodule "Node-Externals"]
path = src/submodules/Node-Externals
url = https://github.com/dotnet/Node-Externals
branch = main
depth = 1
[submodule "src/submodules/BlazorMinifiedJs"]
path = src/submodules/BlazorMinifiedJs
url = https://github.com/dotnet/BlazorMinifiedJs
branch = main
branch = master

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

@ -103,11 +103,11 @@
<PropertyGroup>
<!-- Disable installing puppeteer browsers when running in source build -->
<_AdditionalEnvironmentVariable Condition="$(ArcadeBuildFromSource) == 'true'">PUPPETEER_SKIP_DOWNLOAD=1;npm_config_cache=$(RepoRoot)src/submodules/Node-Externals/cache</_AdditionalEnvironmentVariable>
<_AdditionalEnvironmentVariable Condition="$(ArcadeBuildFromSource) == 'true'">PUPPETEER_SKIP_DOWNLOAD=1</_AdditionalEnvironmentVariable>
</PropertyGroup>
<Exec
Command="npm ci --offline"
Command="npm ci"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
EnvironmentVariables="$(_AdditionalEnvironmentVariable)" />

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

@ -16,21 +16,13 @@
<ContainsFunctionalTestAssets>false</ContainsFunctionalTestAssets>
<BuildHelixPayload>false</BuildHelixPayload>
<!-- Skip puppeteer tests until https://github.com/dotnet/aspnetcore/issues/54176 is resolved -->
<_NpmAdditionalEnvironmentVariables>PUPPETEER_SKIP_DOWNLOAD=1;npm_config_cache=$(RepoRoot)src/submodules/Node-Externals/cache</_NpmAdditionalEnvironmentVariables>
<_NpmAdditionalEnvironmentVariables>PUPPETEER_SKIP_DOWNLOAD=1</_NpmAdditionalEnvironmentVariables>
</PropertyGroup>
<Target Name="_VerifyNPMCache" Condition="$(ContinuousIntegrationBuild) == 'true'" >
<Message Text="Verifying NPM cache..." Importance="high" />
<Exec
Command="npm cache verify"
WorkingDirectory="$(MSBuildThisFileDirectory).."
EnvironmentVariables="$(_NpmAdditionalEnvironmentVariables)" />
</Target>
<Target Name="Restore" DependsOnTargets="_VerifyNPMCache">
<Target Name="Restore">
<Message Text="Restoring NPM packages..." Importance="high" />
<Exec
Command="npm ci --offline"
Command="npm ci"
WorkingDirectory="$(MSBuildThisFileDirectory).."
EnvironmentVariables="$(_NpmAdditionalEnvironmentVariables)" />
</Target>

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

@ -1,26 +0,0 @@
[string[]] $errors = @()
function _compareFiles($fileName) {
Write-Host "Comparing contents for $fileName"
$repoRoot = Resolve-Path "$PSScriptRoot/../.."
$localFile = "$repoRoot/src/Components/Web.JS/dist/Release/$fileName"
$submoduleFile = "$repoRoot/src/submodules/BlazorMinifiedJs/src/$fileName"
$delta = Compare-Object -ReferenceObject ((Get-Content -Path $submoduleFile).trim()) -DifferenceObject ((Get-Content -Path $localFile).trim())
if (![string]::IsNullOrEmpty($delta)) {
$script:errors += "Diff found in $fileName, please see https://github.com/dotnet/aspnetcore/blob/main/docs/UpdatingMinifiedJsFiles.md for remediation steps"
}
}
$MinifiedJsFiles = "blazor.web.js","blazor.server.js","blazor.webview.js"
foreach ($JsFile in $MinifiedJsFiles) {
_compareFiles -fileName $JsFile
}
foreach ($err in $errors) {
Write-Host -f Red $err
}
if ($errors) {
exit 1
}

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

@ -60,16 +60,22 @@
<Reference Include="Microsoft.Extensions.FileProviders.Embedded" />
</ItemGroup>
<Target Name="_AddEmbeddedBlazorWebJS" BeforeTargets="_CalculateEmbeddedFilesManifestInputs">
<PropertyGroup>
<BlazorWebJSFilename>blazor.web.js</BlazorWebJSFilename>
<!-- Microsoft.AspNetCore.Components.Web.JS.npmproj always capitalizes the directory name. -->
<BlazorWebJSFile Condition=" '$(Configuration)' == 'Debug' ">..\..\Web.JS\dist\Debug\$(BlazorWebJSFilename)</BlazorWebJSFile>
<BlazorWebJSFile Condition=" '$(Configuration)' != 'Debug' ">..\..\Web.JS\dist\Release\$(BlazorWebJSFilename)</BlazorWebJSFile>
</PropertyGroup>
<!-- blazor.web.js should exist after eng/Npm.Workspace.nodeproj builds. Fall back if not. -->
<Target Name="_CheckBlazorWebJSPath" AfterTargets="ResolveProjectReferences" Condition=" !EXISTS('$(BlazorWebJSFile)') ">
<Warning Text="'$(BlazorWebJSFile)' does not exist. Falling back to checked-in copy." />
<PropertyGroup>
<BlazorWebJSFilename>blazor.web.js</BlazorWebJSFilename>
<BlazorWebJSFile Condition=" '$(Configuration)' == 'Debug' ">$(MSBuildThisFileDirectory)..\..\Web.JS\dist\Debug\$(BlazorWebJSFilename)</BlazorWebJSFile>
<BlazorWebJSFile Condition=" '$(Configuration)' != 'Debug' ">$(MSBuildThisFileDirectory)..\..\Web.JS\dist\Release\$(BlazorWebJSFilename)</BlazorWebJSFile>
<BlazorWebJSFile Condition="!Exists('$(BlazorWebJSFile)') and '$(BuildNodeJS)' != 'true' ">$(RepoRoot)src\submodules\BlazorMinifiedJs\src\$(BlazorWebJSFilename)</BlazorWebJSFile>
<BlazorWebJSFile>..\..\Web.JS\dist\Release\$(BlazorWebJSFilename)</BlazorWebJSFile>
</PropertyGroup>
</Target>
<Warning Condition="!Exists('$(BlazorWebJSFile)')" Text="'$(BlazorWebJSFile)' does not exist. Ensure the JS assets have been build by running 'npm run build' from the repository root." />
<Target Name="_AddEmbeddedBlazorWebJS" AfterTargets="_CheckBlazorWebJSPath">
<ItemGroup>
<EmbeddedResource Include="$(BlazorWebJSFile)" LogicalName="_framework/$(BlazorWebJSFilename)" />
<EmbeddedResource Include="$(BlazorWebJSFile).map" LogicalName="_framework/$(BlazorWebJSFilename).map" Condition="Exists('$(BlazorWebJSFile).map')" />

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

@ -98,16 +98,22 @@
<Compile Include="$(RepoRoot)src\Shared\Components\ProtectedPrerenderComponentApplicationStore.cs" />
</ItemGroup>
<Target Name="_AddEmbeddedBlazor" BeforeTargets="_CalculateEmbeddedFilesManifestInputs">
<PropertyGroup>
<BlazorServerJSFilename>blazor.server.js</BlazorServerJSFilename>
<!-- Microsoft.AspNetCore.Components.Web.JS.npmproj always capitalizes the directory name. -->
<BlazorServerJSFile Condition=" '$(Configuration)' == 'Debug' ">..\..\Web.JS\dist\Debug\$(BlazorServerJSFilename)</BlazorServerJSFile>
<BlazorServerJSFile Condition=" '$(Configuration)' != 'Debug' ">..\..\Web.JS\dist\Release\$(BlazorServerJSFilename)</BlazorServerJSFile>
</PropertyGroup>
<!-- blazor.server.js should exist after eng/Npm.Workspace.nodeproj builds. Fall back if not. -->
<Target Name="_CheckBlazorServerJSPath" AfterTargets="ResolveProjectReferences" Condition=" !EXISTS('$(BlazorServerJSFile)') ">
<Warning Text="'$(BlazorServerJSFile)' does not exist. Falling back to checked-in copy." />
<PropertyGroup>
<BlazorServerJSFilename>blazor.server.js</BlazorServerJSFilename>
<BlazorServerJSFile Condition=" '$(Configuration)' == 'Debug' ">$(MSBuildThisFileDirectory)..\..\Web.JS\dist\Debug\$(BlazorServerJSFilename)</BlazorServerJSFile>
<BlazorServerJSFile Condition=" '$(Configuration)' != 'Debug' ">$(MSBuildThisFileDirectory)..\..\Web.JS\dist\Release\$(BlazorServerJSFilename)</BlazorServerJSFile>
<BlazorServerJSFile Condition="!Exists('$(BlazorServerJSFile)') and '$(BuildNodeJS)' != 'true' ">$(RepoRoot)src\submodules\BlazorMinifiedJs\src\$(BlazorServerJSFilename)</BlazorServerJSFile>
<BlazorServerJSFile>..\..\Web.JS\dist\Release\$(BlazorServerJSFilename)</BlazorServerJSFile>
</PropertyGroup>
</Target>
<Warning Condition="!Exists('$(BlazorServerJSFile)')" Text="'$(BlazorServerJSFile)' does not exist. Ensure the JS assets have been build by running 'npm run build' from the repository root." />
<Target Name="_AddEmbeddedBlazor" AfterTargets="_CheckBlazorServerJSPath">
<ItemGroup>
<EmbeddedResource Include="$(BlazorServerJSFile)" LogicalName="_framework/$(BlazorServerJSFilename)" />
<EmbeddedResource Include="$(BlazorServerJSFile).map" LogicalName="_framework/$(BlazorServerJSFilename).map" Condition="Exists('$(BlazorServerJSFile).map')" />

5
src/Components/Web.JS/.gitignore поставляемый
Просмотреть файл

@ -1,3 +1,4 @@
node_modules/
dist/
dist/
dist/Debug/
dist/Release/blazor.webassembly.js
dist/Release/blazor.webview.js

1
src/Components/Web.JS/dist/Release/blazor.server.js сгенерированный поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
src/Components/Web.JS/dist/Release/blazor.web.js сгенерированный поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
src/Components/Web.JS/dist/Release/blazor.webassembly.js сгенерированный поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

1
src/Components/Web.JS/dist/Release/blazor.webview.js сгенерированный поставляемый Normal file

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -56,17 +56,22 @@
<UsingTask AssemblyFile="$(_FileProviderTaskAssembly)" TaskName="Microsoft.Extensions.FileProviders.Embedded.Manifest.Task.GenerateEmbeddedResourcesManifest" />
<Target Name="_AddEmbeddedBlazorWebView" BeforeTargets="_CalculateEmbeddedFilesManifestInputs">
<PropertyGroup>
<BlazorWebViewJSFilename>blazor.webview.js</BlazorWebViewJSFilename>
<!-- Microsoft.AspNetCore.Components.Web.JS.npmproj always capitalizes the directory name. -->
<BlazorWebViewJSFile Condition=" '$(Configuration)' == 'Debug' ">..\..\..\Web.JS\dist\Debug\$(BlazorWebViewJSFilename)</BlazorWebViewJSFile>
<BlazorWebViewJSFile Condition=" '$(Configuration)' != 'Debug' ">..\..\..\Web.JS\dist\Release\$(BlazorWebViewJSFilename)</BlazorWebViewJSFile>
</PropertyGroup>
<!-- blazor.webview.js should exist after eng/Npm.Workspace.nodeproj builds. Fall back if not. -->
<Target Name="_CheckBlazorWebViewJSPath" AfterTargets="ResolveProjectReferences" Condition=" !EXISTS('$(BlazorWebViewJSFile)') ">
<Warning Text="'$(BlazorWebViewJSFile)' does not exist. Falling back to checked-in copy." />
<PropertyGroup>
<BlazorWebViewJSFilename>blazor.webview.js</BlazorWebViewJSFilename>
<BlazorWebViewJSFile Condition=" '$(Configuration)' == 'Debug' ">$(MSBuildThisFileDirectory)..\..\..\Web.JS\dist\Debug\$(BlazorWebViewJSFilename)</BlazorWebViewJSFile>
<BlazorWebViewJSFile Condition=" '$(Configuration)' != 'Debug' ">$(MSBuildThisFileDirectory)..\..\..\Web.JS\dist\Release\$(BlazorWebViewJSFilename)</BlazorWebViewJSFile>
<BlazorWebViewJSFile Condition="!Exists('$(BlazorWebViewJSFile)') and '$(BuildNodeJS)' != 'true' ">$(RepoRoot)src\submodules\BlazorMinifiedJs\src\$(BlazorWebViewJSFilename)</BlazorWebViewJSFile>
<BlazorWebViewJSFile>..\..\..\Web.JS\dist\Release\$(BlazorWebViewJSFilename)</BlazorWebViewJSFile>
</PropertyGroup>
</Target>
<Warning Condition="!Exists('$(BlazorWebViewJSFile)')" Text="'$(BlazorWebViewJSFile)' does not exist. Ensure the JS assets have been build by running 'npm run build' from the repository root." />
<Target Name="_AddEmbeddedBlazorWebView" BeforeTargets="_CalculateEmbeddedFilesManifestInputs" DependsOnTargets="_CheckBlazorWebViewJSPath">
<ItemGroup>
<EmbeddedResource Include="blazor.modules.json" LogicalName="_framework/blazor.modules.json" />
<EmbeddedResource Include="$(BlazorWebViewJSFile)" LogicalName="_framework/$(BlazorWebViewJSFilename)" />

@ -1 +0,0 @@
Subproject commit 4cc83c376bb0d472d0c923a45f7dec7af6426d4c

@ -1 +0,0 @@
Subproject commit eb33ea21fa1013d5e97951725e9d5c52c5a6a026