Skip to content

Commit fe845d9

Browse files
committed
ref(build): Split up rollup config code (#4950)
As part of the new build process, a fair amount of new rollup-related code is going to be added. To keep things from getting too unwieldy, this splits the existing code up into modules. It also makes two other small changes, one for consistency and one to differentiate the current rollup code (which is for building bundles) from the future rollup code (which will be for building npm packages): - All plugins are now generated through factory functions (`makeXXXPlugin`). - Both the `makeConfigVariants` function and the individual `rollup.config.js` files have been renamed to make it clear they're for creating bundles. For now all of the resulting modules live in a `rollup` folder at the top level of the repo. In the long run, these would be good candidates to go into an `@sentry-internal/dev-utils` package.
1 parent 0d811bd commit fe845d9

17 files changed

+326
-286
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = {
4242
},
4343
},
4444
{
45-
files: ['scenarios/**'],
45+
files: ['scenarios/**', 'rollup/**'],
4646
parserOptions: {
4747
sourceType: 'module',
4848
},

packages/browser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"scripts": {
4646
"build": "run-p build:cjs build:esm build:bundle build:types",
47-
"build:bundle": "rollup --config",
47+
"build:bundle": "rollup --config rollup.bundle.config.js",
4848
"build:cjs": "tsc -p tsconfig.cjs.json",
4949
"build:dev": "run-p build:cjs build:esm build:types",
5050
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",

packages/browser/rollup.config.js renamed to packages/browser/rollup.bundle.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, makeConfigVariants } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
22

33
const builds = [];
44

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

14-
builds.push(...makeConfigVariants(baseBundleConfig));
14+
builds.push(...makeBundleConfigVariants(baseBundleConfig));
1515
});
1616

1717
export default builds;

packages/integrations/rollup.config.js renamed to packages/integrations/rollup.bundle.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import commonjs from '@rollup/plugin-commonjs';
22

3-
import { insertAt, makeBaseBundleConfig, makeConfigVariants } from '../../rollup.config';
3+
import { insertAt, makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
44

55
const builds = [];
66

@@ -19,6 +19,6 @@ const baseBundleConfig = makeBaseBundleConfig({
1919
baseBundleConfig.plugins = insertAt(baseBundleConfig.plugins, -2, commonjs());
2020

2121
// this makes non-minified, minified, and minified-with-debug-logging versions of each bundle
22-
builds.push(...makeConfigVariants(baseBundleConfig));
22+
builds.push(...makeBundleConfigVariants(baseBundleConfig));
2323

2424
export default builds;

packages/integrations/scripts/buildBundles.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ for filepath in ./src/*; do
1111
fi
1212

1313
# run the build for each integration
14-
INTEGRATION_FILE=$file JS_VERSION=$js_version yarn --silent rollup -c rollup.config.js
14+
INTEGRATION_FILE=$file JS_VERSION=$js_version yarn --silent rollup --config rollup.bundle.config.js
1515

1616
done
1717
done

packages/tracing/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"scripts": {
3030
"build": "run-p build:cjs build:esm build:types build:bundle && ts-node ../../scripts/prepack.ts --bundles #necessary for integration tests",
31-
"build:bundle": "rollup --config",
31+
"build:bundle": "rollup --config rollup.bundle.config.js",
3232
"build:cjs": "tsc -p tsconfig.cjs.json",
3333
"build:dev": "run-p build:cjs build:esm build:types",
3434
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",

packages/tracing/rollup.config.js renamed to packages/tracing/rollup.bundle.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, makeConfigVariants } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
22

33
const builds = [];
44

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

14-
builds.push(...makeConfigVariants(baseBundleConfig));
14+
builds.push(...makeBundleConfigVariants(baseBundleConfig));
1515
});
1616

1717
export default builds;

packages/vue/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"scripts": {
3030
"build": "run-p build:cjs build:esm build:types",
31-
"build:bundle": "rollup --config",
31+
"build:bundle": "rollup --config rollup.bundle.config.js",
3232
"build:cjs": "tsc -p tsconfig.cjs.json",
3333
"build:dev": "run-p build:cjs build:esm build:types",
3434
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, makeConfigVariants } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
22

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

11-
export default makeConfigVariants(baseBundleConfig);
11+
export default makeBundleConfigVariants(baseBundleConfig);

packages/wasm/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"scripts": {
3232
"build": "run-p build:cjs build:esm build:bundle build:types",
33-
"build:bundle": "rollup --config",
33+
"build:bundle": "rollup --config rollup.bundle.config.js",
3434
"build:cjs": "tsc -p tsconfig.cjs.json",
3535
"build:dev": "run-p build:cjs build:esm build:types",
3636
"build:es5": "yarn build:cjs # *** backwards compatibility - remove in v7 ***",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, makeConfigVariants } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeBundleConfigVariants } from '../../rollup/index.js';
22

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

11-
export default makeConfigVariants(baseBundleConfig);
11+
export default makeBundleConfigVariants(baseBundleConfig);

rollup.config.js

-270
This file was deleted.

0 commit comments

Comments
 (0)