How to use the @bundle-stats/utils.createStatsSummary function in @bundle-stats/utils

To help you get started, we’ve selected a few @bundle-stats/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github relative-ci / bundle-stats / packages / ui / src / components / bundle-modules / bundle-modules.stories.jsx View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { createStats, createStatsSummary } from '@bundle-stats/utils';

import currentData from '../../../__mocks__/job.current.json';
import baselineData from '../../../__mocks__/job.baseline.json';
import { getWrapperDecorator } from '../../stories';
import { BundleModules } from './bundle-modules';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const stories = storiesOf('Components/BundleModules', module);
stories.addDecorator(getWrapperDecorator());

stories.add('default', () => (
  
));

stories.add('multiple runs', () => (
github relative-ci / bundle-stats / packages / html-templates / src / app / index.jsx View on Github external
const getSummaryData = (jobs) => {
  if (jobs.length <= 2) {
    return jobs[0].summary;
  }

  return createStatsSummary(jobs[jobs.length - 1].stats, jobs[0].stats);
};
github relative-ci / bundle-stats / packages / ui / src / components / bundle-assets-totals-chart-pie / bundle-assets-totals-chart-pie.stories.jsx View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { createStats, createStatsSummary } from '@bundle-stats/utils';

import currentData from '../../../__mocks__/job.current.json';
import baselineData from '../../../__mocks__/job.baseline.json';
import { getWrapperDecorator } from '../../stories';
import { BundleAssetsTotalsChartPie as Component } from './bundle-assets-totals-chart-pie';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const jobs = [currentJob, baselineJob];

const stories = storiesOf('Components/BundleAssetsTotalsChartPie', module);
stories.addDecorator(getWrapperDecorator());

stories.add('component', () => (
  
));
github relative-ci / bundle-stats / packages / ui / src / components / browsertime-table / browsertime-table.stories.jsx View on Github external
import { getWrapperDecorator } from '../../stories';
import { BrowsertimeTable } from '.';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const stories = storiesOf('Components/BrowsertimeTable', module);
stories.addDecorator(getWrapperDecorator());

stories.add('default', () => (
github relative-ci / bundle-stats / packages / web-compare / src / pages / webpack / index.jsx View on Github external
const getSummaryData = (jobs) => {
  if (jobs.length <= 2) {
    return jobs[0].summary;
  }

  return createStatsSummary(last(jobs).stats, jobs[0].stats);
};
github relative-ci / bundle-stats / packages / ui / src / components / bundle-assets-totals-chart-bars / bundle-assets-totals-chart-bars.stories.jsx View on Github external
import { getWrapperDecorator } from '../../stories';
import { BundleAssetsTotalsChartBars as Component } from './bundle-assets-totals-chart-bars';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const jobs = [currentJob, baselineJob];

const stories = storiesOf('Components/BundleAssetsTotalsChartBars', module);

stories.addDecorator(getWrapperDecorator());

stories.add('component', () => (
  
));
github relative-ci / bundle-stats / packages / ui / src / components / browsertime-table / browsertime-table.stories.jsx View on Github external
import { storiesOf } from '@storybook/react';
import { createStats, createStatsSummary } from '@bundle-stats/utils';

import browsertime from '../../../../../fixtures/browsertime.json';
import currentData from '../../../__mocks__/job.current.json';
import baselineData from '../../../__mocks__/job.baseline.json';
import { getWrapperDecorator } from '../../stories';
import { BrowsertimeTable } from '.';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const stories = storiesOf('Components/BrowsertimeTable', module);
stories.addDecorator(getWrapperDecorator());

stories.add('default', () => (
github relative-ci / bundle-stats / packages / ui / src / components / bundle-modules / bundle-modules.stories.jsx View on Github external
import { getWrapperDecorator } from '../../stories';
import { BundleModules } from './bundle-modules';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const stories = storiesOf('Components/BundleModules', module);
stories.addDecorator(getWrapperDecorator());

stories.add('default', () => (
  
));

stories.add('multiple runs', () => (
  
));

stories.add('empty baseline', () => (
  
));
github relative-ci / bundle-stats / packages / ui / src / components / bundle-assets-totals-chart-pie / bundle-assets-totals-chart-pie.stories.jsx View on Github external
import { getWrapperDecorator } from '../../stories';
import { BundleAssetsTotalsChartPie as Component } from './bundle-assets-totals-chart-pie';

const currentStats = createStats(baselineData.rawData, currentData.rawData);
const baselineStats = createStats(null, baselineData.rawData);

const currentJob = {
  ...currentData,
  stats: currentStats,
  summary: createStatsSummary(baselineStats, currentStats),
};

const baselineJob = {
  ...baselineData,
  stats: baselineStats,
  summary: createStatsSummary(null, baselineStats),
};

const jobs = [currentJob, baselineJob];

const stories = storiesOf('Components/BundleAssetsTotalsChartPie', module);
stories.addDecorator(getWrapperDecorator());

stories.add('component', () => (
  
));
github relative-ci / bundle-stats / packages / web-compare / src / pages / webpack / container.js View on Github external
})).reduce((agg, job) => {
    const baseline = last(agg);
    const stats = createStats(baseline && baseline.rawData, job.rawData);
    const summary = createStatsSummary(baseline && baseline.stats, stats);

    return [
      ...agg,
      {
        ...job,
        stats,
        summary,
      },
    ];
  }, []);