Skip to content

Commit

Permalink
Added license header to dist files. (#60)
Browse files Browse the repository at this point in the history
* Added licese header to dist files.

* Licenses: Added info to build package.

* Fixed warning
  • Loading branch information
pawelfus authored Dec 9, 2024
1 parent b512f47 commit f9b4253
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"version": "1.0.0",
"name": "@highcharts/connectors-morningstar",
"license": "UNLICENSED",
"license": "https://shop.highcharts.com/contact/partner-data",
"description": "Highcharts connectors for Morningstar Direct Web Services",
"author": "Highsoft AS",
"bugs": "https://www.highcharts.com/support/",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
// same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable
"compilerOptions": {
"allowJs": true,
"resolveJsonModule": true,
"module": "CommonJS"
}
}
Expand Down
38 changes: 37 additions & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import type { Configuration } from 'webpack';

import * as FS from 'node:fs';
import * as Path from 'node:path';
import * as Webpack from 'webpack';
import * as TerserPlugin from 'terser-webpack-plugin';
import { version } from './package-build.json';

/* *
*
Expand Down Expand Up @@ -44,6 +47,15 @@ const sourceFolder = './code/es-modules/';
const targetFolder = './code/';



const banner = `/**
* Highcharts Connectors for Morningstar Direct Web Services ` +
`v${version} (${new Date().toISOString().split('T')[0]})
* (c) 2009-2024 Highsoft AS
* License: https://shop.highcharts.com/contact/partner-data
**/`;
const license = /License: https:\/\/shop.highcharts.com\/contact\/partner-data/u;

/* *
*
* Distribution
Expand Down Expand Up @@ -130,7 +142,6 @@ const sharedConfiguration: Configuration = {

};


const webpacks: Array<Configuration> = Object.keys(metas).map(variant => ({
...sharedConfiguration,

Expand Down Expand Up @@ -192,6 +203,31 @@ for (let webpack of webpacks.slice()) {

}

// Enable header for all production builds. This is used to add the license
// header to the minified files too.
webpacks.forEach(webpack => {
webpack.plugins = [
new Webpack.BannerPlugin({
banner: banner,
raw: true
})
];

if (!webpack.optimization) {
webpack.optimization = {};
}

webpack.optimization.minimizer = [
new TerserPlugin({
terserOptions: {
format: {
comments: license // Keep comments that include "License:"
}
},
extractComments: false
})
];
});

/* *
*
Expand Down

0 comments on commit f9b4253

Please sign in to comment.