Use emitter-package-lock.json and @local feed view (#4910)

Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
This commit is contained in:
Azure SDK Bot 2023-08-23 16:33:32 -07:00 committed by GitHub
parent 97845b77eb
commit dd23631119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View File

@ -46,14 +46,36 @@ function NpmInstallForProject([string]$workingDirectory) {
Write-Host("Copying package.json from $replacementPackageJson")
Copy-Item -Path $replacementPackageJson -Destination "package.json" -Force
#default to root/eng/emitter-package-lock.json but you can override by writing
#Get-${Language}-EmitterPackageLockPath in your Language-Settings.ps1
$emitterPackageLock = Join-Path $PSScriptRoot "../../emitter-package-lock.json"
if (Test-Path "Function:$GetEmitterPackageLockPathFn") {
$emitterPackageLock = &$GetEmitterPackageLockPathFn
}
$usingLockFile = Test-Path $emitterPackageLock
if ($usingLockFile) {
Write-Host("Copying package-lock.json from $emitterPackageLock")
Copy-Item -Path $emitterPackageLock -Destination "package-lock.json" -Force
}
$useAlphaNpmRegistry = (Get-Content $replacementPackageJson -Raw).Contains("-alpha.")
if($useAlphaNpmRegistry) {
Write-Host "Package.json contains '-alpha.' in the version, Creating .npmrc using public/azure-sdk-for-js-test-autorest feed."
"registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/ `n`nalways-auth=true" | Out-File '.npmrc'
"registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/ `n`nalways-auth=true" | Out-File '.npmrc'
}
if ($usingLockFile) {
Write-Host "> npm ci"
npm ci
}
else {
Write-Host "> npm install"
npm install
}
npm install --no-lock-file
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
finally {

View File

@ -61,6 +61,7 @@ $GetRepositoryLinkFn = "Get-${Language}-RepositoryLink"
$GetEmitterAdditionalOptionsFn = "Get-${Language}-EmitterAdditionalOptions"
$GetEmitterNameFn = "Get-${Language}-EmitterName"
$GetEmitterPackageJsonPathFn = "Get-${Language}-EmitterPackageJsonPath"
$GetEmitterPackageLockPathFn = "Get-${Language}-EmitterPackageLockPath"
# Expected to be set in eng/scripts/docs/Docs-Onboarding.ps1
$SetDocsPackageOnboarding = "Set-${Language}-DocsPackageOnboarding"