Skip to content

Commit

Permalink
Add license info to builds (Fix #1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Aug 6, 2017
1 parent 8da77eb commit f7f445c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions flow-typed/myLibDef.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare var __DEV__: boolean;
declare var __VERSION__: string;
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export type Options = {
};

const html2canvas = (element: HTMLElement, config: Options): Promise<HTMLCanvasElement> => {
if (typeof console === 'object' && typeof console.log === 'function') {
console.log(`html2canvas ${__VERSION__}`);
}

const logger = new Logger();

const ownerDocument = element.ownerDocument;
Expand Down
15 changes: 13 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');

const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json')));

const banner =
`${pkg.title} ${pkg.version} <${pkg.homepage}>
Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}>
Released under ${pkg.license} License`;

module.exports = {
entry: './src/index.js',
Expand All @@ -16,7 +25,9 @@ module.exports = {
},
plugins: [
new webpack.DefinePlugin({
'__DEV__': true
})
'__DEV__': true,
'__VERSION__': JSON.stringify(pkg.version)
}),
new webpack.BannerPlugin(banner)
]
};

0 comments on commit f7f445c

Please sign in to comment.