Skip to content
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

misc: update stack packs, remove duplicated stack pack files #11396

Merged
merged 11 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from 8 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
213 changes: 159 additions & 54 deletions lighthouse-core/lib/i18n/locales/ar-XB.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ar.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/bg.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ca.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/cs.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/da.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/de.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/el.json

Large diffs are not rendered by default.

219 changes: 162 additions & 57 deletions lighthouse-core/lib/i18n/locales/en-GB.json

Large diffs are not rendered by default.

175 changes: 131 additions & 44 deletions lighthouse-core/lib/i18n/locales/en-US.json

Large diffs are not rendered by default.

213 changes: 159 additions & 54 deletions lighthouse-core/lib/i18n/locales/en-XA.json

Large diffs are not rendered by default.

175 changes: 131 additions & 44 deletions lighthouse-core/lib/i18n/locales/en-XL.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/es-419.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/es.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/fi.json

Large diffs are not rendered by default.

251 changes: 178 additions & 73 deletions lighthouse-core/lib/i18n/locales/fil.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/fr.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/he.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/hi.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/hr.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/hu.json

Large diffs are not rendered by default.

251 changes: 178 additions & 73 deletions lighthouse-core/lib/i18n/locales/id.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/it.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ja.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ko.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/lt.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/lv.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/nl.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/no.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/pl.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/pt-PT.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/pt.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ro.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ru.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/sk.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/sl.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/sr-Latn.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/sr.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/sv.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/ta.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/te.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/th.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/tr.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/uk.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/vi.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/zh-HK.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/zh-TW.json

Large diffs are not rendered by default.

253 changes: 179 additions & 74 deletions lighthouse-core/lib/i18n/locales/zh.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lighthouse-core/lib/stack-packs.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ function getStackPacks(pageStacks) {

module.exports = {
getStackPacks,
stackPacksToInclude,
};
6 changes: 4 additions & 2 deletions lighthouse-core/scripts/i18n/collect-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ function createPsuedoLocaleStrings(messages) {
* @return {string}
*/
function getIdentifier(node) {
if (!node.name || !tsc.isIdentifier(node.name)) throw new Error('no Identifier found');
if (!node.name || !(tsc.isIdentifier(node.name) || tsc.isStringLiteral(node.name))) {
throw new Error('no Identifier found');
}

return node.name.text;
}
Expand Down Expand Up @@ -629,7 +631,7 @@ if (require.main === module) {

if (collisions > 0) {
console.log(`MEANING COLLISION: ${collisions} string(s) have the same content.`);
assert.equal(collisions, 16, `The number of duplicate strings have changed, update this assertion if that is expected, or reword strings. Collisions: ${collisionStrings}`);
assert.equal(collisions, 21, `The number of duplicate strings have changed, update this assertion if that is expected, or reword strings. Collisions: ${collisionStrings}`);
}

writeStringsToCtcFiles('en-US', strings);
Expand Down
169 changes: 169 additions & 0 deletions lighthouse-core/test/lib/stack-packs-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/**
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

/* eslint-env jest */

const lighthouseStackPacksDep = require('lighthouse-stack-packs');
const stackPacksLib = require('../../lib/stack-packs.js');
const defaultConfig = require('../../config/default-config.js');
const Config = require('../../config/config.js');

function getAuditIds() {
const config = new Config(defaultConfig);
return config.audits.map(a => a.implementation.meta.id);
}

describe('stack-packs lib', () => {
it('packs without detectors', () => {
const result = lighthouseStackPacksDep
.filter(p => !stackPacksLib.stackPacksToInclude.find(p2 => p2.packId === p.id))
.map(p => p.id);
expect(result).toMatchInlineSnapshot(`
Array [
"drupal",
]
`);
});
});

// These tests summarize the contents of the lighthouse-stack-packs package.
describe('lighthouse-stack-packs dep', () => {
it('snapshot packs', () => {
expect(lighthouseStackPacksDep.map(p => p.id)).toMatchInlineSnapshot(`
Array [
"wordpress",
"drupal",
"react",
"angular",
"amp",
"magento",
]
`);
});

// Keys should only be added, not removed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this instructions for someone updating the snapshot or a description of the test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for updating the snapshot. moved it down a bit.

it('snapshot keys for each pack', () => {
const result = lighthouseStackPacksDep.map(p => {
return {id: p.id, keys: Object.keys(p.UIStrings)};
});
expect(result).toMatchInlineSnapshot(`
Array [
Object {
"id": "wordpress",
"keys": Array [
"unused-css-rules",
"uses-webp-images",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"time-to-first-byte",
],
},
Object {
"id": "drupal",
"keys": Array [
"unused-css-rules",
"unused-javascript",
"uses-webp-images",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-responsive-images",
"time-to-first-byte",
"uses-rel-preconnect",
"font-display",
],
},
Object {
"id": "react",
"keys": Array [
"unminified-css",
"unminified-javascript",
"unused-javascript",
"time-to-first-byte",
"redirects",
"user-timings",
"dom-size",
],
},
Object {
"id": "angular",
"keys": Array [
"total-byte-weight",
"unminified-warning",
"unused-javascript",
"uses-responsive-images",
"uses-rel-preload",
"dom-size",
],
},
Object {
"id": "amp",
"keys": Array [
"uses-webp-images",
"offscreen-images",
"render-blocking-resources",
"unminified-css",
"efficient-animated-content",
"uses-responsive-images",
],
},
Object {
"id": "magento",
"keys": Array [
"uses-webp-images",
"offscreen-images",
"disable-bundling",
"unminified-css",
"unminified-javascript",
"unused-javascript",
"uses-optimized-images",
"time-to-first-byte",
"uses-rel-preconnect",
"uses-rel-preload",
"critical-request-chains",
"font-display",
],
},
]
`);
});

// Keys for plugin audits are allowed in this package.
// Make sure none are typos of core audits.
it('snapshot unrecognized keys', () => {
const auditIds = getAuditIds();

const unrecognizedKeys = new Set();
for (const pack of lighthouseStackPacksDep) {
for (const key in pack.UIStrings) {
if (!auditIds.includes(key)) unrecognizedKeys.add(key);
}
}

expect([...unrecognizedKeys]).toMatchInlineSnapshot(`
Array [
"time-to-first-byte",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huzzah catching bugs already! I'm guessing it should be server-response-time since it was renamed from time-to-first-byte :)

Copy link
Collaborator Author

@connorjclark connorjclark Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, but punt GoogleChrome/lighthouse-stack-packs#50

edit: or maybe dont punt. idk

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure punt is fine, wasn't trying to flag this as a blocker, just celebrating the success of its implementation 🎉 :)

"unminified-warning",
"disable-bundling",
]
`);
});
});
Loading