Skip to content

fix(@schematics/angular): remove old GoogleBot browserslist setting #14370

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 1 commit into from
May 9, 2019
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
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