Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular-devkit/build-angular): update to postcss 8.2.15 #20890

Merged
merged 2 commits into from May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -192,7 +192,7 @@
"pidusage": "^2.0.17",
"pnp-webpack-plugin": "1.6.4",
"popper.js": "^1.14.1",
"postcss": "8.2.14",
"postcss": "8.2.15",
"postcss-import": "14.0.0",
"postcss-loader": "4.2.0",
"prettier": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Expand Up @@ -50,7 +50,7 @@
"ora": "5.3.0",
"parse5-html-rewriting-stream": "6.0.1",
"pnp-webpack-plugin": "1.6.4",
"postcss": "8.2.14",
"postcss": "8.2.15",
"postcss-import": "14.0.0",
"postcss-loader": "4.2.0",
"raw-loader": "4.0.2",
Expand Down
20 changes: 6 additions & 14 deletions tests/legacy-cli/e2e/setup/010-local-publish.ts
@@ -1,26 +1,18 @@
import { prerelease } from 'semver';
import { packages } from '../../../../lib/packages';
import { getGlobalVariable } from '../utils/env';
import { npm } from '../utils/process';
import { isPrereleaseCli } from '../utils/project';

export default async function() {
export default async function () {
const testRegistry = getGlobalVariable('package-registry');
const publishArgs = [
await npm(
'run',
'admin',
'--',
'publish',
'--no-versionCheck',
'--no-branchCheck',
`--registry=${testRegistry}`,
];

const pre = prerelease(packages['@angular/cli'].version);
if (pre && pre.length > 0) {
publishArgs.push('--tag', 'next');
} else {
publishArgs.push('--tag', 'latest');
}

await npm(...publishArgs);
'--tag',
isPrereleaseCli() ? 'next' : 'latest',
);
}
46 changes: 33 additions & 13 deletions tests/legacy-cli/e2e/tests/update/update-8.ts
@@ -1,23 +1,43 @@
import { createProjectFromAsset } from '../../utils/assets';
import { expectFileMatchToExist } from '../../utils/fs';
import { installWorkspacePackages } from '../../utils/packages';
import { ng, noSilentNg, silentNpm } from '../../utils/process';
import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project';
import { installPackage, installWorkspacePackages, setRegistry } from '../../utils/packages';
import { ng, noSilentNg } from '../../utils/process';
import { isPrereleaseCli, useCIChrome, useCIDefaults } from '../../utils/project';

export default async function() {
await createProjectFromAsset('8.0-project');
await ng('update', '@angular/cli', '--migrate-only', '--from=8');
export default async function () {
// We need to use the public registry because in the local NPM server we don't have
// older versions @angular/cli packages which would cause `npm install` during `ng update` to fail.
try {
await createProjectFromAsset('8.0-project', true, true);

// Use the packages we are building in this commit, and CI Chrome.
await useBuiltPackages();
await setRegistry(false);
await installWorkspacePackages();

// Update Angular to 9
await installPackage('@angular/cli@8');
const { stdout } = await ng('update', '@angular/cli@9.x', '@angular/core@9.x');
if (!stdout.includes("Executing migrations of package '@angular/cli'")) {
throw new Error('Update did not execute migrations. OUTPUT: \n' + stdout);
}

// Update Angular to 10
await ng('update', '@angular/cli@10', '@angular/core@10');
} finally {
await setRegistry(true);
}

// Update Angular current build
const extraUpdateArgs = isPrereleaseCli() ? ['--next', '--force'] : ['--force'];
// For the latest/next release we purposely don't add `@angular/core`.
// This is due to our bumping strategy, which causes a period were `@angular/cli@latest` (v12.0.0) `@angular/core@latest` (v11.2.x)
// are of different major/minor version on the local NPM server. This causes `ng update` to fail.
// NB: `ng update @angula/cli` will still cause `@angular/core` packages to be updated.
await ng('update', '@angular/cli', ...extraUpdateArgs);

// Setup testing to use CI Chrome.
await useCIChrome('./');
await useCIChrome('./e2e/');
await useCIDefaults('eight-project');
await installWorkspacePackages();

// Update Angular.
const extraUpdateArgs = await isPrereleaseCli() ? ['--next', '--force'] : [];
await ng('update', '@angular/core', ...extraUpdateArgs);

// Run CLI commands.
await ng('generate', 'component', 'my-comp');
Expand Down
21 changes: 20 additions & 1 deletion tests/legacy-cli/e2e/utils/packages.ts
@@ -1,5 +1,6 @@
import { getGlobalVariable } from './env';
import { ProcessOutput, silentNpm, silentYarn } from './process';
import { writeFile } from './fs';
import { npm, ProcessOutput, silentNpm, silentYarn } from './process';

export function getActivePackageManager(): 'npm' | 'yarn' {
const value = getGlobalVariable('package-manager');
Expand Down Expand Up @@ -39,3 +40,21 @@ export async function uninstallPackage(name: string): Promise<ProcessOutput> {
return silentYarn('remove', name);
}
}

export async function setRegistry(useTestRegistry: boolean): Promise<void> {
const url = useTestRegistry
? getGlobalVariable('package-registry')
: 'https://registry.npmjs.org';

const isCI = getGlobalVariable('ci');

// Ensure local test registry is used when outside a project
if (isCI) {
// Safe to set a user configuration on CI
await npm('config', 'set', 'registry', url);
} else {
// Yarn does not use the environment variable so an .npmrc file is also required
await writeFile('.npmrc', `registry=${url}`);
process.env['NPM_CONFIG_REGISTRY'] = url;
}
}
10 changes: 3 additions & 7 deletions tests/legacy-cli/e2e/utils/project.ts
Expand Up @@ -7,9 +7,6 @@ import { gitCommit } from './git';
import { installWorkspacePackages } from './packages';
import { execAndWaitForOutputToMatch, git, ng, npm } from './process';

const tsConfigPath = 'tsconfig.json';


export function updateJsonFile(filePath: string, fn: (json: any) => any | void) {
return readFile(filePath)
.then(tsConfigJson => {
Expand All @@ -23,7 +20,7 @@ export function updateJsonFile(filePath: string, fn: (json: any) => any | void)


export function updateTsConfig(fn: (json: any) => any | void) {
return updateJsonFile(tsConfigPath, fn);
return updateJsonFile('tsconfig.json', fn);
}


Expand Down Expand Up @@ -293,9 +290,8 @@ export function useCIChrome(projectDir: string) {
});
}

export async function isPrereleaseCli() {
const angularCliPkgJson = JSON.parse(await readFile('node_modules/@angular/cli/package.json'));
const pre = prerelease(angularCliPkgJson.version);
export function isPrereleaseCli(): boolean {
const pre = prerelease(packages['@angular/cli'].version);

return pre && pre.length > 0;
}
18 changes: 9 additions & 9 deletions yarn.lock
Expand Up @@ -8063,10 +8063,10 @@ nanoid@^3.1.20:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788"
integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==

nanoid@^3.1.22:
version "3.1.22"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.22.tgz#b35f8fb7d151990a8aebd5aa5015c03cf726f844"
integrity sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==
nanoid@^3.1.23:
version "3.1.23"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81"
integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==

nanomatch@^1.2.9:
version "1.2.13"
Expand Down Expand Up @@ -9657,13 +9657,13 @@ postcss-value-parser@^4.0.0, postcss-value-parser@^4.0.2, postcss-value-parser@^
source-map "^0.6.1"
supports-color "^6.1.0"

postcss@8.2.14:
version "8.2.14"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.14.tgz#dcf313eb8247b3ce8078d048c0e8262ca565ad2b"
integrity sha512-+jD0ZijcvyCqPQo/m/CW0UcARpdFylq04of+Q7RKX6f/Tu+dvpUI/9Sp81+i6/vJThnOBX09Quw0ZLOVwpzX3w==
postcss@8.2.15:
version "8.2.15"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.15.tgz#9e66ccf07292817d226fc315cbbf9bc148fbca65"
integrity sha512-2zO3b26eJD/8rb106Qu2o7Qgg52ND5HPjcyQiK2B98O388h43A448LCslC0dI2P97wCAQRJsFvwTRcXxTKds+Q==
dependencies:
colorette "^1.2.2"
nanoid "^3.1.22"
nanoid "^3.1.23"
source-map "^0.6.1"

postcss@^8.1.4:
Expand Down