From e5ed66a748659e286abc7316640cd5593e07dddd Mon Sep 17 00:00:00 2001 From: WakelessSloth56 Date: Wed, 28 Aug 2024 20:11:50 +0800 Subject: [PATCH] build: license banner --- .gitignore | 2 + package.json | 3 +- pnpm-lock.yaml | 108 ++++++++++++++++++++++++++++++++++++++++++++++ rollup.config.js | 19 +++++++- src/core/index.ts | 20 +++++++++ 5 files changed, 149 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 40aa897..d41ddf5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ src/lib/* public build + +rollup.config-*.cjs diff --git a/package.json b/package.json index 25b9b63..a4d9d9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bilibili-local-player-h5", - "version": "2.0.0", + "version": "2.1.0", "description": "bilibili-local-player-h5", "main": "index.js", "type": "module", @@ -54,6 +54,7 @@ "node-html-parser": "^6.1.13", "onchange": "^7.1.0", "rollup": "^4.18.1", + "rollup-plugin-license": "^3.5.2", "sass": "^1.77.8", "terser": "^5.31.2", "tslib": "^2.6.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0639b1e..85a2637 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ importers: rollup: specifier: ^4.18.1 version: 4.18.1 + rollup-plugin-license: + specifier: ^3.5.2 + version: 3.5.2(rollup@4.18.1) sass: specifier: ^1.77.8 version: 1.77.8 @@ -267,6 +270,10 @@ packages: arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + array-find-index@1.0.2: + resolution: {integrity: sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==} + engines: {node: '>=0.10.0'} + assjs@0.0.11: resolution: {integrity: sha512-4h55j9RzOeDSWz93NPNb/+r9oycXHthaTk/LOV2eENIRK+WbaixEn2bjuMsYYCYTxab03F/8fMkwU6jfrbvKCg==} @@ -315,6 +322,9 @@ packages: commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + commenting@1.1.0: + resolution: {integrity: sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA==} + commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} @@ -366,6 +376,14 @@ packages: estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + fdir@6.1.1: + resolution: {integrity: sha512-QfKBVg453Dyn3mr0Q0O+Tkr1r79lOTAKSi9f/Ot4+qVEwxWhav2Z+SudrG9vQjM2aYRMQQZ2/Q1zdA8ACM1pDg==} + peerDependencies: + picomatch: 3.x + peerDependenciesMeta: + picomatch: + optional: true + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -443,6 +461,9 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + lower-case@2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} @@ -460,6 +481,9 @@ packages: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} + moment@2.30.1: + resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} + no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -480,6 +504,10 @@ packages: package-json-from-dist@1.0.0: resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} + package-name-regex@2.0.6: + resolution: {integrity: sha512-gFL35q7kbE/zBaPA3UKhp2vSzcPYx2ecbYuwv1ucE9Il6IIgBDweBlH8D68UFGZic2MkllKa2KHCfC1IQBQUYA==} + engines: {node: '>=12'} + param-case@3.0.4: resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} @@ -516,6 +544,12 @@ packages: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true + rollup-plugin-license@3.5.2: + resolution: {integrity: sha512-NNeXBcE6RyQdZdSC8Vxe8Cheax2aUa/K0Ok6JDZwr9isjkSDer4aMg0sovas1Ua76ojLZX1BrNQ6ZFspztKkZQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 + rollup@4.18.1: resolution: {integrity: sha512-Elx2UT8lzxxOXMpy5HWQGZqkrQOtrVDDa/bm9l10+U4rQnVzbL/LgZ4NOM1MPIDyHk69W4InuYDF5dzRh4Kw1A==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -558,6 +592,27 @@ packages: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + spdx-compare@1.0.0: + resolution: {integrity: sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==} + + spdx-exceptions@2.5.0: + resolution: {integrity: sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==} + + spdx-expression-parse@3.0.1: + resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} + + spdx-expression-validate@2.0.0: + resolution: {integrity: sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg==} + + spdx-license-ids@3.0.20: + resolution: {integrity: sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==} + + spdx-ranges@2.1.1: + resolution: {integrity: sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==} + + spdx-satisfies@5.0.1: + resolution: {integrity: sha512-Nwor6W6gzFp8XX4neaKQ7ChV4wmpSh2sSDemMFSzHxpTw460jxFYeOn+jq4ybnSSw/5sc3pjka9MQPouksQNpw==} + string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -777,6 +832,8 @@ snapshots: arg@4.1.3: {} + array-find-index@1.0.2: {} + assjs@0.0.11: {} balanced-match@1.0.2: {} @@ -826,6 +883,8 @@ snapshots: commander@2.20.3: {} + commenting@1.1.0: {} + commondir@1.0.1: {} cross-env@7.0.3: @@ -881,6 +940,8 @@ snapshots: estree-walker@2.0.2: {} + fdir@6.1.1: {} + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -958,6 +1019,8 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + lodash@4.17.21: {} + lower-case@2.0.2: dependencies: tslib: 2.6.3 @@ -974,6 +1037,8 @@ snapshots: minipass@7.1.2: {} + moment@2.30.1: {} + no-case@3.0.4: dependencies: lower-case: 2.0.2 @@ -1002,6 +1067,8 @@ snapshots: package-json-from-dist@1.0.0: {} + package-name-regex@2.0.6: {} + param-case@3.0.4: dependencies: dot-case: 3.0.4 @@ -1039,6 +1106,20 @@ snapshots: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 + rollup-plugin-license@3.5.2(rollup@4.18.1): + dependencies: + commenting: 1.1.0 + fdir: 6.1.1 + lodash: 4.17.21 + magic-string: 0.30.10 + moment: 2.30.1 + package-name-regex: 2.0.6 + rollup: 4.18.1 + spdx-expression-validate: 2.0.0 + spdx-satisfies: 5.0.1 + transitivePeerDependencies: + - picomatch + rollup@4.18.1: dependencies: '@types/estree': 1.0.5 @@ -1092,6 +1173,33 @@ snapshots: source-map@0.6.1: {} + spdx-compare@1.0.0: + dependencies: + array-find-index: 1.0.2 + spdx-expression-parse: 3.0.1 + spdx-ranges: 2.1.1 + + spdx-exceptions@2.5.0: {} + + spdx-expression-parse@3.0.1: + dependencies: + spdx-exceptions: 2.5.0 + spdx-license-ids: 3.0.20 + + spdx-expression-validate@2.0.0: + dependencies: + spdx-expression-parse: 3.0.1 + + spdx-license-ids@3.0.20: {} + + spdx-ranges@2.1.1: {} + + spdx-satisfies@5.0.1: + dependencies: + spdx-compare: 1.0.0 + spdx-expression-parse: 3.0.1 + spdx-ranges: 2.1.1 + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 diff --git a/rollup.config.js b/rollup.config.js index 1f1d84c..6d94bf3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,10 +1,12 @@ import typescript from '@rollup/plugin-typescript'; import replace from '@rollup/plugin-replace'; import terser from '@rollup/plugin-terser'; +const license = require('rollup-plugin-license'); const { version, srcPath } = require('./scripts/utils.cjs'); const { javascript: terserOptions } = require('./scripts/terser.config.cjs'); const dev = process.env.NODE_ENV !== 'production'; +const ver = version(); const ccl = '../lib/CommentCoreLibrary.js'; @@ -32,8 +34,21 @@ export default [ // (!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`. preventAssignment: true, values: { - // _version_: `JSON.parse('${JSON.stringify(version())}');`, - _version_: JSON.stringify(version()) + ';', + // _version_: `JSON.parse('${JSON.stringify(ver)}');`, + _version_: JSON.stringify(ver) + ';', + }, + }), + license({ + banner: { + commentStyle: 'ignored', + content: ` +Bundle of BilibiliLocalPlayerH5 (https://github.com/auioc/BilibiliLocalPlayerH5) +Generated at <%= moment().format() %> +Version: v<%= pkg.version %> @ ${ver.text} +Copyright (C) 2022-<%= moment().format('YYYY') %> AUIOC.ORG +Copyright (C) 2018-2022 PCC-Studio +Licensed under GNU Affero General Public License v3.0 (https://github.com/auioc/BilibiliLocalPlayerH5/blob/main/LICENSE) +`.trim(), }, }), ...[dev ? [] : [terser(terserOptions)]], diff --git a/src/core/index.ts b/src/core/index.ts index 03f823c..2c05279 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,3 +1,23 @@ +/* + * Copyright (C) 2022-2024 AUIOC.ORG + * Copyright (C) 2018-2022 PCC-Studio + * + * This file is part of BilibiliLocalPlayerH5. + * + * BilibiliLocalPlayerH5 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, + * or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import { playerMetadata } from './data'; import { PlayerMetadata } from './metadata'; import Player from './player';