File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -46,14 +46,36 @@ function NpmInstallForProject([string]$workingDirectory) {
4646 Write-Host (" Copying package.json from $replacementPackageJson " )
4747 Copy-Item - Path $replacementPackageJson - Destination " package.json" - Force
4848
49+ # default to root/eng/emitter-package-lock.json but you can override by writing
50+ # Get-${Language}-EmitterPackageLockPath in your Language-Settings.ps1
51+ $emitterPackageLock = Join-Path $PSScriptRoot " ../../emitter-package-lock.json"
52+ if (Test-Path " Function:$GetEmitterPackageLockPathFn " ) {
53+ $emitterPackageLock = & $GetEmitterPackageLockPathFn
54+ }
55+
56+ $usingLockFile = Test-Path $emitterPackageLock
57+
58+ if ($usingLockFile ) {
59+ Write-Host (" Copying package-lock.json from $emitterPackageLock " )
60+ Copy-Item - Path $emitterPackageLock - Destination " package-lock.json" - Force
61+ }
62+
4963 $useAlphaNpmRegistry = (Get-Content $replacementPackageJson - Raw).Contains(" -alpha." )
5064
5165 if ($useAlphaNpmRegistry ) {
5266 Write-Host " Package.json contains '-alpha.' in the version, Creating .npmrc using public/azure-sdk-for-js-test-autorest feed."
53- " registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/ `n`n always-auth=true" | Out-File ' .npmrc'
67+ " registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/ `n`n always-auth=true" | Out-File ' .npmrc'
68+ }
69+
70+ if ($usingLockFile ) {
71+ Write-Host " > npm ci"
72+ npm ci
73+ }
74+ else {
75+ Write-Host " > npm install"
76+ npm install
5477 }
5578
56- npm install -- no- lock-file
5779 if ($LASTEXITCODE ) { exit $LASTEXITCODE }
5880 }
5981 finally {
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ $GetRepositoryLinkFn = "Get-${Language}-RepositoryLink"
6161$GetEmitterAdditionalOptionsFn = " Get-${Language} -EmitterAdditionalOptions"
6262$GetEmitterNameFn = " Get-${Language} -EmitterName"
6363$GetEmitterPackageJsonPathFn = " Get-${Language} -EmitterPackageJsonPath"
64+ $GetEmitterPackageLockPathFn = " Get-${Language} -EmitterPackageLockPath"
6465
6566# Expected to be set in eng/scripts/docs/Docs-Onboarding.ps1
6667$SetDocsPackageOnboarding = " Set-${Language} -DocsPackageOnboarding"
You can’t perform that action at this time.
0 commit comments