Skip to content

Commit

Permalink
fix #51; extract copyrights from license
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jun 5, 2021
1 parent 4447d01 commit ee72b8a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import {readFileSync} from "fs";
import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";

// Extract copyrights from the LICENSE.
const copyright = readFileSync("./LICENSE", "utf-8")
.split(/\n/g)
.filter(line => /^copyright\s+/i.test(line))
.map(line => line.replace(/^copyright\s+/i, ""))
.join(", ");

const config = {
input: "src/index.js",
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
Expand All @@ -10,7 +18,7 @@ const config = {
format: "umd",
indent: false,
extend: true,
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
banner: `// ${meta.homepage} v${meta.version} Copyright ${copyright}`,
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
},
plugins: []
Expand Down

0 comments on commit ee72b8a

Please sign in to comment.