Skip to content

Commit 04b8549

Browse files
Alan AgiusKeen Yee Liau
Alan Agius
authored and
Keen Yee Liau
committed
fix(@schematics/angular): remove old GoogleBot browserslist setting
GoogleBot is now evergreen, we don't need to specialcase it: https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html?m=1 Fixes #14364
1 parent 555819d commit 04b8549

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

packages/schematics/angular/application/files/browserslist.template

-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
# You can see what browsers were selected by your queries by running:
66
# npx browserslist
77

8-
# Googlebot uses an older version of Chrome
9-
# For additional information see: https://developers.google.com/search/docs/guides/rendering
10-
118
> 0.5%
129
last 2 versions
1310
Firefox ESR
14-
Chrome 41 # Support for Googlebot
1511
not dead
1612
not IE 9-11 # For IE 9-11 support, remove 'not'.

packages/schematics/angular/migrations/update-8/differential-loading.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ const browserslistContent = `# This file is used by the build system to adjust C
2929
# You can see what browsers were selected by your queries by running:
3030
# npx browserslist
3131
32-
# Googlebot uses an older version of Chrome
33-
# For additional information see: https://developers.google.com/search/docs/guides/rendering
34-
3532
> 0.5%
3633
last 2 versions
3734
Firefox ESR
38-
Chrome 41 # Support for Googlebot
3935
not dead
4036
not IE 9-11 # For IE 9-11 support, remove 'not'.`;
4137

@@ -148,13 +144,8 @@ function updateProjects(): Rule {
148144
}
149145
}
150146

151-
const source = tree.read(browserslistPath);
152-
if (!source) {
147+
if (!tree.exists(browserslistPath)) {
153148
tree.create(browserslistPath, browserslistContent);
154-
} else if (!source.toString().toLowerCase().includes('chrome 41')) {
155-
const recorder = tree.beginUpdate(browserslistPath);
156-
recorder.insertRight(source.length, '\nChrome 41 # Googlebot');
157-
tree.commitUpdate(recorder);
158149
}
159150
}
160151

packages/schematics/angular/migrations/update-8/differential-loading_spec.ts

-10
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,17 @@ describe('Migration to version 8', () => {
8080
expect(module).toBe('esnext');
8181
});
8282

83-
it(`should update browserslist file to add an non evergreen browser`, () => {
84-
const tree2 = schematicRunner.runSchematic('migration-07', {}, tree.branch());
85-
expect(tree2.readContent('/browserslist')).toContain('Chrome 41');
86-
});
87-
8883
it(`should create browserslist file if it doesn't exist`, () => {
8984
tree.delete('/browserslist');
9085
const tree2 = schematicRunner.runSchematic('migration-07', {}, tree.branch());
9186
expect(tree2.exists('/browserslist')).toBe(true);
92-
expect(tree2.readContent('/browserslist'))
93-
.toContain('Support for Googlebot');
9487
});
9588

9689
it('should move browserslist file if it exists in the sourceRoot', () => {
9790
tree.create('/src/browserslist', 'last 2 Chrome versions');
9891
tree.delete('/browserslist');
9992
const tree2 = schematicRunner.runSchematic('migration-07', {}, tree.branch());
10093
expect(tree2.exists('/browserslist')).toBe(true);
101-
const content = tree2.readContent('/browserslist');
102-
expect(content).toContain('Chrome 41');
103-
expect(content).toContain('last 2 Chrome versions');
10494
});
10595

10696
it(`should remove 'target' and 'module' from non workspace tsconfig.json`, () => {

0 commit comments

Comments
 (0)