Skip to content

Commit

Permalink
feat(angular): support angular 18.0.0-next.3 (#22885)
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez authored Apr 19, 2024
1 parent e8a23aa commit 17aeb97
Show file tree
Hide file tree
Showing 7 changed files with 927 additions and 577 deletions.
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "~0.1800.0-next.2",
"@angular-devkit/build-angular": "~18.0.0-next.2",
"@angular-devkit/core": "~18.0.0-next.2",
"@angular-devkit/schematics": "~18.0.0-next.2",
"@angular-devkit/architect": "~0.1800.0-next.3",
"@angular-devkit/build-angular": "~18.0.0-next.3",
"@angular-devkit/core": "~18.0.0-next.3",
"@angular-devkit/schematics": "~18.0.0-next.3",
"@angular-eslint/eslint-plugin": "~17.3.0",
"@angular-eslint/eslint-plugin-template": "~17.3.0",
"@angular-eslint/template-parser": "~17.3.0",
"@angular/cli": "~18.0.0-next.2",
"@angular/common": "~18.0.0-next.4",
"@angular/compiler": "~18.0.0-next.4",
"@angular/compiler-cli": "~18.0.0-next.4",
"@angular/core": "~18.0.0-next.4",
"@angular/router": "~18.0.0-next.4",
"@angular/cli": "~18.0.0-next.3",
"@angular/common": "~18.0.0-next.5",
"@angular/compiler": "~18.0.0-next.5",
"@angular/compiler-cli": "~18.0.0-next.5",
"@angular/core": "~18.0.0-next.5",
"@angular/router": "~18.0.0-next.5",
"@babel/core": "^7.23.2",
"@babel/helper-create-regexp-features-plugin": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.23.2",
Expand Down Expand Up @@ -93,7 +93,7 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^7.0.0",
"@schematics/angular": "~18.0.0-next.2",
"@schematics/angular": "~18.0.0-next.3",
"@side/jest-runtime": "^1.1.0",
"@storybook/addon-essentials": "7.5.3",
"@storybook/core-server": "7.5.3",
Expand Down Expand Up @@ -229,7 +229,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "9.0.3",
"next-sitemap": "^3.1.10",
"ng-packagr": "~18.0.0-next.1",
"ng-packagr": "~18.0.0-next.3",
"node-fetch": "^2.6.7",
"npm-package-arg": "11.0.1",
"nuxt": "^3.10.0",
Expand Down Expand Up @@ -375,4 +375,3 @@
]
}
}

32 changes: 16 additions & 16 deletions packages/angular/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@
"description": "Update the @angular/cli package version to ~17.3.0.",
"factory": "./src/migrations/update-18-2-0/update-angular-cli"
},
"update-angular-cli-version-18-0-0-next-2": {
"update-angular-cli-version-18-0-0-next-3": {
"cli": "nx",
"version": "19.1.0-beta.0",
"requires": {
"@angular/core": ">=18.0.0-next.4"
"@angular/core": ">=18.0.0-next.5"
},
"description": "Update the @angular/cli package version to ~18.0.0-next.2.",
"description": "Update the @angular/cli package version to ~18.0.0-next.3.",
"factory": "./src/migrations/update-19-1-0/update-angular-cli"
}
},
Expand Down Expand Up @@ -1819,55 +1819,55 @@
"version": "19.1.0-beta.0",
"x-prompt": "Do you want to update the Angular version to v18?",
"requires": {
"@angular/core": ">=17.3.0 <18.0.0-next.4"
"@angular/core": ">=17.3.0 <18.0.0-next.5"
},
"packages": {
"@angular-devkit/build-angular": {
"version": "~18.0.0-next.2",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~18.0.0-next.2",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~18.0.0-next.2",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular/pwa": {
"version": "~18.0.0-next.2",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular/ssr": {
"version": "~18.0.0-next.2",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~18.0.0-next.2",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular-devkit/architect": {
"version": "~0.1800.0-next.2",
"version": "~0.1800.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.1800.0-next.2",
"version": "~0.1800.0-next.3",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~18.0.0-next.4",
"version": "~18.0.0-next.5",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~18.0.0-next.4",
"version": "~18.0.0-next.5",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~18.0.0-next.4",
"version": "~18.0.0-next.5",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~18.0.0-next.1",
"version": "~18.0.0-next.3",
"alwaysAddToPackageJson": false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,32 @@ export class StylesheetProcessor {

const { version: ngPackagrVersion } =
getInstalledPackageVersionInfo('ng-packagr');
let tailwindConfigPath: string | undefined;
let postcssConfiguration: PostcssConfiguration | undefined;
if (gte(ngPackagrVersion, '17.3.0')) {
// TODO(leo): change to a stable version when it's released
if (gte(ngPackagrVersion, '18.0.0-next.3')) {
const {
findTailwindConfiguration,
generateSearchDirectories,
loadPostcssConfiguration,
} = require('ng-packagr/lib/styles/postcss-configuration');
let searchDirs = generateSearchDirectories([this.projectBasePath]);
postcssConfiguration = loadPostcssConfiguration(searchDirs);
// (nx-specific): we support loading the TailwindCSS config from the root of the workspace
searchDirs = generateSearchDirectories([
this.projectBasePath,
workspaceRoot,
]);
tailwindConfigPath = findTailwindConfiguration(searchDirs);
} else if (gte(ngPackagrVersion, '17.3.0')) {
const {
loadPostcssConfiguration,
} = require('ng-packagr/lib/styles/postcss-configuration');
postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
tailwindConfigPath = getTailwindConfigPath(
this.projectBasePath,
workspaceRoot
);
}

this.renderWorker = new Piscina({
Expand All @@ -113,10 +133,7 @@ export class StylesheetProcessor {
},
workerData: {
postcssConfiguration,
tailwindConfigPath: getTailwindConfigPath(
this.projectBasePath,
workspaceRoot
),
tailwindConfigPath,
projectBasePath: this.projectBasePath,
browserslistData,
targets: transformSupportedBrowsersToTargets(browserslistData),
Expand Down Expand Up @@ -200,9 +217,9 @@ export class AsyncStylesheetProcessor {
getInstalledPackageVersionInfo('ng-packagr');
let postcssConfiguration: PostcssConfiguration | undefined;
if (ngPackagrVersion === '17.2.0') {
const { loadPostcssConfiguration } = await import(
'ng-packagr/lib/styles/postcss-configuration'
);
const {
loadPostcssConfiguration,
} = require('ng-packagr/lib/styles/postcss-configuration');
postcssConfiguration = await loadPostcssConfiguration(
this.projectBasePath
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatFiles, Tree, updateJson } from '@nx/devkit';

export const angularCliVersion = '~18.0.0-next.2';
export const angularCliVersion = '~18.0.0-next.3';

export default async function (tree: Tree) {
let shouldFormat = false;
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const nxVersion = require('../../package.json').version;

export const angularVersion = '~18.0.0-next.4';
export const angularDevkitVersion = '~18.0.0-next.2';
export const ngPackagrVersion = '~18.0.0-next.1';
export const angularVersion = '~18.0.0-next.5';
export const angularDevkitVersion = '~18.0.0-next.3';
export const ngPackagrVersion = '~18.0.0-next.3';
export const ngrxVersion = '~17.0.0';
export const rxjsVersion = '~7.8.0';
export const zoneJsVersion = '~0.14.3';
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/utils/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export const typescriptVersion = '~5.4.2';

// TODO: remove when preset generation is reworked and
// deps are not installed from workspace
export const angularCliVersion = '~18.0.0-next.2';
export const angularCliVersion = '~18.0.0-next.3';
Loading

0 comments on commit 17aeb97

Please sign in to comment.