Skip to content

Commit 9bb6ab7

Browse files
authored
Update .npmrc approach and locked dependencies (dotnet#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 mitt@3.0.0 as a dev dependency - avoid '... chromium-bidi@0.4.3" 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

31 files changed

Lines changed: 1980 additions & 1861 deletions

File tree

src/Components/WebAssembly/Authentication.Msal/src/Interop/.npmrc renamed to .npmrc

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.

0 commit comments

Comments
 (0)