feat(angular): support angular 17.3.0 (#22202)

This commit is contained in:
Leosvel Pérez Espinosa 2024-03-19 19:58:23 +01:00 committed by GitHub
parent d058c8c0b1
commit 8baddb5f08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 2896 additions and 858 deletions

View File

@ -66,6 +66,10 @@
"type": "string",
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
},
"deployUrl": {
"type": "string",
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations. _Note: this is only supported in Angular versions >= 17.3.0_."
},
"scripts": {
"description": "Global scripts to be included in the build.",
"type": "array",
@ -252,9 +256,9 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": { "type": "string", "pattern": "\\.(([cm]?j|t)sx?|json)$" }
"with": { "type": "string", "pattern": "\\.(([cm]?[jt])sx?|json)$" }
},
"additionalProperties": false,
"required": ["replace", "with"]
@ -673,9 +677,9 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": { "type": "string", "pattern": "\\.(([cm]?j|t)sx?|json)$" }
"with": { "type": "string", "pattern": "\\.(([cm]?[jt])sx?|json)$" }
},
"additionalProperties": false,
"required": ["replace", "with"]

View File

@ -235,9 +235,9 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": { "type": "string", "pattern": "\\.(([cm]?j|t)sx?|json)$" }
"with": { "type": "string", "pattern": "\\.(([cm]?[jt])sx?|json)$" }
},
"additionalProperties": false,
"required": ["replace", "with"]
@ -307,8 +307,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"x-deprecated": "Use \"baseHref\" option, \"APP_BASE_HREF\" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"verbose": {
"type": "boolean",
@ -587,9 +586,9 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": { "type": "string", "pattern": "\\.(([cm]?j|t)sx?|json)$" }
"with": { "type": "string", "pattern": "\\.(([cm]?[jt])sx?|json)$" }
},
"additionalProperties": false,
"required": ["replace", "with"]

View File

@ -251,11 +251,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -266,11 +266,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -344,8 +344,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"x-deprecated": "Use `baseHref` option, `APP_BASE_HREF` DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"verbose": {
"type": "boolean",
@ -609,11 +608,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -624,11 +623,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,

View File

@ -110,11 +110,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -125,11 +125,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -182,8 +182,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"x-deprecated": "Use \"baseHref\" browser builder option, \"APP_BASE_HREF\" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"vendorChunk": {
"type": "boolean",
@ -340,11 +339,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -355,11 +354,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,

View File

@ -26,19 +26,19 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "0.1702.0",
"@angular-devkit/build-angular": "17.2.0",
"@angular-devkit/core": "17.2.0",
"@angular-devkit/schematics": "17.2.0",
"@angular-eslint/eslint-plugin": "17.0.1",
"@angular-eslint/eslint-plugin-template": "17.0.1",
"@angular-eslint/template-parser": "17.0.1",
"@angular/cli": "~17.2.0",
"@angular/common": "17.2.1",
"@angular/compiler": "17.2.1",
"@angular/compiler-cli": "17.2.1",
"@angular/core": "17.2.1",
"@angular/router": "17.2.1",
"@angular-devkit/architect": "~0.1703.0",
"@angular-devkit/build-angular": "~17.3.0",
"@angular-devkit/core": "~17.3.0",
"@angular-devkit/schematics": "~17.3.0",
"@angular-eslint/eslint-plugin": "~17.3.0",
"@angular-eslint/eslint-plugin-template": "~17.3.0",
"@angular-eslint/template-parser": "~17.3.0",
"@angular/cli": "~17.3.0",
"@angular/common": "~17.3.0",
"@angular/compiler": "~17.3.0",
"@angular/compiler-cli": "~17.3.0",
"@angular/core": "~17.3.0",
"@angular/router": "~17.3.0",
"@babel/core": "^7.23.2",
"@babel/helper-create-regexp-features-plugin": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.23.2",
@ -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": "17.2.0",
"@schematics/angular": "~17.3.0",
"@side/jest-runtime": "^1.1.0",
"@storybook/addon-essentials": "7.5.3",
"@storybook/core-server": "7.5.3",
@ -132,10 +132,10 @@
"@types/tmp": "^0.2.0",
"@types/yargs": "^17.0.10",
"@types/yarnpkg__lockfile": "^1.1.5",
"@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1",
"@typescript-eslint/type-utils": "6.18.1",
"@typescript-eslint/utils": "6.18.1",
"@typescript-eslint/eslint-plugin": "^7.3.0",
"@typescript-eslint/parser": "^7.3.0",
"@typescript-eslint/type-utils": "^7.3.0",
"@typescript-eslint/utils": "^7.3.0",
"@xstate/immer": "0.3.1",
"@xstate/inspect": "0.7.0",
"@xstate/react": "3.0.1",
@ -167,7 +167,7 @@
"ejs": "^3.1.7",
"enhanced-resolve": "^5.8.3",
"esbuild": "0.19.5",
"eslint": "8.48.0",
"eslint": "~8.57.0",
"eslint-config-next": "14.0.4",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-cypress": "2.14.0",
@ -228,7 +228,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "9.0.3",
"next-sitemap": "^3.1.10",
"ng-packagr": "17.2.0",
"ng-packagr": "~17.3.0",
"node-fetch": "^2.6.7",
"npm-package-arg": "11.0.1",
"nuxt": "^3.10.0",
@ -239,7 +239,7 @@
"ora": "5.3.0",
"parse-markdown-links": "^1.0.4",
"parse5": "4.0.0",
"piscina": "^4.2.1",
"piscina": "^4.4.0",
"postcss": "8.4.19",
"postcss-import": "~14.1.0",
"postcss-preset-env": "~7.5.0",
@ -283,7 +283,7 @@
"tsconfig-paths-webpack-plugin": "4.0.0",
"typedoc": "0.25.12",
"typedoc-plugin-markdown": "3.17.1",
"typescript": "~5.3.2",
"typescript": "~5.4.2",
"unist-builder": "^4.0.0",
"unzipper": "^0.10.11",
"url-loader": "^4.1.1",
@ -374,4 +374,3 @@
]
}
}

View File

@ -377,6 +377,15 @@
"version": "18.1.1-beta.0",
"description": "Ensure targetDefaults inputs for task hashing when '@nx/angular:webpack-browser' is used are correct for Module Federation.",
"factory": "./src/migrations/update-18-1-1/fix-target-defaults-inputs"
},
"update-angular-cli-version-17-3-0": {
"cli": "nx",
"version": "18.2.0-beta.0",
"requires": {
"@angular/core": ">=17.3.0"
},
"description": "Update the @angular/cli package version to ~17.3.0.",
"factory": "./src/migrations/update-18-2-0/update-angular-cli"
}
},
"packageJsonUpdates": {
@ -1718,6 +1727,84 @@
"alwaysAddToPackageJson": false
}
}
},
"18.2.0": {
"version": "18.2.0-beta.0",
"x-prompt": "Do you want to update the Angular version to v17.3?",
"requires": {
"@angular/core": ">=17.2.0 <17.3.0"
},
"packages": {
"@angular-devkit/build-angular": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular/pwa": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular/ssr": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/architect": {
"version": "~0.1703.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.1703.0",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~17.3.0",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
}
}
},
"18.2.0-angular-eslint": {
"version": "18.2.0-beta.0",
"requires": {
"eslint": "^7.20.0 || ^8.0.0",
"@angular/core": ">= 17.0.0 < 18.0.0"
},
"packages": {
"@angular-eslint/eslint-plugin": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular-eslint/eslint-plugin-template": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
},
"@angular-eslint/template-parser": {
"version": "~17.3.0",
"alwaysAddToPackageJson": false
}
}
}
}
}

View File

@ -47,7 +47,7 @@
},
"dependencies": {
"@phenomnomnominal/tsquery": "~5.0.1",
"@typescript-eslint/type-utils": "^6.9.1",
"@typescript-eslint/type-utils": "^7.3.0",
"chalk": "^4.1.0",
"find-cache-dir": "^3.3.2",
"ignore": "^5.0.4",
@ -63,7 +63,7 @@
"@nx/webpack": "file:../webpack",
"@nx/web": "file:../web",
"@nx/workspace": "file:../workspace",
"piscina": "^4.2.1"
"piscina": "^4.4.0"
},
"peerDependencies": {
"@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",

View File

@ -1,4 +1,4 @@
import { Schema } from '@angular-devkit/build-angular/src/builders/browser/schema';
import type { Schema } from '@angular-devkit/build-angular/src/builders/browser/schema';
export type BrowserBuilderSchema = Schema & {
customWebpackConfig?: {

View File

@ -292,8 +292,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"x-deprecated": "Use `baseHref` option, `APP_BASE_HREF` DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"verbose": {
"type": "boolean",
@ -517,11 +516,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -532,11 +531,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,

View File

@ -123,8 +123,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"x-deprecated": "Use \"baseHref\" browser builder option, \"APP_BASE_HREF\" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"vendorChunk": {
"type": "boolean",
@ -290,11 +289,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,
@ -305,11 +304,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,

View File

@ -35,6 +35,10 @@
"type": "string",
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
},
"deployUrl": {
"type": "string",
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations. _Note: this is only supported in Angular versions >= 17.3.0_."
},
"scripts": {
"description": "Global scripts to be included in the build.",
"type": "array",
@ -612,11 +616,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,

View File

@ -70,4 +70,12 @@ export function validateOptions(options: ApplicationExecutorOptions): void {
);
}
}
if (lt(angularVersion, '17.3.0')) {
if (options.deployUrl) {
throw new Error(
`The "deployUrl" option requires Angular version 17.3.0 or greater. You are currently using version ${angularVersion}.`
);
}
}
}

View File

@ -279,8 +279,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"x-deprecated": "Use \"baseHref\" option, \"APP_BASE_HREF\" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url."
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"verbose": {
"type": "boolean",
@ -519,11 +518,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false,

View File

@ -1,9 +1,21 @@
import { FactoryProvider } from 'injection-js';
import type { FactoryProvider } from 'injection-js';
import { STYLESHEET_PROCESSOR_TOKEN } from 'ng-packagr/lib/styles/stylesheet-processor.di';
import { StylesheetProcessor } from './stylesheet-processor';
import { gte, lt } from 'semver';
import { getInstalledPackageVersionInfo } from '../angular-version-utils';
import {
AsyncStylesheetProcessor,
StylesheetProcessor,
} from './stylesheet-processor';
export const STYLESHEET_PROCESSOR: FactoryProvider = {
provide: STYLESHEET_PROCESSOR_TOKEN,
useFactory: () => StylesheetProcessor,
useFactory: () => {
const { version: ngPackagrVersion } =
getInstalledPackageVersionInfo('ng-packagr');
return lt(ngPackagrVersion, '17.2.0') || gte(ngPackagrVersion, '17.3.0')
? StylesheetProcessor
: AsyncStylesheetProcessor;
},
deps: [],
};

View File

@ -53,6 +53,111 @@ export class StylesheetProcessor {
];
}
async process({
filePath,
content,
}: {
filePath: string;
content: string;
}): Promise<string> {
this.createRenderWorker();
return this.renderWorker.run({ content, filePath });
}
/** Destory workers in pool. */
destroy(): void {
void this.renderWorker?.destroy();
}
private createRenderWorker(): Promise<void> {
if (this.renderWorker) {
return;
}
const styleIncludePaths = [...this.includePaths];
let prevDir = null;
let currentDir = this.basePath;
while (currentDir !== prevDir) {
const p = join(currentDir, 'node_modules');
if (existsSync(p)) {
styleIncludePaths.push(p);
}
prevDir = currentDir;
currentDir = dirname(prevDir);
}
const browserslistData = browserslist(undefined, { path: this.basePath });
const { version: ngPackagrVersion } =
getInstalledPackageVersionInfo('ng-packagr');
let postcssConfiguration: PostcssConfiguration | undefined;
if (gte(ngPackagrVersion, '17.3.0')) {
const {
loadPostcssConfiguration,
} = require('ng-packagr/lib/styles/postcss-configuration');
postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
}
this.renderWorker = new Piscina({
filename: require.resolve(
'ng-packagr/lib/styles/stylesheet-processor-worker'
),
maxThreads,
recordTiming: false,
env: {
...process.env,
FORCE_COLOR: '' + colors.enabled,
},
workerData: {
postcssConfiguration,
tailwindConfigPath: getTailwindConfigPath(
this.projectBasePath,
workspaceRoot
),
projectBasePath: this.projectBasePath,
browserslistData,
targets: transformSupportedBrowsersToTargets(browserslistData),
cacheDirectory: this.cacheDirectory,
cssUrl: this.cssUrl,
styleIncludePaths,
},
});
}
}
/**
* This class is used when ng-packagr version is greater than or equal to 17.2.0 and less than 17.3.0.
* The async `loadPostcssConfiguration` function introduced in ng-packagr 17.2.x causes a memory leak
* due to multiple workers being created. We must keep this class to support any workspace that might
* be using ng-packagr 17.2.x where that function need to be awaited.
*/
export class AsyncStylesheetProcessor {
private renderWorker: typeof Piscina | undefined;
constructor(
private readonly projectBasePath: string,
private readonly basePath: string,
private readonly cssUrl?: CssUrl,
private readonly includePaths?: string[],
private readonly cacheDirectory?: string | false
) {
// By default, browserslist defaults are too inclusive
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
// We change the default query to browsers that Angular support.
// https://angular.io/guide/browser-support
(browserslist.defaults as string[]) = [
'last 2 Chrome versions',
'last 1 Firefox version',
'last 2 Edge major versions',
'last 2 Safari major versions',
'last 2 iOS major versions',
'Firefox ESR',
];
}
async process({
filePath,
content,
@ -108,6 +213,7 @@ export class StylesheetProcessor {
'ng-packagr/lib/styles/stylesheet-processor-worker'
),
maxThreads,
recordTiming: false,
env: {
...process.env,
FORCE_COLOR: '' + colors.enabled,

View File

@ -107,7 +107,8 @@ async function convertProjectTargets(
}
const { buildTargetName, serverTargetName } = getTargetsToConvert(
project.targets
project.targets,
angularVersion
);
if (!buildTargetName) {
warnIfProvided(
@ -181,7 +182,9 @@ async function convertProjectTargets(
}
// Delete removed options
if (lt(angularVersion, '17.3.0')) {
delete options['deployUrl'];
}
delete options['vendorChunk'];
delete options['commonChunk'];
delete options['resourcesOutputPath'];
@ -266,7 +269,10 @@ async function convertProjectTargets(
return true;
}
function getTargetsToConvert(targets: Record<string, TargetConfiguration>): {
function getTargetsToConvert(
targets: Record<string, TargetConfiguration>,
angularVersion: string
): {
buildTargetName?: string;
serverTargetName?: string;
} {
@ -286,7 +292,7 @@ function getTargetsToConvert(targets: Record<string, TargetConfiguration>): {
// build target
if (executorsToConvert.has(targets[target].executor)) {
for (const [, options] of allTargetOptions(targets[target])) {
if (options.deployUrl) {
if (lt(angularVersion, '17.3.0') && options.deployUrl) {
logger.warn(
`The project is using the "deployUrl" option which is not available in the application builder. Skipping conversion.`
);

View File

@ -0,0 +1,42 @@
import { readJson, Tree, writeJson } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import updateAngularCli, { angularCliVersion } from './update-angular-cli';
describe('update-angular-cli migration', () => {
let tree: Tree;
beforeEach(() => {
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
});
it('should update @angular/cli version when defined as a dev dependency', async () => {
writeJson(tree, 'package.json', {
devDependencies: { '@angular/cli': '~13.3.0' },
});
await updateAngularCli(tree);
const { devDependencies } = readJson(tree, 'package.json');
expect(devDependencies['@angular/cli']).toBe(angularCliVersion);
});
it('should update @angular/cli version when defined as a dependency', async () => {
writeJson(tree, 'package.json', {
dependencies: { '@angular/cli': '~13.3.0' },
});
await updateAngularCli(tree);
const { dependencies } = readJson(tree, 'package.json');
expect(dependencies['@angular/cli']).toBe(angularCliVersion);
});
it('should not add @angular/cli to package.json when it is not set', async () => {
const initialPackageJson = readJson(tree, 'package.json');
await updateAngularCli(tree);
const packageJson = readJson(tree, 'package.json');
expect(packageJson).toStrictEqual(initialPackageJson);
});
});

View File

@ -0,0 +1,23 @@
import { formatFiles, Tree, updateJson } from '@nx/devkit';
export const angularCliVersion = '~17.3.0';
export default async function (tree: Tree) {
let shouldFormat = false;
updateJson(tree, 'package.json', (json) => {
if (json.devDependencies?.['@angular/cli']) {
json.devDependencies['@angular/cli'] = angularCliVersion;
shouldFormat = true;
} else if (json.dependencies?.['@angular/cli']) {
json.dependencies['@angular/cli'] = angularCliVersion;
shouldFormat = true;
}
return json;
});
if (shouldFormat) {
await formatFiles(tree);
}
}

View File

@ -1,8 +1,8 @@
export const nxVersion = require('../../package.json').version;
export const angularVersion = '~17.2.0';
export const angularDevkitVersion = '~17.2.0';
export const ngPackagrVersion = '~17.2.0';
export const angularVersion = '~17.3.0';
export const angularDevkitVersion = '~17.3.0';
export const ngPackagrVersion = '~17.3.0';
export const ngrxVersion = '~17.0.0';
export const rxjsVersion = '~7.8.0';
export const zoneJsVersion = '~0.14.3';
@ -16,7 +16,7 @@ export const typesExpressVersion = '4.17.14';
export const browserSyncVersion = '^3.0.0';
export const moduleFederationNodeVersion = '~1.0.5';
export const angularEslintVersion = '~17.0.0';
export const angularEslintVersion = '~17.3.0';
export const tailwindVersion = '^3.0.2';
export const postcssVersion = '^8.4.5';
export const postcssUrlVersion = '~10.1.3';

View File

@ -1 +1 @@
export const typescriptVersion = '~5.3.2';
export const typescriptVersion = '~5.4.2';

View File

@ -35,8 +35,8 @@
"dependencies": {
"@nx/devkit": "file:../devkit",
"@nx/js": "file:../js",
"@typescript-eslint/type-utils": "^6.13.2",
"@typescript-eslint/utils": "^6.13.2",
"@typescript-eslint/type-utils": "^7.3.0",
"@typescript-eslint/utils": "^7.3.0",
"chalk": "^4.1.0",
"confusing-browser-globals": "^1.0.9",
"jsonc-eslint-parser": "^2.1.0",

View File

@ -133,6 +133,23 @@
"version": "^6.13.2"
}
}
},
"18.2.0": {
"version": "18.2.0-beta.0",
"packages": {
"@typescript-eslint/parser": {
"version": "^7.3.0"
},
"@typescript-eslint/eslint-plugin": {
"version": "^7.3.0"
},
"@typescript-eslint/utils": {
"version": "^7.3.0"
},
"eslint": {
"version": "~8.57.0"
}
}
}
}
}

View File

@ -37,7 +37,7 @@
"@nx/js": "file:../js",
"eslint": "^8.0.0",
"tslib": "^2.3.0",
"typescript": "~5.3.2"
"typescript": "~5.4.2"
},
"peerDependenciesMeta": {
"js-yaml": {

View File

@ -1,6 +1,6 @@
export const nxVersion = require('../../package.json').version;
export const eslintVersion = '~8.48.0';
export const eslintVersion = '~8.57.0';
export const eslintrcVersion = '^2.1.1';
export const eslintConfigPrettierVersion = '^9.0.0';
export const typescriptESLintVersion = '^6.13.2';
export const typescriptESLintVersion = '^7.3.0';

View File

@ -154,6 +154,19 @@
"alwaysAddToPackageJson": false
}
}
},
"18.2.0": {
"version": "18.2.0-beta.0",
"x-prompt": "Do you want to update to TypeScript v5.4?",
"requires": {
"typescript": ">=5.3.0 <5.4.0"
},
"packages": {
"typescript": {
"version": "~5.4.2",
"alwaysAddToPackageJson": false
}
}
}
}
}

View File

@ -11,7 +11,7 @@ export const typesNodeVersion = '18.16.9';
export const verdaccioVersion = '^5.0.4';
// Typescript
export const typescriptVersion = '~5.3.2';
export const typescriptVersion = '~5.4.2';
/**
* The minimum version is currently determined from the lowest version
* that's supported by the lowest Angular supported version, e.g.

View File

@ -1,4 +1,14 @@
{
"generators": {},
"packageJsonUpdates": {}
"packageJsonUpdates": {
"18.2.0": {
"version": "18.2.0-beta.0",
"packages": {
"@nuxt/eslint-config": {
"version": "~0.3.0-alpha.1",
"alwaysAddToPackageJson": false
}
}
}
}
}

View File

@ -7,4 +7,4 @@ export const nuxtDevtoolsVersion = '1.0.0';
export const nuxtUiTemplatesVersion = '^1.3.1';
// linting deps
export const nuxtEslintConfigVersion = '0.2.0';
export const nuxtEslintConfigVersion = '~0.3.0-alpha.1';

View File

@ -403,10 +403,7 @@ export function parseGitCommit(commit: RawGitCommit): GitCommit | null {
const affectedFiles = Array.from(
commit.body.matchAll(ChangedFileRegex)
).reduce(
(
prev,
[fullLine, changeType, file1, file2]: [string, string, string, string?]
) =>
(prev, [fullLine, changeType, file1, file2]: RegExpExecArray) =>
// file2 only exists for some change types, such as renames
file2 ? [...prev, file1, file2] : [...prev, file1],
[] as string[]

View File

@ -1 +1 @@
export const typescriptVersion = '~5.3.2';
export const typescriptVersion = '~5.4.2';

View File

@ -103,9 +103,9 @@ exports[`@nx/storybook:configuration for Storybook v7 dependencies should add an
"@swc/helpers": "~0.5.2",
"@types/jest": "^29.4.0",
"@types/node": "18.16.9",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "~8.48.0",
"@typescript-eslint/eslint-plugin": "^7.3.0",
"@typescript-eslint/parser": "^7.3.0",
"eslint": "~8.57.0",
"eslint-config-prettier": "^9.0.0",
"existing": "1.0.0",
"jest": "^29.4.1",
@ -114,7 +114,7 @@ exports[`@nx/storybook:configuration for Storybook v7 dependencies should add an
"storybook": "^7.5.3",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.3.2",
"typescript": "~5.4.2",
},
"name": "@proj/source",
}

View File

@ -182,20 +182,20 @@ exports[`lib should add vue, vite and vitest to package.json 1`] = `
"@swc-node/register": "~1.8.0",
"@swc/core": "~1.3.85",
"@swc/helpers": "~0.5.2",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@typescript-eslint/eslint-plugin": "^7.3.0",
"@typescript-eslint/parser": "^7.3.0",
"@vitejs/plugin-vue": "^4.5.0",
"@vitest/coverage-v8": "^1.0.4",
"@vitest/ui": "^1.3.1",
"@vue/eslint-config-prettier": "7.1.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/test-utils": "^2.4.1",
"eslint": "~8.48.0",
"eslint": "~8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-vue": "^9.16.1",
"jsdom": "~22.1.0",
"prettier": "^2.6.2",
"typescript": "~5.3.2",
"typescript": "~5.4.2",
"vite": "~5.0.0",
"vitest": "^1.3.1",
"vue-tsc": "^1.8.8",

View File

@ -85,6 +85,19 @@
"version": "~5.3.2"
}
}
},
"18.2.0": {
"version": "18.2.0-beta.0",
"x-prompt": "Do you want to update to TypeScript v5.4?",
"requires": {
"typescript": ">=5.3.0 <5.4.0"
},
"packages": {
"typescript": {
"version": "~5.4.2",
"alwaysAddToPackageJson": false
}
}
}
}
}

View File

@ -1,7 +1,7 @@
export const nxVersion = require('../../package.json').version;
export const typescriptVersion = '~5.3.2';
export const typescriptVersion = '~5.4.2';
// TODO: remove when preset generation is reworked and
// deps are not installed from workspace
export const angularCliVersion = '~17.2.0';
export const angularCliVersion = '~17.3.0';

3201
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff