microlink logo

Microlink Recipe

Run Lighthouse on demand

lighthouseReport.js
const mql = require('@microlink/mql')

const lighthouseReport = async (url, opts) => {
  const { data } = await mql(url, {
    meta: false,
    insights: {
      lighthouse: {
        device: 'mobile',
        onlyCategories: [
          'performance',
          'best-practices',
          'accessibility',
          'seo',
          'pwa',
        ],
      },
      technologies: false,
    },
    ...opts,
  })

  return data.insights.lighthouse
}

const result = await lighthouseReport('https://example.com')

mql.render(result)