From 06e5e8ece445def5312f98165a3cafd38250101b Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Thu, 17 Jun 2021 16:09:07 -0700 Subject: [PATCH] Gen copyright on dist files --- resources/COPYRIGHT | 6 ------ resources/copyright.js | 6 ++++++ resources/rollup-config-es.js | 3 +-- resources/rollup-config.js | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 resources/COPYRIGHT create mode 100644 resources/copyright.js diff --git a/resources/COPYRIGHT b/resources/COPYRIGHT deleted file mode 100644 index 03e30c8ab4..0000000000 --- a/resources/COPYRIGHT +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) 2014-present, Lee Byron and contributors. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ diff --git a/resources/copyright.js b/resources/copyright.js new file mode 100644 index 0000000000..56fb43bb13 --- /dev/null +++ b/resources/copyright.js @@ -0,0 +1,6 @@ +import fs from 'fs'; + +const copyright = fs.readFileSync('./LICENSE', 'utf-8'); +const lines = copyright.trim().split('\n'); + +export default `/**\n${lines.map((line) => ` * ${line}`).join('\n')}\n */`; diff --git a/resources/rollup-config-es.js b/resources/rollup-config-es.js index 0f13c2196f..0c73d002db 100644 --- a/resources/rollup-config-es.js +++ b/resources/rollup-config-es.js @@ -1,11 +1,10 @@ -import fs from 'fs'; import path from 'path'; import buble from 'rollup-plugin-buble'; import commonjs from 'rollup-plugin-commonjs'; import json from 'rollup-plugin-json'; import stripBanner from 'rollup-plugin-strip-banner'; -const copyright = fs.readFileSync(path.join('resources', 'COPYRIGHT'), 'utf-8'); +import copyright from './copyright'; const SRC_DIR = path.resolve('src'); const DIST_DIR = path.resolve('dist'); diff --git a/resources/rollup-config.js b/resources/rollup-config.js index ebbf067aaf..60be922490 100644 --- a/resources/rollup-config.js +++ b/resources/rollup-config.js @@ -7,7 +7,7 @@ import json from 'rollup-plugin-json'; import saveLicense from 'uglify-save-license'; import stripBanner from 'rollup-plugin-strip-banner'; -const copyright = fs.readFileSync(path.join('resources', 'COPYRIGHT'), 'utf-8'); +import copyright from './copyright'; const SRC_DIR = path.resolve('src'); const DIST_DIR = path.resolve('dist');