-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/cli): handle
YARN_
environment variables during `ng up…
…date` and `ng add` With this change we handle yarn specific environment variables during `ng update` and `ng add`. This is a follow up of #21297
- Loading branch information
1 parent
f75a584
commit c1eddbd
Showing
4 changed files
with
70 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expectFileNotToExist, expectFileToExist } from '../../../utils/fs'; | ||
import { getActivePackageManager } from '../../../utils/packages'; | ||
import { git, ng } from '../../../utils/process'; | ||
import { | ||
createNpmConfigForAuthentication, | ||
setNpmEnvVarsForAuthentication, | ||
} from '../../../utils/registry'; | ||
|
||
export default async function () { | ||
// Yarn specific test that tests YARN_ env variables. | ||
// https://classic.yarnpkg.com/en/docs/envvars/ | ||
if (getActivePackageManager() !== 'yarn') { | ||
return; | ||
} | ||
const command = ['add', '@angular/pwa', '--skip-confirmation']; | ||
|
||
// Environment variables only | ||
await expectFileNotToExist('src/manifest.webmanifest'); | ||
setNpmEnvVarsForAuthentication(false, true); | ||
await ng(...command); | ||
await expectFileToExist('src/manifest.webmanifest'); | ||
await git('clean', '-dxf'); | ||
|
||
// Mix of config file and env vars works | ||
await expectFileNotToExist('src/manifest.webmanifest'); | ||
await createNpmConfigForAuthentication(false, true); | ||
await ng(...command); | ||
await expectFileToExist('src/manifest.webmanifest'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters