Use emitter-package-lock.json and @local feed view (#4910)
Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
This commit is contained in:
parent
97845b77eb
commit
dd23631119
@ -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 {
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user