function makeSummary(legacyJavascriptFilename) {
  let totalSignals = 0;
  const variants = [];
  for (const dir of glob.sync('*/*', {cwd: VARIANT_DIR})) {
    const {group, name} = readJson(`${VARIANT_DIR}/${dir}/variant.json`);
    /** @type {SummaryFile} */
    const summary = readJson(`${VARIANT_DIR}/${dir}/${legacyJavascriptFilename}`);

    for (const {bundle, result} of summary) {
      const signals = result.matches.map(m => m.name);
      totalSignals += signals.length;
      variants.push({group, name, bundle, dir, signals});
    }
  }

  return {
    totalSignals,
    variantsMissingSignals: [
      ...new Set(variants.filter(v => v.signals.length === 0).map(v => v.name)),
    ],
    variants,
  };
}
/*.js',
      '-o', `${dir}/main.transpiled.js`,
      '--source-maps', 'inline',
    ]);
    fs.writeFileSync(`${dir}/babel-stdout.txt`, babelOutputBuffer.stdout.toString());
    if (babelOutputBuffer.stderr) {
      fs.writeFileSync(`${dir}/babel-stderr.txt`, babelOutputBuffer.stderr.toString());
    }

    // browserify

    // Transform any require statements (like for core-js) into a big bundle.
    await runCommand('yarn', [
      'browserify',
      `${dir}/main.transpiled.js`,
      '-o', `${dir}/main.bundle.browserify.js`,
      '--debug', // source maps
      '--full-paths=false',
    ]);

    // Minify.
    await runCommand('yarn', [
      'terser',
      `${dir}/main.bundle.browserify.js`,
      '-o', `${dir}/main.bundle.browserify.min.js`,
      '--source-map', 'content="inline",url="main.bundle.browserify.min.js.map"',
    ]);

    // esbuild
    await runCommand('yarn', [
      'esbuild',
      `${dir}/main.transpiled.js`,
      `--outfile=${dir}/main.bundle.esbuild.js`,
      '--bundle',
      '--sourcemap',
    ]);
    await runCommand('yarn', [
      'esbuild',
      `${dir}/main.transpiled.js`,
      `--outfile=${dir}/main.bundle.esbuild.min.js`,
      '--bundle',
      '--sourcemap',
      '--minify',
    ]);

    // rollup
    await runCommand('yarn', [
      'rollup',
      `${dir}/main.transpiled.js`,
      '--file',
      `${dir}/main.bundle.rollup.js`,
      '--format',
      'iife',
      '--plugin', '@rollup/plugin-commonjs',
      '--sourcemap',
    ]);
    await runCommand('yarn', [
      'rollup',
      `${dir}/main.transpiled.js`,
      '--file',
      `${dir}/main.bundle.rollup.min.js`,
      '--format',
      'iife',
      '--plugin', '@rollup/plugin-commonjs',
      '--plugin', '@rollup/plugin-terser',
      '--sourcemap',
      '--minify',
    ]);
  }

  if (STAGE === 'audit' || STAGE === 'all') {
    const legacyJavascriptWithMapResults = [];
    const legacyJavascriptWithoutMapResults = [];

    const bundles = [
      'main.bundle.browserify.js',
      'main.bundle.browserify.min.js',
      'main.bundle.esbuild.js',
      'main.bundle.esbuild.min.js',
      // This could be detected, but it too greatly hurts performance.
      // See: https://github.com/GoogleChrome/lighthouse/pull/16394
      // 'main.bundle.rollup.js',
      'main.bundle.rollup.min.js',
    ];
    for (const bundle of bundles) {
      const code = fs.readFileSync(`${dir}/${bundle}`, 'utf-8');

      if (fs.existsSync(`${dir}/${bundle}.map`)) {
        const map = JSON.parse(fs.readFileSync(`${dir}/${bundle}.map`, 'utf-8'));
        legacyJavascriptWithMapResults.push({
          bundle,
          result: detectLegacyJavaScript(code, new SDK.SourceMap('', '', map)),
        });
      }

      legacyJavascriptWithoutMapResults.push({
        bundle,
        result: detectLegacyJavaScript(code, null),
      });
    }

    fs.writeFileSync(`${dir}/legacy-javascript.json`,
      JSON.stringify(legacyJavascriptWithMapResults, null, 2));
    fs.writeFileSync(`${dir}/legacy-javascript-nomaps.json`,
      JSON.stringify(legacyJavascriptWithoutMapResults, null, 2));
  }
}

/**
@param {string} legacyJavascriptFilename