Skip to content

Commit f16973f

Browse files
committed
fix(schematics): properly detect tsconfig files
* Currently the `tsconfig` files are not being detected properly with the latest Angular CLI version. * Improves tslint config comment
1 parent 877de56 commit f16973f

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/lib/schematics/update/update.spec.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@ describe('material-nav-schematic', () => {
88
runner = new SchematicTestRunner('schematics', migrationCollection);
99
});
1010

11-
describe('migration v5 to v6', () => {
12-
13-
it('should remove the temp directory', () => {
14-
const tree = runner.runSchematic('migration-01', {}, createTestApp());
15-
const files = tree.files;
16-
17-
expect(files.find(file => file.includes('angular_material_temp_schematics')))
18-
.toBeFalsy('Expected the temporary directory for the schematics to be deleted');
19-
});
11+
it('should remove the temp directory', () => {
12+
const tree = runner.runSchematic('migration-01', {}, createTestApp());
13+
const files = tree.files;
2014

15+
expect(files.find(file => file.includes('angular_material_temp_schematics')))
16+
.toBeFalsy('Expected the temporary directory for the schematics to be deleted');
2117
});
2218

2319
});

src/lib/schematics/update/update.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default function(): Rule {
4141

4242
const allTsConfigPaths = getTsConfigPaths(tree);
4343
const allUpdateTasks = [];
44+
4445
for (const tsconfig of allTsConfigPaths) {
4546
// Run the update tslint rules.
4647
allUpdateTasks.push(context.addTask(new TslintFixTask({
@@ -119,12 +120,13 @@ function getTsConfigPaths(tree: Tree): string[] {
119120

120121
// Add any tsconfig directly referenced in a build or test task of the angular.json workspace.
121122
const workspace = getWorkspace(tree);
123+
122124
for (const project of Object.values(workspace.projects)) {
123125
if (project && project.architect) {
124126
for (const taskName of ['build', 'test']) {
125127
const task = project.architect[taskName];
126128
if (task && task.options && task.options.tsConfig) {
127-
const tsConfigOption = project.architect.tsConfig;
129+
const tsConfigOption = task.options.tsConfig;
128130
if (typeof tsConfigOption === 'string') {
129131
tsconfigPaths.push(tsConfigOption);
130132
} else if (Array.isArray(tsConfigOption)) {

tslint.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@
131131
},
132132
"linterOptions": {
133133
// Exclude schematic template files that can't be linted.
134-
// TODO(paul) re-renable specs once the devkit schematics properly work with Bazel.
135-
"exclude": ["src/lib/schematics/**/files/**/*", "src/lib/schematics/**/*.spec.ts"]
134+
"exclude": [
135+
"src/lib/schematics/**/files/**/*",
136+
// TODO(paul) re-renable specs once the devkit schematics properly work with Bazel and we
137+
// can remove the `xit` calls.
138+
"src/lib/schematics/**/*.spec.ts"
139+
]
136140
}
137141
}

0 commit comments

Comments
 (0)