Skip to content

Commit af7f71e

Browse files
author
Paul Boocock
committed
Add license banner to rollup builds (close #845)
1 parent e5ee7a9 commit af7f71e

File tree

5 files changed

+52
-8
lines changed

5 files changed

+52
-8
lines changed

gulpfile.babel.js/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import compiler from '@ampproject/rollup-plugin-closure-compiler';
33
import cleanup from 'rollup-plugin-cleanup';
44
import sizes from 'rollup-plugin-sizes';
55
import filesize from 'rollup-plugin-filesize';
6-
import { rollupPlugins } from './rollup';
6+
import { basePlugins, spBannerPlugin } from './rollup';
77

88
const minify = [
99
compiler(),
@@ -18,7 +18,7 @@ const report = [
1818
export const buildSp = async function () {
1919
const snowplow = await rollup({
2020
input: 'src/js/init.js',
21-
plugins: [...rollupPlugins, ...minify, ...report],
21+
plugins: [...basePlugins, ...minify, spBannerPlugin, ...report],
2222
});
2323

2424
return await snowplow.write({

gulpfile.babel.js/rollup.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { nodeResolve } from '@rollup/plugin-node-resolve';
22
import commonjs from '@rollup/plugin-commonjs';
33
import { babel } from '@rollup/plugin-babel';
4+
import banner from 'rollup-plugin-banner'
45

5-
export const rollupPlugins = [
6+
export const basePlugins = [
67
nodeResolve({
78
browser: true,
89
}),
@@ -26,3 +27,12 @@ export const rollupPlugins = [
2627
]
2728
})
2829
];
30+
31+
const licenseBanner =
32+
"@description <%= pkg.description %>\n" +
33+
"@version <%= pkg.version %>\n" +
34+
"@copyright Anthon Pang, Snowplow Analytics Ltd\n" +
35+
"@license <%= pkg.license %>\n\n" +
36+
"Documentation: http://bit.ly/sp-js";
37+
38+
export const spBannerPlugin = banner(licenseBanner);

gulpfile.babel.js/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { rollup } from 'rollup';
2-
import { rollupPlugins } from './rollup';
2+
import { basePlugins } from './rollup';
33
import Docker from 'dockerode';
44

55
export const buildTestDetectors = async function () {
66
const detectors = await rollup({
77
input: 'tests/scripts/detectors.js',
8-
plugins: rollupPlugins,
8+
plugins: basePlugins,
99
});
1010
return await detectors.write({
1111
name: 'detectors',
@@ -17,7 +17,7 @@ export const buildTestDetectors = async function () {
1717
export const buildTestHelpers = async function () {
1818
const helpers = await rollup({
1919
input: 'tests/scripts/helpers.js',
20-
plugins: rollupPlugins,
20+
plugins: basePlugins,
2121
});
2222
return await helpers.write({
2323
name: 'helpers',
@@ -29,7 +29,7 @@ export const buildTestHelpers = async function () {
2929
export const buildTestSnowplow = async function () {
3030
const snowplow = await rollup({
3131
input: 'src/js/init.js',
32-
plugins: [...rollupPlugins],
32+
plugins: basePlugins,
3333
});
3434

3535
return await snowplow.write({

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
"moment-timezone": "^0.5.26",
4141
"prettier": "^2.1.1",
4242
"rollup": "^2.26.11",
43+
"rollup-plugin-banner": "^0.2.1",
4344
"rollup-plugin-cleanup": "^3.1.1",
4445
"rollup-plugin-filesize": "^9.0.2",
4546
"rollup-plugin-sizes": "^1.0.3",
4647
"saucelabs": "^3.0.0",
47-
"semver": "^6.3.0",
4848
"wdio-chromedriver-service": "^5.0.2"
4949
},
5050
"contributors": [

0 commit comments

Comments
 (0)