diff --git a/eng/common/pipelines/ci.yml b/eng/common/pipelines/ci.yml index 008fec91a32..a3d5cf414b8 100644 --- a/eng/common/pipelines/ci.yml +++ b/eng/common/pipelines/ci.yml @@ -29,7 +29,10 @@ extends: displayName: Install Node.js inputs: versionSpec: 22.x - - script: npm install -g pnpm # Pnpm manage-package-manager-versions will respect packageManager field + + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + + - script: npm install -g pnpm@10.30.2 # Pnpm manage-package-manager-versions will respect packageManager field displayName: Install pnpm - script: pnpm install diff --git a/eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml b/eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml new file mode 100644 index 00000000000..3fa699b387d --- /dev/null +++ b/eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml @@ -0,0 +1,41 @@ +parameters: + - name: npmrcPath + type: string + # When empty, defaults to the agent user's .npmrc ($HOME/.npmrc on + # Linux/macOS, %USERPROFILE%\.npmrc on Windows) so every subsequent + # npm / pnpm / npx call in the job inherits the registry + auth. + default: "" + - name: registryUrl + type: string + default: "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/" + - name: CustomCondition + type: string + default: succeeded() + - name: ServiceConnection + type: string + default: "" + +steps: + - pwsh: | + $npmrcPath = '${{ parameters.npmrcPath }}' + if (-not $npmrcPath) { $npmrcPath = Join-Path $HOME '.npmrc' } + + Write-Host "Creating .npmrc file $npmrcPath for registry ${{ parameters.registryUrl }}" + $parentFolder = Split-Path -Path $npmrcPath -Parent + + if ($parentFolder -and -not (Test-Path $parentFolder)) { + Write-Host "Creating folder $parentFolder" + New-Item -Path $parentFolder -ItemType Directory | Out-Null + } + + "registry=${{ parameters.registryUrl }}" | Out-File $npmrcPath + Write-Host "##vso[task.setvariable variable=resolvedNpmrcPath]$npmrcPath" + displayName: "Create .npmrc" + condition: ${{ parameters.CustomCondition }} + + - task: npmAuthenticate@0 + displayName: Authenticate .npmrc + condition: ${{ parameters.CustomCondition }} + inputs: + workingFile: $(resolvedNpmrcPath) + azureDevOpsServiceConnection: ${{ parameters.ServiceConnection }} diff --git a/eng/emitters/pipelines/templates/stages/emitter-stages.yml b/eng/emitters/pipelines/templates/stages/emitter-stages.yml index 7d73d17a2cc..2adecca67ba 100644 --- a/eng/emitters/pipelines/templates/stages/emitter-stages.yml +++ b/eng/emitters/pipelines/templates/stages/emitter-stages.yml @@ -326,10 +326,7 @@ stages: displayName: Download build artifacts # Always publish to internal feed - - template: /eng/emitters/pipelines/templates/steps/create-authenticated-npmrc.yml - parameters: - npmrcPath: $(buildArtifactsPath)/packages/.npmrc - registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/ + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml # publish to devops feed - pwsh: | @@ -389,6 +386,7 @@ stages: inputs: versionSpec: "22.x" checkLatest: true + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml - script: npm ci displayName: Install emitter dependencies for playground bundle workingDirectory: $(Build.SourcesDirectory)/${{ parameters.PackagePath }} diff --git a/eng/emitters/pipelines/templates/steps/build-step.yml b/eng/emitters/pipelines/templates/steps/build-step.yml index abac27e71c6..d723de94d4b 100644 --- a/eng/emitters/pipelines/templates/steps/build-step.yml +++ b/eng/emitters/pipelines/templates/steps/build-step.yml @@ -59,6 +59,8 @@ steps: - checkout: self + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - task: NodeTool@0 displayName: Install Node.js retryCountOnTaskFailure: 3 diff --git a/eng/emitters/pipelines/templates/steps/create-authenticated-npmrc.yml b/eng/emitters/pipelines/templates/steps/create-authenticated-npmrc.yml deleted file mode 100644 index d315a7d6234..00000000000 --- a/eng/emitters/pipelines/templates/steps/create-authenticated-npmrc.yml +++ /dev/null @@ -1,23 +0,0 @@ -parameters: - - name: npmrcPath - type: string - - name: registryUrl - type: string - -steps: - - pwsh: | - Write-Host "Creating .npmrc file ${{ parameters.npmrcPath }} for registry ${{ parameters.registryUrl }}" - $parentFolder = Split-Path -Path '${{ parameters.npmrcPath }}' -Parent - - if (!(Test-Path $parentFolder)) { - Write-Host "Creating folder $parentFolder" - New-Item -Path $parentFolder -ItemType Directory | Out-Null - } - - $content = "registry=${{ parameters.registryUrl }}`n`n" + "always-auth=true" - $content | Out-File '${{ parameters.npmrcPath }}' - displayName: "Create .npmrc" - - task: npmAuthenticate@0 - displayName: Authenticate .npmrc - inputs: - workingFile: ${{ parameters.npmrcPath }} diff --git a/eng/emitters/pipelines/templates/steps/test-step.yml b/eng/emitters/pipelines/templates/steps/test-step.yml index fa5b0980c22..59a2beb5689 100644 --- a/eng/emitters/pipelines/templates/steps/test-step.yml +++ b/eng/emitters/pipelines/templates/steps/test-step.yml @@ -51,6 +51,8 @@ parameters: steps: - checkout: self + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - download: current artifact: ${{ parameters.BuildArtifactName }} displayName: Download build artifacts diff --git a/eng/tsp-core/pipelines/jobs/cli/build-tsp-cli.yml b/eng/tsp-core/pipelines/jobs/cli/build-tsp-cli.yml index 657b421a9e6..a81710eba69 100644 --- a/eng/tsp-core/pipelines/jobs/cli/build-tsp-cli.yml +++ b/eng/tsp-core/pipelines/jobs/cli/build-tsp-cli.yml @@ -42,6 +42,8 @@ jobs: # - script: npm install -g bun # displayName: Install bun + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - script: npm install -g pnpm displayName: Install pnpm diff --git a/eng/tsp-core/pipelines/templates/install.yml b/eng/tsp-core/pipelines/templates/install.yml index 2daaa085ec1..8de49aaecc3 100644 --- a/eng/tsp-core/pipelines/templates/install.yml +++ b/eng/tsp-core/pipelines/templates/install.yml @@ -24,8 +24,11 @@ steps: inputs: version: 8.0.x - - script: npm install -g pnpm # Pnpm manage-package-manager-versions will respect packageManager field + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + + - script: npm install -g pnpm@10.30.2 # Pnpm manage-package-manager-versions will respect packageManager field displayName: Install pnpm + - script: pnpm config set store-dir ${{ parameters.pnpmStorePath }} displayName: Setup pnpm cache dir diff --git a/packages/http-client-csharp/eng/pipeline/publish.yml b/packages/http-client-csharp/eng/pipeline/publish.yml index c0ba9c6f201..e37e84583fb 100644 --- a/packages/http-client-csharp/eng/pipeline/publish.yml +++ b/packages/http-client-csharp/eng/pipeline/publish.yml @@ -125,6 +125,9 @@ extends: npm_config_cache: $(Agent.TempDirectory)/npm-cache steps: - checkout: self + + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml + - pwsh: | # Determine the TypeSpec PR URL $repoUrl = '$(Build.Repository.Uri)'.TrimEnd('/') diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0209fdfc111..5d5a181736a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -418,7 +418,7 @@ catalogs: specifier: ^7.7.4 version: 7.8.5 sharp: - specifier: ^0.35.2 + specifier: ^0.35.1 version: 0.35.2 simple-git: specifier: ^3.36.0 @@ -9728,6 +9728,7 @@ packages: glob@10.5.0: resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me hasBin: true glob@13.0.6: @@ -9736,10 +9737,12 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me global-directory@5.0.0: resolution: {integrity: sha512-1pgFdhK3J2LeM+dVf2Pd424yHx2ou338lC0ErNP2hPx4j8eW1Sp0XqSjNxtk6Tc4Kr5wlWtSvz8cn2yb7/SG/w==} @@ -10066,6 +10069,7 @@ packages: inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. inherits@2.0.3: resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} @@ -11704,6 +11708,7 @@ packages: prebuild-install@7.1.3: resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. hasBin: true preferred-pm@3.1.4: @@ -11757,6 +11762,7 @@ packages: prex@0.4.9: resolution: {integrity: sha512-pQCB9AH8MXQRBaelDkhnTkqY6GRiXt1xWlx2hBReZYZwVA0m7EQcnF/K55zr87cCADDHmdD+qq7G6a8Pu+BRFA==} + deprecated: This package has been deprecated in favor of several '@esfx/*' packages that replace it. Please see the README for more information printable-characters@1.0.42: resolution: {integrity: sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==} @@ -12155,10 +12161,12 @@ packages: rimraf@2.6.3: resolution: {integrity: sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true rimraf@6.1.3: @@ -13072,6 +13080,7 @@ packages: uid-number@0.0.6: resolution: {integrity: sha512-c461FXIljswCuscZn67xq9PpszkPT6RjheWFQTgCyabJrTUozElanb0YEqv2UGgk247YpcJkFBuSGNvBlpXM9w==} + deprecated: This package is no longer supported. ultrahtml@1.6.0: resolution: {integrity: sha512-R9fBn90VTJrqqLDwyMph+HGne8eqY1iPfYhPzZrvKpIfwkWZbcYlfpsb8B9dTvBfpy1/hqAD7Wi8EKfP9e8zdw==} @@ -13313,6 +13322,7 @@ packages: uuid@9.0.1: resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). hasBin: true v8-to-istanbul@9.3.0: @@ -13636,6 +13646,7 @@ packages: whatwg-encoding@3.1.1: resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation whatwg-mimetype@3.0.0: resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7aa0552c415..d9e42c3c761 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -144,7 +144,7 @@ catalog: rimraf: ^6.1.3 rollup-plugin-visualizer: 7.0.1 semver: ^7.7.4 - sharp: ^0.35.2 + sharp: ^0.35.1 simple-git: ^3.36.0 source-map-support: ^0.5.21 storybook: ^10.3.5