Skip to content

fix(ng-update): do not rely on node-glob for finding rule directories #16381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/cdk/schematics/ng-update/upgrade-rules/tslint-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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`.
Expand Down
8 changes: 6 additions & 2 deletions src/material/schematics/ng-update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 = {
Expand Down