feat(angular): add poll option to ng-packagr executors (#28909)
Add `poll` option to the ng-packagr executors. This change was made upstream for Angular v18, but it was missed on the Nx executors. <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
5c7d4d1fbf
commit
dc8f29cc36
@ -36,6 +36,10 @@
|
||||
"description": "Whether to run a build when any file changes.",
|
||||
"default": false
|
||||
},
|
||||
"poll": {
|
||||
"type": "number",
|
||||
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
|
||||
},
|
||||
"tailwindConfig": {
|
||||
"type": "string",
|
||||
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured."
|
||||
|
||||
@ -41,6 +41,10 @@
|
||||
"description": "Whether to run a build when any file changes.",
|
||||
"default": false
|
||||
},
|
||||
"poll": {
|
||||
"type": "number",
|
||||
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
|
||||
},
|
||||
"tailwindConfig": {
|
||||
"type": "string",
|
||||
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured. _Note: starting with Angular v17, this option is no longer used and the configuration will be picked up if exists at the project or workspace root_.",
|
||||
|
||||
@ -33,6 +33,10 @@
|
||||
"description": "Whether to run a build when any file changes.",
|
||||
"default": false
|
||||
},
|
||||
"poll": {
|
||||
"type": "number",
|
||||
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
|
||||
},
|
||||
"tailwindConfig": {
|
||||
"type": "string",
|
||||
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured."
|
||||
|
||||
@ -10,6 +10,7 @@ import type { NgPackagr } from 'ng-packagr';
|
||||
import { join, resolve } from 'path';
|
||||
import { from } from 'rxjs';
|
||||
import { mapTo, switchMap } from 'rxjs/operators';
|
||||
import { getInstalledAngularVersionInfo } from '../utilities/angular-version-utils';
|
||||
import { parseRemappedTsConfigAndMergeDefaults } from '../utilities/typescript';
|
||||
import { getNgPackagrInstance } from './ng-packagr-adjustments/ng-packagr';
|
||||
import type { BuildAngularLibraryExecutorOptions } from './schema';
|
||||
@ -56,6 +57,14 @@ export function createLibraryExecutor(
|
||||
options: BuildAngularLibraryExecutorOptions,
|
||||
context: ExecutorContext
|
||||
) {
|
||||
const { major: angularMajorVersion, version: angularVersion } =
|
||||
getInstalledAngularVersionInfo();
|
||||
if (angularMajorVersion < 18 && options.poll !== undefined) {
|
||||
throw new Error(
|
||||
`The "poll" option requires Angular version 18.0.0 or greater. You are currently using version ${angularVersion}.`
|
||||
);
|
||||
}
|
||||
|
||||
const { target, dependencies, topLevelDependencies } =
|
||||
calculateProjectBuildableDependencies(
|
||||
context.taskGraph,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
export interface BuildAngularLibraryExecutorOptions {
|
||||
project: string;
|
||||
import type { NgPackagrBuilderOptions } from '@angular-devkit/build-angular';
|
||||
|
||||
export interface BuildAngularLibraryExecutorOptions
|
||||
extends NgPackagrBuilderOptions {
|
||||
tailwindConfig?: string;
|
||||
tsConfig?: string;
|
||||
watch?: boolean;
|
||||
}
|
||||
|
||||
@ -33,6 +33,10 @@
|
||||
"description": "Whether to run a build when any file changes.",
|
||||
"default": false
|
||||
},
|
||||
"poll": {
|
||||
"type": "number",
|
||||
"description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
|
||||
},
|
||||
"tailwindConfig": {
|
||||
"type": "string",
|
||||
"description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured. _Note: starting with Angular v17, this option is no longer used and the configuration will be picked up if exists at the project or workspace root_.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user