Skip to content

Commit

Permalink
Include license and version information in web bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jul 22, 2024
1 parent 9c9ceb3 commit 67eb981
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 5 deletions.
167 changes: 164 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@rollup/plugin-node-resolve": "^13.3.0",
"@vitejs/plugin-legacy": "^2.0.0",
"rollup": "^2.77.2",
"rollup-plugin-license": "^3.5.2",
"terser": "^5.14.2",
"typescript": "^4.7.4",
"vite": "^3.0.0",
Expand Down
18 changes: 16 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import fs from 'node:fs';
import commonjs from '@rollup/plugin-commonjs';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import license from 'rollup-plugin-license';
import {version} from './package.json';

const external = ['jszip', 'cross-fetch', '@turbowarp/json'];

const headerPlugin = license({
banner: {
commentStyle: 'ignored',
content: `SBDL v${version} <https://github.com/forkphorus/sb-downloader>\n\n${fs.readFileSync('LICENSE', 'utf-8')}`
}
});

export default [
{
// For Node.js
Expand All @@ -20,7 +30,10 @@ export default [
file: 'lib/bundle-web.cjs',
format: 'cjs'
},
external
external,
plugins: [
headerPlugin
]
},
{
// For browsers using <script>
Expand All @@ -35,7 +48,8 @@ export default [
commonjs(),
nodeResolve({
browser: true
})
}),
headerPlugin
]
}
];

0 comments on commit 67eb981

Please sign in to comment.