From 228f1df7d087f66f6f1550a086c2775c226cc6b3 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 25 Jun 2019 19:10:03 +0200 Subject: [PATCH] fix(ng-update): do not rely on node-glob for finding rule directories We currently use `glob` in order to find rule directories automatically. This has implications because it means that we depend on `glob` that is usually brought in transitively by other project dependencies. This means that the glob version is not guaranteed to be working due to previous `glob` issues on windows. Related to #16208 --- .../ng-update/upgrade-rules/tslint-config.ts | 15 +++++++++++++-- src/material/schematics/ng-update/index.ts | 8 ++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/cdk/schematics/ng-update/upgrade-rules/tslint-config.ts b/src/cdk/schematics/ng-update/upgrade-rules/tslint-config.ts index c1da8cf9a3d0..83baa6082341 100644 --- a/src/cdk/schematics/ng-update/upgrade-rules/tslint-config.ts +++ b/src/cdk/schematics/ng-update/upgrade-rules/tslint-config.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {sync as globSync} from 'glob'; +import {join} from 'path'; import {TargetVersion} from '../target-version'; import {RuleUpgradeData} from '../upgrade-data'; @@ -67,7 +67,18 @@ const baseUpgradeRules: UpgradeRules = [ ]; /** List of absolute paths that refer to directories that contain the upgrade rules. */ -const ruleDirectories = globSync('./**/', {cwd: __dirname, absolute: true}); +const ruleDirectories = [ + 'attribute-selectors/', + 'class-inheritance/', + 'class-names/', + 'css-selectors/', + 'element-selectors/', + 'input-names/', + 'misc-checks/', + 'output-names/', + 'property-names/', + 'signature-check/', +].map(relativePath => join(__dirname, relativePath)); /** * Creates a TSLint configuration object that can be passed to the schematic `TSLintFixTask`. diff --git a/src/material/schematics/ng-update/index.ts b/src/material/schematics/ng-update/index.ts index 8bc022b1adb4..3b78b90f90e2 100644 --- a/src/material/schematics/ng-update/index.ts +++ b/src/material/schematics/ng-update/index.ts @@ -9,7 +9,7 @@ import {Rule} from '@angular-devkit/schematics'; import {createUpgradeRule, TargetVersion, UpgradeTSLintConfig} from '@angular/cdk/schematics'; import {green, yellow} from 'chalk'; -import {sync as globSync} from 'glob'; +import {join} from 'path'; import {materialUpgradeData} from './upgrade-data'; @@ -33,7 +33,11 @@ const upgradeRules = [ ]; /** List of absolute paths that refer to directories that contain the Material upgrade rules. */ -const ruleDirectories = globSync('upgrade-rules/**/', {cwd: __dirname, absolute: true}); +const ruleDirectories = [ + 'misc-checks/', + 'misc-ripples-v7/', + 'package-imports-v8/', +].map(relativePath => join(__dirname, 'upgrade-rules/', relativePath)); /** TSLint upgrade configuration that will be passed to the CDK ng-update rule. */ const tslintUpgradeConfig: UpgradeTSLintConfig = {