Skip to content

Commit 1adc383

Browse files
committed
use minification variant function in individual packages
1 parent c51ce58 commit 1adc383

File tree

5 files changed

+27
-127
lines changed

5 files changed

+27
-127
lines changed

packages/browser/rollup.config.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config';
22

33
const builds = [];
44

@@ -11,26 +11,7 @@ const builds = [];
1111
outputFileBase: `build/bundle${jsVersion === 'es6' ? '.es6' : ''}`,
1212
});
1313

14-
builds.push(
15-
...[
16-
{
17-
...baseBundleConfig,
18-
output: {
19-
...baseBundleConfig.output,
20-
file: `${baseBundleConfig.output.file}.js`,
21-
},
22-
plugins: [...baseBundleConfig.plugins],
23-
},
24-
{
25-
...baseBundleConfig,
26-
output: {
27-
...baseBundleConfig.output,
28-
file: `${baseBundleConfig.output.file}.min.js`,
29-
},
30-
plugins: [...baseBundleConfig.plugins, terserPlugin],
31-
},
32-
],
33-
);
14+
builds.push(...makeMinificationVariants(baseBundleConfig));
3415
});
3516

3617
export default builds;

packages/integrations/rollup.config.js

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,25 @@ import * as fs from 'fs';
22

33
import commonjs from '@rollup/plugin-commonjs';
44

5-
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
6-
7-
function allIntegrations() {
8-
return fs.readdirSync('./src').filter(file => file != 'index.ts');
9-
}
10-
11-
function loadAllIntegrations() {
12-
const builds = [];
13-
14-
allIntegrations().forEach(file => {
15-
const baseBundleConfig = makeBaseBundleConfig({
16-
input: `src/${file}`,
17-
isAddOn: true,
18-
jsVersion: 'es5',
19-
licenseTitle: '@sentry/integrations',
20-
outputFileBase: `build/${file.replace('.ts', '')}`,
21-
});
22-
23-
[
24-
{
25-
extension: '.js',
26-
plugins: [...baseBundleConfig.plugins, commonjs()],
27-
},
28-
{
29-
extension: '.min.js',
30-
plugins: [...baseBundleConfig.plugins, commonjs(), terserPlugin],
31-
},
32-
].forEach(build => {
33-
builds.push({
34-
...baseBundleConfig,
35-
output: {
36-
...baseBundleConfig.output,
37-
file: `${baseBundleConfig.output.file}${build.extension}`,
38-
},
39-
plugins: build.plugins,
40-
});
41-
});
5+
import { insertAt, makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config';
6+
7+
const builds = [];
8+
9+
const integrationSourceFiles = fs.readdirSync('./src').filter(file => file != 'index.ts');
10+
11+
integrationSourceFiles.forEach(file => {
12+
const baseBundleConfig = makeBaseBundleConfig({
13+
input: `src/${file}`,
14+
isAddOn: true,
15+
jsVersion: 'es5',
16+
licenseTitle: '@sentry/integrations',
17+
outputFileBase: `build/${file.replace('.ts', '')}`,
4218
});
4319

44-
return builds;
45-
}
20+
// TODO We only need `commonjs` for localforage (used in the offline plugin). Once that's fixed, this can come out.
21+
baseBundleConfig.plugins = insertAt(baseBundleConfig.plugins, -2, commonjs());
22+
23+
builds.push(...makeMinificationVariants(baseBundleConfig));
24+
});
4625

47-
export default loadAllIntegrations();
26+
export default builds;

packages/tracing/rollup.config.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config';
22

33
const builds = [];
44

@@ -11,26 +11,7 @@ const builds = [];
1111
outputFileBase: `build/bundle.tracing${jsVersion === 'es6' ? '.es6' : ''}`,
1212
});
1313

14-
builds.push(
15-
...[
16-
{
17-
...baseBundleConfig,
18-
output: {
19-
...baseBundleConfig.output,
20-
file: `${baseBundleConfig.output.file}.js`,
21-
},
22-
plugins: baseBundleConfig.plugins,
23-
},
24-
{
25-
...baseBundleConfig,
26-
output: {
27-
...baseBundleConfig.output,
28-
file: `${baseBundleConfig.output.file}.min.js`,
29-
},
30-
plugins: [...baseBundleConfig.plugins, terserPlugin],
31-
},
32-
],
33-
);
14+
builds.push(...makeMinificationVariants(baseBundleConfig));
3415
});
3516

3617
export default builds;

packages/vue/rollup.config.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config';
22

33
const baseBundleConfig = makeBaseBundleConfig({
44
input: 'src/index.bundle.ts',
@@ -8,21 +8,4 @@ const baseBundleConfig = makeBaseBundleConfig({
88
outputFileBase: 'build/bundle.vue',
99
});
1010

11-
export default [
12-
{
13-
...baseBundleConfig,
14-
output: {
15-
...baseBundleConfig.output,
16-
file: `${baseBundleConfig.output.file}.js`,
17-
},
18-
plugins: baseBundleConfig.plugins,
19-
},
20-
{
21-
...baseBundleConfig,
22-
output: {
23-
...baseBundleConfig.output,
24-
file: `${baseBundleConfig.output.file}.min.js`,
25-
},
26-
plugins: [...baseBundleConfig.plugins, terserPlugin],
27-
},
28-
];
11+
export default makeMinificationVariants(baseBundleConfig);

packages/wasm/rollup.config.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeMinificationVariants } from '../../rollup.config';
22

33
const baseBundleConfig = makeBaseBundleConfig({
44
input: 'src/index.ts',
@@ -8,28 +8,4 @@ const baseBundleConfig = makeBaseBundleConfig({
88
outputFileBase: 'build/wasm',
99
});
1010

11-
function loadAllIntegrations() {
12-
const builds = [];
13-
[
14-
{
15-
extension: '.js',
16-
plugins: baseBundleConfig.plugins,
17-
},
18-
{
19-
extension: '.min.js',
20-
plugins: [...baseBundleConfig.plugins, terserPlugin],
21-
},
22-
].forEach(build => {
23-
builds.push({
24-
...baseBundleConfig,
25-
output: {
26-
...baseBundleConfig.output,
27-
file: `${baseBundleConfig.output.file}${build.extension}`,
28-
},
29-
plugins: build.plugins,
30-
});
31-
});
32-
return builds;
33-
}
34-
35-
export default loadAllIntegrations();
11+
export default makeMinificationVariants(baseBundleConfig);

0 commit comments

Comments
 (0)