Skip to content

Commit 9bb6ab7

Browse files
authored
Update .npmrc approach and locked dependencies (#46601)
- use just one .npmrc file - remove .yarnrc file - unnecessary since `npm` and `yarn` will both use the .npmrc file - (I originally created the .yarnrc when trying fixes for Dependabot updates) - enforce resolution from correct registry in all yarn.lock files - add line number for new CodeCheck errors - update `LogError` to take new `-LineNumber` parameter - bump all resolved dependencies to latest compatible versions - re-resolve everything but don't change any package.json files - add [email protected] as a dev dependency - avoid '... [email protected]" has unmet peer dependency "mitt@*"' errors and warnings - update generated JS files - changes likely the result of `npm` package version bumps - nit: ignore projects found after building e.g. for project template tests - previous code seemed designed for clean (CI) environments
1 parent 9068fcf commit 9bb6ab7

File tree

31 files changed

+1980
-1861
lines changed

31 files changed

+1980
-1861
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
registry=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/
2+
always-auth=true

.yarnrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

eng/scripts/CodeCheck.ps1

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ function LogError {
2626
[Parameter(Mandatory = $true, Position = 0)]
2727
[string]$message,
2828
[string]$FilePath,
29+
[string]$LineNumber, # Ignored if -FilePath not specified.
2930
[string]$Code
3031
)
3132
if ($env:TF_BUILD) {
3233
$prefix = "##vso[task.logissue type=error"
3334
if ($FilePath) {
3435
$prefix = "${prefix};sourcepath=$FilePath"
36+
if ($LineNumber) {
37+
$prefix = "${prefix};linenumber=$LineNumber"
38+
}
3539
}
3640
if ($Code) {
3741
$prefix = "${prefix};code=$Code"
@@ -40,7 +44,11 @@ function LogError {
4044
}
4145
$fullMessage = "error ${Code}: $message"
4246
if ($FilePath) {
43-
$fullMessage += " [$FilePath]"
47+
$fullMessage += " [$FilePath"
48+
if ($LineNumber) {
49+
$fullMessage += ":$LineNumber"
50+
}
51+
$fullMessage += "]"
4452
}
4553
Write-Host -f Red $fullMessage
4654
$script:errors += $fullMessage
@@ -68,7 +76,10 @@ try {
6876
# Ignore duplicates in submodules. These should be isolated from the rest of the build.
6977
# Ignore duplicates in the .ref folder. This is expected.
7078
Get-ChildItem -Recurse "$repoRoot/src/*.*proj" |
71-
Where-Object { $_.FullName -notmatch 'submodules' -and $_.FullName -notmatch 'node_modules' } |
79+
Where-Object {
80+
$_.FullName -NotLike '*\submodules\*' -and $_.FullName -NotLike '*\node_modules\*' -and
81+
$_.FullName -NotLike '*\bin\*' -and $_.FullName -NotLike '*\src\ProjectTemplates\*\content\*'
82+
} |
7283
Where-Object { (Split-Path -Leaf (Split-Path -Parent $_)) -ne 'ref' } |
7384
ForEach-Object {
7485
$fileName = [io.path]::GetFileNameWithoutExtension($_)
@@ -79,6 +90,23 @@ try {
7990
}
8091
}
8192

93+
#
94+
# Check for unexpected (not from dotnet-public-npm) yarn resolutions in lock files.
95+
#
96+
97+
$registry = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/'
98+
Get-ChildItem src\yarn.lock -Recurse |
99+
ForEach-Object FullName |
100+
Where-Object {$_ -NotLike '*\node_modules\*'} |
101+
ForEach-Object {
102+
# -List to limit complaints to one per file.
103+
Select-String '^ resolved ' $_ | Select-String -List -NotMatch $registry
104+
} |
105+
ForEach-Object {
106+
LogError -filePath "${_.Path}" -lineNumber $_.LineNumber `
107+
"Packages in yarn.lock file resolved from wrong registry. All dependencies must be resolved from $registry"
108+
}
109+
82110
#
83111
# Versions.props and Version.Details.xml
84112
#

src/Components/CustomElements/src/js/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Components/CustomElements/src/js/yarn.lock

Lines changed: 353 additions & 336 deletions
Large diffs are not rendered by default.

src/Components/Web.JS/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Components/Web.JS/@types/dotnet/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/dist/Release/blazor.webview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/Web.JS/yarn.lock

Lines changed: 353 additions & 336 deletions
Large diffs are not rendered by default.

src/Components/WebAssembly/Authentication.Msal/src/Interop/yarn.lock

Lines changed: 361 additions & 344 deletions
Large diffs are not rendered by default.

src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/yarn.lock

Lines changed: 356 additions & 339 deletions
Large diffs are not rendered by default.

src/Components/test/E2ETest/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Components/test/E2ETest/yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
"@types/node" "*"
3838

3939
"@types/node@*":
40-
version "18.11.18"
41-
resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f"
42-
integrity sha1-jfuX8Nojwik+VUxaUNYe8TTXaX8=
40+
version "18.13.0"
41+
resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/@types/node/-/node-18.13.0.tgz#0400d1e6ce87e9d3032c19eb6c58205b0d3f7850"
42+
integrity sha1-BADR5s6H6dMDLBnrbFggWw0/eFA=
4343

4444
"@types/node@^13.1.7":
4545
version "13.13.52"
@@ -265,9 +265,9 @@ graceful-fs@^4.1.6, graceful-fs@^4.2.0:
265265
integrity sha1-FH06AG2kyjzhRyjHrvwofDZ9emw=
266266

267267
http-cache-semantics@^4.0.0:
268-
version "4.1.0"
269-
resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390"
270-
integrity sha1-SekcXL82yblLz81xwj1SSex045A=
268+
version "4.1.1"
269+
resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
270+
integrity sha1-q+AvyymFRgvwMjvmZENuw0dqbVo=
271271

272272
http2-wrapper@^1.0.0-beta.5.2:
273273
version "1.0.3"
@@ -377,9 +377,9 @@ minimatch@^3.1.1:
377377
brace-expansion "^1.1.7"
378378

379379
minimist@^1.2.5:
380-
version "1.2.7"
381-
resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
382-
integrity sha1-2qHE2R9Qc5BDfGqLwBB45wAMTRg=
380+
version "1.2.8"
381+
resolved "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
382+
integrity sha1-waRk52kzAuCCoHXO4MBXdBrEdyw=
383383

384384
mkdirp@^1.0.4:
385385
version "1.0.4"

src/JSInterop/Microsoft.JSInterop.JS/src/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)