Add license info to builds (Fix #1126)

This commit is contained in:
Niklas von Hertzen 2017-08-06 18:13:40 +08:00
parent 8da77eb689
commit f7f445c71e
3 changed files with 18 additions and 2 deletions

View File

@ -1 +1,2 @@
declare var __DEV__: boolean; declare var __DEV__: boolean;
declare var __VERSION__: string;

View File

@ -24,6 +24,10 @@ export type Options = {
}; };
const html2canvas = (element: HTMLElement, config: Options): Promise<HTMLCanvasElement> => { 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 logger = new Logger();
const ownerDocument = element.ownerDocument; const ownerDocument = element.ownerDocument;

View File

@ -1,4 +1,13 @@
const webpack = require('webpack'); 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 = { module.exports = {
entry: './src/index.js', entry: './src/index.js',
@ -16,7 +25,9 @@ module.exports = {
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'__DEV__': true '__DEV__': true,
}) '__VERSION__': JSON.stringify(pkg.version)
}),
new webpack.BannerPlugin(banner)
] ]
}; };