How to use the @bundle-stats/utils.createStats 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-assets-totals-chart-bars / bundle-assets-totals-chart-bars.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 { 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);
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];
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,
      },
    ];
  }, []);
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());
github relative-ci / bundle-stats / packages / ui / src / components / summary / summary.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 { Summary } from '.';

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

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

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

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

stories.add('loading', () =&gt; (</summary>
github relative-ci / bundle-stats / packages / ui / src / components / browsertime-table / browsertime-table.stories.jsx View on Github external
import React from 'react';
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());
github relative-ci / bundle-stats / packages / ui / src / components / browsertime-table / browsertime-table.stories.jsx View on Github external
import React from 'react';
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());
github relative-ci / bundle-stats / packages / ui / src / components / bundle-assets-totals-table / bundle-assets-totals-table.stories.jsx View on Github external
import React from 'react';
import { storiesOf } from '@storybook/react';
import { createStats } from '@bundle-stats/utils';

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

const currentJob = {
  ...currentData,
  stats: createStats(baselineData.rawData, currentData.rawData),
};

const baselineJob = {
  ...baselineData,
  stats: createStats(null, baselineData.rawData),
};

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

stories.add('default', () =&gt; (
  
));

stories.add('multiple jobs', () =&gt; (
github relative-ci / bundle-stats / packages / ui / src / components / bundle-assets-totals-table / bundle-assets-totals-table.stories.jsx View on Github external
import { storiesOf } from '@storybook/react';
import { createStats } from '@bundle-stats/utils';

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

const currentJob = {
  ...currentData,
  stats: createStats(baselineData.rawData, currentData.rawData),
};

const baselineJob = {
  ...baselineData,
  stats: createStats(null, baselineData.rawData),
};

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

stories.add('default', () =&gt; (
  
));

stories.add('multiple jobs', () =&gt; (
  
));

stories.add('empty baseline', () =&gt; (
  
));
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());