Skip to content

Commit 760058a

Browse files
devversionandrewseguin
authored andcommitted
fix(ng-update): do not rely on node-glob for finding rule directories (#16381)
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
1 parent 3537e97 commit 760058a

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/cdk/schematics/ng-update/upgrade-rules/tslint-config.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {sync as globSync} from 'glob';
9+
import {join} from 'path';
1010
import {TargetVersion} from '../target-version';
1111
import {RuleUpgradeData} from '../upgrade-data';
1212

@@ -67,7 +67,18 @@ const baseUpgradeRules: UpgradeRules = [
6767
];
6868

6969
/** List of absolute paths that refer to directories that contain the upgrade rules. */
70-
const ruleDirectories = globSync('./**/', {cwd: __dirname, absolute: true});
70+
const ruleDirectories = [
71+
'attribute-selectors/',
72+
'class-inheritance/',
73+
'class-names/',
74+
'css-selectors/',
75+
'element-selectors/',
76+
'input-names/',
77+
'misc-checks/',
78+
'output-names/',
79+
'property-names/',
80+
'signature-check/',
81+
].map(relativePath => join(__dirname, relativePath));
7182

7283
/**
7384
* Creates a TSLint configuration object that can be passed to the schematic `TSLintFixTask`.

src/material/schematics/ng-update/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {Rule} from '@angular-devkit/schematics';
1010
import {createUpgradeRule, TargetVersion, UpgradeTSLintConfig} from '@angular/cdk/schematics';
1111
import {green, yellow} from 'chalk';
12-
import {sync as globSync} from 'glob';
12+
import {join} from 'path';
1313

1414
import {materialUpgradeData} from './upgrade-data';
1515

@@ -33,7 +33,11 @@ const upgradeRules = [
3333
];
3434

3535
/** List of absolute paths that refer to directories that contain the Material upgrade rules. */
36-
const ruleDirectories = globSync('upgrade-rules/**/', {cwd: __dirname, absolute: true});
36+
const ruleDirectories = [
37+
'misc-checks/',
38+
'misc-ripples-v7/',
39+
'package-imports-v8/',
40+
].map(relativePath => join(__dirname, 'upgrade-rules/', relativePath));
3741

3842
/** TSLint upgrade configuration that will be passed to the CDK ng-update rule. */
3943
const tslintUpgradeConfig: UpgradeTSLintConfig = {

0 commit comments

Comments
 (0)