Skip to content

Commit

Permalink
simplify benchmark build configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Mar 22, 2019
1 parent 18d6662 commit 668e5a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
23 changes: 9 additions & 14 deletions bench/styles/rollup_config_benchmarks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import sourcemaps from 'rollup-plugin-sourcemaps';
import replace from 'rollup-plugin-replace';
import {plugins as basePlugins} from '../../build/rollup_plugins';
import {plugins} from '../../build/rollup_plugins';

let styles = ['mapbox://styles/mapbox/streets-v10'];

Expand All @@ -11,17 +11,14 @@ if (process.env.MAPBOX_STYLES) {
.map(style => style.match(/\.json$/) ? require(style) : style);
}

const plugins = () => basePlugins(true, true).concat(
replace({
'process.env.BENCHMARK_VERSION': JSON.stringify(process.env.BENCHMARK_VERSION),
'process.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN),
'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken),
'process.env.MAPBOX_STYLES': JSON.stringify(styles),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
);
const replaceConfig = {
'process.env.BENCHMARK_VERSION': JSON.stringify(process.env.BENCHMARK_VERSION),
'process.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN),
'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken),
'process.env.MAPBOX_STYLES': JSON.stringify(styles)
};

const config = [{
export default [{
input: [`bench/styles/benchmarks.js`, 'src/source/worker.js'],
output: {
dir: 'rollup/build/benchmarks/styles',
Expand All @@ -30,7 +27,7 @@ const config = [{
sourcemap: 'inline',
chunkFileNames: 'shared.js'
},
plugins: plugins()
plugins: plugins(true, true).concat(replace(replaceConfig))
}, {
input: 'rollup/style_benchmarks.js',
output: {
Expand All @@ -43,5 +40,3 @@ const config = [{
treeshake: false,
plugins: [sourcemaps()],
}];

export default config;
21 changes: 8 additions & 13 deletions bench/versions/rollup_config_benchmarks.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import fs from 'fs';
import sourcemaps from 'rollup-plugin-sourcemaps';
import replace from 'rollup-plugin-replace';
import {plugins as basePlugins} from '../../build/rollup_plugins';
import {plugins} from '../../build/rollup_plugins';

const plugins = () => basePlugins(true, true).concat(
replace({
'process.env.BENCHMARK_VERSION': JSON.stringify(process.env.BENCHMARK_VERSION),
'process.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN),
'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
);
const replaceConfig = {
'process.env.BENCHMARK_VERSION': JSON.stringify(process.env.BENCHMARK_VERSION),
'process.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN),
'process.env.MapboxAccessToken': JSON.stringify(process.env.MapboxAccessToken)
};

const config = [{
export default [{
input: [`bench/versions/benchmarks.js`, 'src/source/worker.js'],
output: {
dir: 'rollup/build/benchmarks/versions',
Expand All @@ -21,7 +18,7 @@ const config = [{
sourcemap: 'inline',
chunkFileNames: 'shared.js'
},
plugins: plugins()
plugins: plugins(true, true).concat(replace(replaceConfig))
}, {
input: 'rollup/benchmarks.js',
output: {
Expand All @@ -34,5 +31,3 @@ const config = [{
treeshake: false,
plugins: [sourcemaps()],
}];

export default config;

0 comments on commit 668e5a1

Please sign in to comment.