Skip to content

Commit

Permalink
add licenses to the bundled output
Browse files Browse the repository at this point in the history
  • Loading branch information
tasshi-me committed Aug 7, 2023
1 parent 5ed6034 commit 67acba6
Show file tree
Hide file tree
Showing 3 changed files with 261 additions and 1 deletion.
229 changes: 229 additions & 0 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 @@ -44,6 +44,7 @@
"eslint": "^8.46.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"rollup-plugin-license": "^3.0.1",
"typescript": "^5.1.6",
"vite": "^4.4.8",
"vitest": "^0.34.1",
Expand Down
32 changes: 31 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
import { defineConfig } from "vite";
import { resolve } from "path";
import path, { resolve } from "path";
import fs from "fs";
import license from "rollup-plugin-license";

const licenseText = fs.readFileSync(path.join(__dirname, "LICENSE"), "utf-8");
const licenseTemplate = `
Bundle of <%= pkg.name %>
Generated: <%= moment().format('YYYY-MM-DD') %>
Version: <%= pkg.version %>
${licenseText}
This bundle includes the following third-party libraries:
<% _.forEach(dependencies, function (dependency) { %>
=====
<%= dependency.name %>@<%= dependency.version %> -- <%= dependency.license %>
-----
<%= dependency.licenseText %>
<% }) %>
`;

export default defineConfig({
build: {
Expand All @@ -8,5 +28,15 @@ export default defineConfig({
entry: resolve(__dirname, "src/main.ts"),
fileName: "my-kintone-customize",
},
rollupOptions: {
plugins: [
license({
banner: {
commentStyle: "ignored",
content: licenseTemplate,
},
}),
],
},
},
});

0 comments on commit 67acba6

Please sign in to comment.