Skip to content

Commit

Permalink
fix(@schematics/angular): remove old GoogleBot browserslist setting
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Alan Agius authored and Keen Yee Liau committed May 9, 2019
1 parent 555819d commit 04b8549
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
# You can see what browsers were selected by your queries by running:
# npx browserslist

# Googlebot uses an older version of Chrome
# For additional information see: https://developers.google.com/search/docs/guides/rendering

> 0.5%
last 2 versions
Firefox ESR
Chrome 41 # Support for Googlebot
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ const browserslistContent = `# This file is used by the build system to adjust C
# You can see what browsers were selected by your queries by running:
# npx browserslist
# Googlebot uses an older version of Chrome
# For additional information see: https://developers.google.com/search/docs/guides/rendering
> 0.5%
last 2 versions
Firefox ESR
Chrome 41 # Support for Googlebot
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.`;

Expand Down Expand Up @@ -148,13 +144,8 @@ function updateProjects(): Rule {
}
}

const source = tree.read(browserslistPath);
if (!source) {
if (!tree.exists(browserslistPath)) {
tree.create(browserslistPath, browserslistContent);
} else if (!source.toString().toLowerCase().includes('chrome 41')) {
const recorder = tree.beginUpdate(browserslistPath);
recorder.insertRight(source.length, '\nChrome 41 # Googlebot');
tree.commitUpdate(recorder);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,17 @@ describe('Migration to version 8', () => {
expect(module).toBe('esnext');
});

it(`should update browserslist file to add an non evergreen browser`, () => {
const tree2 = schematicRunner.runSchematic('migration-07', {}, tree.branch());
expect(tree2.readContent('/browserslist')).toContain('Chrome 41');
});

it(`should create browserslist file if it doesn't exist`, () => {
tree.delete('/browserslist');
const tree2 = schematicRunner.runSchematic('migration-07', {}, tree.branch());
expect(tree2.exists('/browserslist')).toBe(true);
expect(tree2.readContent('/browserslist'))
.toContain('Support for Googlebot');
});

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

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

0 comments on commit 04b8549

Please sign in to comment.