File tree Expand file tree Collapse file tree 4 files changed +29
-29
lines changed Expand file tree Collapse file tree 4 files changed +29
-29
lines changed Original file line number Diff line number Diff line change 1
1
import { terser } from 'rollup-plugin-terser' ;
2
2
import typescript from 'rollup-plugin-typescript2' ;
3
- import license from 'rollup-plugin-license' ;
4
3
import resolve from '@rollup/plugin-node-resolve' ;
5
4
import replace from '@rollup/plugin-replace' ;
6
5
7
- const commitHash = require ( 'child_process' ) . execSync ( 'git rev-parse --short HEAD' , { encoding : 'utf-8' } ) . trim ( ) ;
6
+ import { makeLicensePlugin } from '../../rollup.config' ;
7
+
8
+ const licensePlugin = makeLicensePlugin ( ) ;
8
9
9
10
const terserInstance = terser ( {
10
11
compress : {
@@ -81,13 +82,7 @@ const bundleConfig = {
81
82
esModule : false ,
82
83
} ,
83
84
context : 'window' ,
84
- plugins : [
85
- ...plugins ,
86
- license ( {
87
- sourcemap : true ,
88
- banner : `/*! @sentry/browser <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/sentry-javascript */` ,
89
- } ) ,
90
- ] ,
85
+ plugins : [ ...plugins , licensePlugin ] ,
91
86
treeshake : 'smallest' ,
92
87
} ;
93
88
Original file line number Diff line number Diff line change 1
1
import typescript from 'rollup-plugin-typescript2' ;
2
- import license from 'rollup-plugin-license' ;
3
2
import resolve from '@rollup/plugin-node-resolve' ;
4
3
import replace from '@rollup/plugin-replace' ;
5
4
6
- import { terserPlugin } from '../../rollup.config' ;
5
+ import { makeLicensePlugin , terserPlugin } from '../../rollup.config' ;
7
6
8
- const commitHash = require ( 'child_process' ) . execSync ( 'git rev-parse --short HEAD' , { encoding : 'utf-8' } ) . trim ( ) ;
7
+ const licensePlugin = makeLicensePlugin ( '@sentry/tracing & @sentry/browser' ) ;
9
8
10
9
const paths = {
11
10
'@sentry/utils' : [ '../utils/src' ] ,
@@ -54,13 +53,7 @@ const bundleConfig = {
54
53
esModule : false ,
55
54
} ,
56
55
context : 'window' ,
57
- plugins : [
58
- ...plugins ,
59
- license ( {
60
- sourcemap : true ,
61
- banner : `/*! @sentry/tracing & @sentry/browser <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/sentry-javascript */` ,
62
- } ) ,
63
- ] ,
56
+ plugins : [ ...plugins , licensePlugin ] ,
64
57
treeshake : 'smallest' ,
65
58
} ;
66
59
Original file line number Diff line number Diff line change 1
1
import typescript from 'rollup-plugin-typescript2' ;
2
- import license from 'rollup-plugin-license' ;
3
2
import resolve from '@rollup/plugin-node-resolve' ;
4
3
import replace from '@rollup/plugin-replace' ;
5
4
6
- import { terserPlugin } from '../../rollup.config' ;
5
+ import { makeLicensePlugin , terserPlugin } from '../../rollup.config' ;
7
6
8
- const commitHash = require ( 'child_process' ) . execSync ( 'git rev-parse --short HEAD' , { encoding : 'utf-8' } ) . trim ( ) ;
7
+ const licensePlugin = makeLicensePlugin ( ) ;
9
8
10
9
const paths = {
11
10
'@sentry/utils' : [ '../utils/src' ] ,
@@ -54,13 +53,7 @@ const bundleConfig = {
54
53
esModule : false ,
55
54
} ,
56
55
context : 'window' ,
57
- plugins : [
58
- ...plugins ,
59
- license ( {
60
- sourcemap : true ,
61
- banner : `/*! @sentry/vue <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/sentry-javascript */` ,
62
- } ) ,
63
- ] ,
56
+ plugins : [ ...plugins , licensePlugin ] ,
64
57
treeshake : 'smallest' ,
65
58
} ;
66
59
Original file line number Diff line number Diff line change 2
2
* Shared config used by individual packages' Rollup configs
3
3
*/
4
4
5
+ import license from 'rollup-plugin-license' ;
5
6
import { terser } from 'rollup-plugin-terser' ;
6
7
8
+
9
+ /**
10
+ * Create a plugin to add an identification banner to the top of stand-alone bundles.
11
+ *
12
+ * @param title The title to use for the SDK, if not the package name
13
+ * @returns An instance of the `rollup-plugin-license` plugin
14
+ */
15
+ export function makeLicensePlugin ( title ) {
16
+ const commitHash = require ( 'child_process' ) . execSync ( 'git rev-parse --short HEAD' , { encoding : 'utf-8' } ) . trim ( ) ;
17
+
18
+ return license ( {
19
+ banner : {
20
+ content : `/*! <%= data.title || pkg.name %> <%= pkg.version %> (${ commitHash } ) | https://github.com/getsentry/sentry-javascript */` ,
21
+ data : { title } ,
22
+ } ,
23
+ } ) ;
24
+ }
25
+
7
26
export const terserPlugin = terser ( {
8
27
mangle : {
9
28
// captureExceptions and captureMessage are public API methods and they don't need to be listed here
You can’t perform that action at this time.
0 commit comments