Skip to content

Commit

Permalink
Merge pull request #432 from fluture-js/avaq/licenses
Browse files Browse the repository at this point in the history
Include copyright licenses in bundled distributions
  • Loading branch information
Avaq authored Jun 16, 2020
2 parents 102f9a8 + 733399f commit 1c4f198
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2018 Aldwin Vlasblom
Copyright (c) 2020 Aldwin Vlasblom

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
21 changes: 20 additions & 1 deletion rollup.config.dist.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
/* global process require */
/* global process require Set */

import {readFileSync} from 'fs';
import node from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

var pkg = require('./package.json');

var dependencies = pkg => {
var deps = Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.peerDependencies || {}));
return Array.from(new Set(deps.concat(deps.flatMap(dependency => (
dependencies(require(`${dependency}/package.json`))
)))));
};

var banner = `/**
* Fluture bundled; version ${process.env.VERSION || `${pkg.version} (dirty)`}
*/
`;

var footer = `/** Fluture license
${readFileSync('./LICENSE')}*/
${dependencies(pkg).map(dependency => `/** ${dependency} license
${readFileSync(`./node_modules/${dependency}/LICENSE`)}*/`
).join('\n\n')}`;

var typeref = `/// <reference types="https://cdn.jsdelivr.net/gh/fluture-js/Fluture@${
process.env.VERSION || pkg.version
}/index.d.ts" />`;
Expand All @@ -19,6 +36,7 @@ export default [{
plugins: [node(), commonjs({include: 'node_modules/**'})],
output: {
banner: banner,
footer: footer,
format: 'iife',
name: 'Fluture',
file: 'dist/bundle.js'
Expand All @@ -28,6 +46,7 @@ export default [{
plugins: [node(), commonjs({include: 'node_modules/**'})],
output: {
banner: `${banner}\n${typeref}\n`,
footer: footer,
format: 'es',
file: 'dist/module.js'
}
Expand Down

0 comments on commit 1c4f198

Please sign in to comment.