Skip to content

Commit c0afacb

Browse files
committed
move license plugin to main rollup config
1 parent 4ce0da4 commit c0afacb

File tree

6 files changed

+25
-19
lines changed

6 files changed

+25
-19
lines changed

packages/browser/rollup.config.js

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

33
const builds = [];
44

5-
const licensePlugin = makeLicensePlugin();
6-
75
['es5', 'es6'].forEach(jsVersion => {
86
const baseBundleConfig = makeBaseBundleConfig({
97
input: 'src/index.ts',
108
isAddOn: false,
119
jsVersion,
10+
licenseTitle: '@sentry/browser',
1211
outputFileBase: `build/bundle${jsVersion === 'es6' ? '.es6' : ''}`,
1312
});
1413

@@ -20,15 +19,15 @@ const licensePlugin = makeLicensePlugin();
2019
...baseBundleConfig.output,
2120
file: `${baseBundleConfig.output.file}.js`,
2221
},
23-
plugins: [...baseBundleConfig.plugins, licensePlugin],
22+
plugins: [...baseBundleConfig.plugins],
2423
},
2524
{
2625
...baseBundleConfig,
2726
output: {
2827
...baseBundleConfig.output,
2928
file: `${baseBundleConfig.output.file}.min.js`,
3029
},
31-
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
30+
plugins: [...baseBundleConfig.plugins, terserPlugin],
3231
},
3332
],
3433
);

packages/integrations/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function loadAllIntegrations() {
1616
input: `src/${file}`,
1717
isAddOn: true,
1818
jsVersion: 'es5',
19+
licenseTitle: '@sentry/integrations',
1920
outputFileBase: `build/${file.replace('.ts', '')}`,
2021
});
2122

packages/tracing/rollup.config.js

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

33
const builds = [];
44

5-
const licensePlugin = makeLicensePlugin('@sentry/tracing & @sentry/browser');
6-
75
['es5', 'es6'].forEach(jsVersion => {
86
const baseBundleConfig = makeBaseBundleConfig({
97
input: 'src/index.bundle.ts',
108
isAddOn: false,
119
jsVersion,
10+
licenseTitle: '@sentry/tracing & @sentry/browser',
1211
outputFileBase: `build/bundle.tracing${jsVersion === 'es6' ? '.es6' : ''}`,
1312
});
1413

@@ -20,15 +19,15 @@ const licensePlugin = makeLicensePlugin('@sentry/tracing & @sentry/browser');
2019
...baseBundleConfig.output,
2120
file: `${baseBundleConfig.output.file}.js`,
2221
},
23-
plugins: [...baseBundleConfig.plugins, licensePlugin],
22+
plugins: baseBundleConfig.plugins,
2423
},
2524
{
2625
...baseBundleConfig,
2726
output: {
2827
...baseBundleConfig.output,
2928
file: `${baseBundleConfig.output.file}.min.js`,
3029
},
31-
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
30+
plugins: [...baseBundleConfig.plugins, terserPlugin],
3231
},
3332
],
3433
);

packages/vue/rollup.config.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config';
2-
3-
const licensePlugin = makeLicensePlugin();
1+
import { makeBaseBundleConfig, terserPlugin } from '../../rollup.config';
42

53
const baseBundleConfig = makeBaseBundleConfig({
64
input: 'src/index.bundle.ts',
75
isAddOn: false,
86
jsVersion: 'es5',
7+
licenseTitle: '@sentry/vue',
98
outputFileBase: 'build/bundle.vue',
109
});
1110

@@ -16,14 +15,14 @@ export default [
1615
...baseBundleConfig.output,
1716
file: `${baseBundleConfig.output.file}.js`,
1817
},
19-
plugins: [...baseBundleConfig.plugins, licensePlugin],
18+
plugins: baseBundleConfig.plugins,
2019
},
2120
{
2221
...baseBundleConfig,
2322
output: {
2423
...baseBundleConfig.output,
2524
file: `${baseBundleConfig.output.file}.min.js`,
2625
},
27-
plugins: [...baseBundleConfig.plugins, terserPlugin, licensePlugin],
26+
plugins: [...baseBundleConfig.plugins, terserPlugin],
2827
},
2928
];

packages/wasm/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const baseBundleConfig = makeBaseBundleConfig({
44
input: 'src/index.ts',
55
isAddOn: true,
66
jsVersion: 'es5',
7+
licenseTitle: '@sentry/wasm',
78
outputFileBase: 'build/wasm',
89
});
910

rollup.config.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import typescript from 'rollup-plugin-typescript2';
2121
* @param title The title to use for the SDK, if not the package name
2222
* @returns An instance of the `rollup-plugin-license` plugin
2323
*/
24-
export function makeLicensePlugin(title) {
24+
function makeLicensePlugin(title) {
2525
const commitHash = require('child_process').execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim();
2626

2727
return license({
2828
banner: {
29-
content: `/*! <%= data.title || pkg.name %> <%= pkg.version %> (${commitHash}) | https://github.com/getsentry/sentry-javascript */`,
29+
content: `/*! <%= data.title %> <%= pkg.version %> (${commitHash}) | https://github.com/getsentry/sentry-javascript */`,
3030
data: { title },
3131
},
3232
});
@@ -56,7 +56,7 @@ export const terserPlugin = terser({
5656
});
5757

5858
export function makeBaseBundleConfig(options) {
59-
const { input, isAddOn, jsVersion, outputFileBase } = options;
59+
const { input, isAddOn, jsVersion, licenseTitle, outputFileBase } = options;
6060

6161
const baseTSPluginOptions = {
6262
tsconfig: 'tsconfig.esm.json',
@@ -111,6 +111,8 @@ export function makeBaseBundleConfig(options) {
111111
},
112112
});
113113

114+
const licensePlugin = makeLicensePlugin(licenseTitle);
115+
114116
const standAloneBundleConfig = {
115117
output: {
116118
format: 'iife',
@@ -159,7 +161,12 @@ export function makeBaseBundleConfig(options) {
159161
strict: false,
160162
esModule: false,
161163
},
162-
plugins: [jsVersion === 'es5' ? typescriptPluginES5 : typescriptPluginES6, markAsBrowserBuild, nodeResolvePlugin],
164+
plugins: [
165+
jsVersion === 'es5' ? typescriptPluginES5 : typescriptPluginES6,
166+
markAsBrowserBuild,
167+
nodeResolvePlugin,
168+
licensePlugin,
169+
],
163170
treeshake: 'smallest',
164171
};
165172

0 commit comments

Comments
 (0)