Skip to content

Commit 1fcade2

Browse files
devversionmmalerba
authored andcommitted
build: remove unused dependencies (#17988)
* build: remove unused dependencies Removes all unused dependencies. Also reduces dependencies needed for the legacy gulp setup that is only used for testing these days (e.g. minifying is not needed for tests; and we also don't have it in Bazel) * refactor: ensure paginator test assertions pass in MS Edge Since we remove HTML minification from the gulp legacy output (note: we don't have HTML minification in Bazel either), paginator tests that run against IE11 and MS Edge started to fail because `innerText` returned a different value with whitepsaces in these browsers. This doesn't seem to be the case visually. We can make the tests pass consistently by removing leading/trailing whitespace.
1 parent 4169c6f commit 1fcade2

File tree

13 files changed

+47
-395
lines changed

13 files changed

+47
-395
lines changed

angular-tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
"node_modules/@angular/**/*"
2222
],
2323
"exclude": [
24+
"node_modules/@angular/**/schematics/**",
25+
"node_modules/@angular/**/testing/**",
2426
"node_modules/@angular/bazel/**",
27+
"node_modules/@angular/common/upgrade*",
2528
"node_modules/@angular/compiler-cli/**",
26-
"node_modules/@angular/**/schematics/**",
27-
"node_modules/@angular/**/testing/**"
29+
"node_modules/@angular/router/upgrade*"
2830
]
2931
}

gulpfile.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,4 @@ require('ts-node').register({
2121
project: tsconfigPath
2222
});
2323

24-
// The gulp tsconfig file maps specific imports to relative paths. In combination with ts-node
25-
// this doesn't work because the JavaScript output will still refer to the imports instead of
26-
// to the relative path. Tsconfig-paths can be used to support path mapping inside of Node.
27-
require('tsconfig-paths').register({
28-
baseUrl: path.dirname(tsconfigPath),
29-
paths: tsconfig.compilerOptions.paths
30-
});
31-
3224
require('./tools/gulp/gulpfile');

package.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
"@angular/platform-browser-dynamic": "^9.0.0-rc.6",
6868
"@angular/platform-server": "^9.0.0-rc.6",
6969
"@angular/router": "^9.0.0-rc.6",
70-
"@angular/upgrade": "^9.0.0-rc.6",
7170
"@bazel/bazel": "^1.1.0",
7271
"@bazel/buildifier": "^0.29.0",
7372
"@bazel/ibazel": "^0.10.3",
@@ -82,13 +81,11 @@
8281
"@types/fs-extra": "^4.0.3",
8382
"@types/glob": "^5.0.33",
8483
"@types/gulp": "3.8.32",
85-
"@types/gulp-util": "^3.0.34",
8684
"@types/inquirer": "^0.0.43",
8785
"@types/jasmine": "^3.4.0",
8886
"@types/marked": "^0.4.2",
8987
"@types/merge2": "^0.3.30",
9088
"@types/minimist": "^1.2.0",
91-
"@types/mock-fs": "^3.6.30",
9289
"@types/node": "^12.11.1",
9390
"@types/parse5": "^5.0.0",
9491
"@types/run-sequence": "^0.0.29",
@@ -108,13 +105,8 @@
108105
"glob": "^7.1.2",
109106
"gulp": "^3.9.1",
110107
"gulp-clean": "^0.3.2",
111-
"gulp-clean-css": "^3.3.1",
112108
"gulp-cli": "^2.0.1",
113-
"gulp-htmlmin": "^3.0.0",
114-
"gulp-if": "^2.0.2",
115-
"gulp-rename": "^1.2.2",
116109
"gulp-sass": "^4.0.2",
117-
"gulp-util": "^3.0.8",
118110
"highlight.js": "^9.11.0",
119111
"husky": "^1.3.1",
120112
"inquirer": "^6.2.0",
@@ -129,18 +121,15 @@
129121
"karma-sauce-launcher": "^2.0.2",
130122
"karma-sourcemap-loader": "^0.3.7",
131123
"madge": "^3.4.4",
132-
"magic-string": "^0.22.4",
133124
"marked": "^0.6.2",
134125
"merge2": "^1.2.3",
135126
"minimatch": "^3.0.4",
136127
"minimist": "^1.2.0",
137-
"mock-fs": "^4.7.0",
138128
"moment": "^2.18.1",
139129
"node-sass": "^4.12.0",
140130
"parse5": "^5.0.0",
141131
"protractor": "^5.4.2",
142132
"requirejs": "^2.3.6",
143-
"resolve-bin": "^0.4.0",
144133
"rollup": "~1.25.0",
145134
"rollup-plugin-alias": "^1.4.0",
146135
"rollup-plugin-commonjs": "^10.1.0",
@@ -152,16 +141,13 @@
152141
"semver": "^6.3.0",
153142
"send": "^0.17.1",
154143
"shelljs": "^0.8.3",
155-
"sorcery": "^0.10.0",
156144
"stylelint": "^10.1.0",
157145
"terser": "^4.3.9",
158146
"ts-api-guardian": "^0.4.6",
159147
"ts-node": "^3.0.4",
160-
"tsconfig-paths": "^2.3.0",
161148
"tslint": "^5.20.0",
162149
"tsutils": "^3.0.0",
163150
"typescript": "^3.6.4",
164-
"uglify-js": "^2.8.14",
165151
"vrsource-tslint-rules": "5.1.1"
166152
},
167153
"resolutions": {

src/cdk/schematics/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ ts_library(
7777
"@npm//@schematics/angular",
7878
"@npm//@types/jasmine",
7979
"@npm//@types/node",
80-
"@npm//mock-fs",
8180
"@npm//typescript",
8281
],
8382
)

src/material/paginator/paginator.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,42 +47,42 @@ describe('MatPaginator', () => {
4747
component.pageSize = 10;
4848
component.pageIndex = 1;
4949
fixture.detectChanges();
50-
expect(rangeElement.innerText).toBe('11 – 20 of 100');
50+
expect(rangeElement.innerText.trim()).toBe('11 – 20 of 100');
5151

5252
// View third page of list of 200, each page contains 20 items.
5353
component.length = 200;
5454
component.pageSize = 20;
5555
component.pageIndex = 2;
5656
fixture.detectChanges();
57-
expect(rangeElement.innerText).toBe('41 – 60 of 200');
57+
expect(rangeElement.innerText.trim()).toBe('41 – 60 of 200');
5858

5959
// View first page of list of 0, each page contains 5 items.
6060
component.length = 0;
6161
component.pageSize = 5;
6262
component.pageIndex = 2;
6363
fixture.detectChanges();
64-
expect(rangeElement.innerText).toBe('0 of 0');
64+
expect(rangeElement.innerText.trim()).toBe('0 of 0');
6565

6666
// View third page of list of 12, each page contains 5 items.
6767
component.length = 12;
6868
component.pageSize = 5;
6969
component.pageIndex = 2;
7070
fixture.detectChanges();
71-
expect(rangeElement.innerText).toBe('11 – 12 of 12');
71+
expect(rangeElement.innerText.trim()).toBe('11 – 12 of 12');
7272

7373
// View third page of list of 10, each page contains 5 items.
7474
component.length = 10;
7575
component.pageSize = 5;
7676
component.pageIndex = 2;
7777
fixture.detectChanges();
78-
expect(rangeElement.innerText).toBe('11 – 15 of 10');
78+
expect(rangeElement.innerText.trim()).toBe('11 – 15 of 10');
7979

8080
// View third page of list of -5, each page contains 5 items.
8181
component.length = -5;
8282
component.pageSize = 5;
8383
component.pageIndex = 2;
8484
fixture.detectChanges();
85-
expect(rangeElement.innerText).toBe('11 – 15 of 0');
85+
expect(rangeElement.innerText.trim()).toBe('11 – 15 of 0');
8686
});
8787

8888
it('should show right aria-labels for select and buttons', () => {
@@ -247,19 +247,19 @@ describe('MatPaginator', () => {
247247
it('should mark for check when inputs are changed directly', () => {
248248
const rangeElement = fixture.nativeElement.querySelector('.mat-paginator-range-label');
249249

250-
expect(rangeElement.innerText).toBe('1 – 10 of 100');
250+
expect(rangeElement.innerText.trim()).toBe('1 – 10 of 100');
251251

252252
paginator.length = 99;
253253
fixture.detectChanges();
254-
expect(rangeElement.innerText).toBe('1 – 10 of 99');
254+
expect(rangeElement.innerText.trim()).toBe('1 – 10 of 99');
255255

256256
paginator.pageSize = 6;
257257
fixture.detectChanges();
258-
expect(rangeElement.innerText).toBe('1 – 6 of 99');
258+
expect(rangeElement.innerText.trim()).toBe('1 – 6 of 99');
259259

260260
paginator.pageIndex = 1;
261261
fixture.detectChanges();
262-
expect(rangeElement.innerText).toBe('7 – 12 of 99');
262+
expect(rangeElement.innerText.trim()).toBe('7 – 12 of 99');
263263

264264
// Having one option and the same page size should remove the select menu
265265
expect(fixture.nativeElement.querySelector('.mat-select')).not.toBeNull();

tools/gulp/gulpfile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {createPackageBuildTasks} from 'material2-build-tools';
1+
import {createPackageBuildTasks} from '../package-tools';
22
import {
33
cdkExperimentalPackage,
44
cdkPackage,

tools/gulp/packages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {BuildPackage} from 'material2-build-tools';
1+
import {BuildPackage} from '../package-tools';
22

33
export const cdkPackage = new BuildPackage('cdk');
44
export const materialPackage = new BuildPackage('material', [cdkPackage]);

tools/gulp/tasks/clean.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {task, src} from 'gulp';
2-
import {buildConfig} from 'material2-build-tools';
2+
import {buildConfig} from '../../package-tools';
33

44
// This import lacks type definitions.
55
const gulpClean = require('gulp-clean');

tools/gulp/tasks/unit-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {join} from 'path';
22
import {task, watch} from 'gulp';
3-
import {buildConfig, sequenceTask} from 'material2-build-tools';
3+
import {buildConfig, sequenceTask} from '../../package-tools';
44

55
// There are no type definitions available for these imports.
66
const runSequence = require('run-sequence');

tools/gulp/tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
"types": [
1818
"node"
1919
],
20-
"baseUrl": ".",
21-
"paths": {
22-
"material2-build-tools": ["../package-tools/index"]
23-
}
20+
"baseUrl": "."
2421
},
2522
"files": [
2623
"gulpfile.ts"

tools/package-tools/gulp/build-scss-pipeline.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import {buildConfig} from '../build-config';
55
// These imports lack of type definitions.
66
const gulpSass = require('gulp-sass');
77
const nodeSass = require('node-sass');
8-
const gulpIf = require('gulp-if');
9-
const gulpCleanCss = require('gulp-clean-css');
108

119
const sassIncludePaths = [
1210
join(buildConfig.projectDir, 'node_modules/')
@@ -16,8 +14,7 @@ const sassIncludePaths = [
1614
gulpSass.compiler = nodeSass;
1715

1816
/** Create a gulp task that builds SCSS files. */
19-
export function buildScssPipeline(sourceDir: string, minifyOutput = false) {
17+
export function buildScssPipeline(sourceDir: string) {
2018
return src(join(sourceDir, '**/!(test-).scss'))
21-
.pipe(gulpSass({includePaths: sassIncludePaths}).on('error', gulpSass.logError))
22-
.pipe(gulpIf(minifyOutput, gulpCleanCss()));
19+
.pipe(gulpSass({includePaths: sassIncludePaths}).on('error', gulpSass.logError));
2320
}

tools/package-tools/gulp/build-tasks-gulp.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ import {inlineResourcesForDirectory} from '../inline-resources';
55
import {buildScssPipeline} from './build-scss-pipeline';
66
import {sequenceTask} from './sequence-task';
77

8-
// There are no type definitions available for these imports.
9-
const htmlmin = require('gulp-htmlmin');
10-
11-
const htmlMinifierOptions = {
12-
collapseWhitespace: true,
13-
removeComments: true,
14-
caseSensitive: true,
15-
removeAttributeQuotes: false
16-
};
17-
188
/**
199
* Creates a set of gulp tasks that can build the specified package.
2010
* @param buildPackage Build package for which the gulp tasks will be generated
@@ -64,7 +54,7 @@ export function createPackageBuildTasks(buildPackage: BuildPackage, preBuildTask
6454
task(`${taskName}:assets`, assetTasks);
6555

6656
task(`${taskName}:assets:scss`, () => {
67-
return buildScssPipeline(buildPackage.sourceDir, true)
57+
return buildScssPipeline(buildPackage.sourceDir)
6858
.pipe(dest(buildPackage.outputDir));
6959
}
7060
);
@@ -75,8 +65,7 @@ export function createPackageBuildTasks(buildPackage: BuildPackage, preBuildTask
7565
});
7666

7767
task(`${taskName}:assets:html`, () => {
78-
return src(htmlGlob).pipe(htmlmin(htmlMinifierOptions))
79-
.pipe(dest(buildPackage.outputDir));
68+
return src(htmlGlob).pipe(dest(buildPackage.outputDir));
8069
});
8170

8271
task(`${taskName}:assets:inline`, () => {

0 commit comments

Comments
 (0)