Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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', () => (
const getSummaryData = (jobs) => {
if (jobs.length <= 2) {
return jobs[0].summary;
}
return createStatsSummary(jobs[jobs.length - 1].stats, jobs[0].stats);
};
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', () => (
));
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', () => (
const getSummaryData = (jobs) => {
if (jobs.length <= 2) {
return jobs[0].summary;
}
return createStatsSummary(last(jobs).stats, jobs[0].stats);
};
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', () => (
));
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', () => (
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', () => (
));
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', () => (
));
})).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,
},
];
}, []);