Skip to content

Commit

Permalink
feat: lighthouse итоговые очки по категориям (scores)
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Nov 15, 2018
1 parent c889d34 commit d8900f3
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ export default {
'h1_count'
]
},
pagespeed: {
name: 'pagespeed',
pagespeed_performance: {
name: 'pagespeed_performance',
columns: [
'domain_idn',
'host',
'prod',
'engine',
'meta_visitors',
'errors',
'lighthouse_performance',
'lighthouse_interactive',
'lighthouse_speed_index',
'lighthouse_first_contentful_paint',
Expand All @@ -231,6 +231,21 @@ export default {
'lighthouse_input_latency'
]
},
pagespeed_score: {
name: 'pagespeed_score',
columns: [
'domain_idn',
'host',
'prod',
'engine',
'errors',
'lighthouse_performance',
'lighthouse_pwa',
'lighthouse_accessibility',
'lighthouse_best_practices',
'lighthouse_seo'
]
},
https: {
name: 'https',
columns: ['domain_idn', 'https', 'email']
Expand Down Expand Up @@ -499,8 +514,16 @@ export default {
if (site.lighthouse) {
// console.log(site.lighthouse);
for (let i in site.lighthouse) {
const ln = 'lighthouse_' + i.split('-').join('_');
site[ln] = site.lighthouse[i];
// вложенный объект
if(i == 'scores'){
for (let s in site.lighthouse.scores){
const ln = 'lighthouse_' + s.split('-').join('_');
site[ln] = site.lighthouse.scores[s];
}
} else {
const ln = 'lighthouse_' + i.split('-').join('_');
site[ln] = site.lighthouse[i];
}
}
delete site.lighthouse;
}
Expand Down Expand Up @@ -554,6 +577,26 @@ export default {
warn: { min: 50, max: 100 },
error: { min: 101 }
},
lighthouse_performance: {
warn: { min: 50, max: 79 },
error: { max: 50 }
},
lighthouse_pwa: {
warn: { min: 50, max: 79 },
error: { max: 50 }
},
lighthouse_accessibility: {
warn: { min: 50, max: 79 },
error: { max: 50 }
},
lighthouse_best_practices: {
warn: { min: 50, max: 79 },
error: { max: 50 }
},
lighthouse_seo: {
warn: { min: 50, max: 79 },
error: { max: 50 }
}
};
if (column in validateMap) {
Expand Down

0 comments on commit d8900f3

Please sign in to comment.