Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added license header to dist files. #60

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 * 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 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/;

Check warning on line 57 in webpack.config.ts

View workflow job for this annotation

GitHub Actions / Test eslint style

Use the 'u' flag

/* *
*
* Distribution
Expand Down Expand Up @@ -130,7 +142,6 @@

};


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

Expand Down Expand Up @@ -192,6 +203,31 @@

}

// 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
Loading