瀏覽代碼

ref: postbuild; remove extra @connects

Sv443 1 年之前
父節點
當前提交
f82dc4bbba
共有 2 個文件被更改,包括 46 次插入22 次删除
  1. 38 6
      dist/BetterYTM.user.js
  2. 8 16
      src/tools/post-build.ts

+ 38 - 6
dist/BetterYTM.user.js

@@ -8,19 +8,51 @@
 // @license         MIT
 // @author          Sv443
 // @copyright       Sv443 (https://github.com/Sv443)
+// @icon            https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icon/icon.png
 // @match           https://music.youtube.com/*
 // @match           https://www.youtube.com/*
-// @icon            https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icon/icon.png
 // @run-at          document-start
+// @downloadURL     https://raw.githubusercontent.com/Sv443/BetterYTM/develop/dist/BetterYTM.user.js
+// @updateURL       https://raw.githubusercontent.com/Sv443/BetterYTM/develop/dist/BetterYTM.user.js
+// @connect         api.sv443.net
 // @grant           GM.getValue
 // @grant           GM.setValue
 // @grant           unsafeWindow
-// @connect         self
-// @connect         youtube.com
-// @connect         github.com
-// @connect         githubusercontent.com
+// ==/UserScript==
+/*
+ ▄▄▄                    ▄   ▄▄▄▄▄▄   ▄
+ █  █ ▄▄▄ █   █   ▄▄▄ ▄ ▄█ █  █  █▀▄▀█
+ █▀▀▄ █▄█ █▀  █▀  █▄█ █▀  █   █  █   █
+ █▄▄▀ ▀▄▄ ▀▄▄ ▀▄▄ ▀▄▄ █   █   █  █   █
+
+         Made with ❤️ by Sv443
+ I welcome every contribution on GitHub!
+   https://github.com/Sv443/BetterYTM
+*/
+
+/* Disclaimer: I am not affiliated with YouTube, Google, Alphabet, Genius or anyone else */
+/* C&D this 🖕 */
+
+// ==UserScript==
+// @name            BetterYTM
+// @homepageURL     https://github.com/Sv443/BetterYTM#readme
+// @namespace       https://github.com/Sv443/BetterYTM
+// @version         1.0.0
+// @description     Configurable layout and UX improvements for YouTube Music
+// @description:de  Konfigurierbares Layout und UX-Verbesserungen für YouTube Music
+// @license         MIT
+// @author          Sv443
+// @copyright       Sv443 (https://github.com/Sv443)
+// @icon            https://raw.githubusercontent.com/Sv443/BetterYTM/develop/assets/icon/icon.png
+// @match           https://music.youtube.com/*
+// @match           https://www.youtube.com/*
+// @run-at          document-start
 // @downloadURL     https://raw.githubusercontent.com/Sv443/BetterYTM/develop/dist/BetterYTM.user.js
 // @updateURL       https://raw.githubusercontent.com/Sv443/BetterYTM/develop/dist/BetterYTM.user.js
+// @connect         api.sv443.net
+// @grant           GM.getValue
+// @grant           GM.setValue
+// @grant           unsafeWindow
 // ==/UserScript==
 /*
  ▄▄▄                    ▄   ▄▄▄▄▄▄   ▄
@@ -480,7 +512,7 @@ const scriptInfo = Object.freeze({
     name: GM.info.script.name,
     version: GM.info.script.version,
     namespace: GM.info.script.namespace,
-    lastCommit: "770496b", // assert as generic string instead of union
+    lastCommit: "fae706c", // assert as generic string instead of union
 });
 
 

+ 8 - 16
src/tools/post-build.ts

@@ -16,15 +16,9 @@ const repo = "Sv443/BetterYTM";
 const userscriptDistFile = `BetterYTM${outFileSuffix}.user.js`;
 const distFolderPath = "./dist/";
 const scriptUrl = `https://raw.githubusercontent.com/${repo}/${branch}/dist/${userscriptDistFile}`;
-/** Which URLs should the userscript be active on - see https://wiki.greasespot.net/Metadata_Block#%40match */
-const matchUrls = [
-  "https://music.youtube.com/*",
-  "https://www.youtube.com/*",
-];
-/** Whether to trigger the bell sound in some terminals when the code has finished compiling */
-const ringBell = env.RING_BELL && (env.RING_BELL.length > 0 && env.RING_BELL.trim().toLowerCase() === "true");
 
-const matchDirectives = matchUrls.reduce((a, c) => a + `// @match           ${c}\n`, "");
+/** Whether to trigger the bell sound in some terminals when the code has finished compiling */
+const ringBell = Boolean(env.RING_BELL && (env.RING_BELL.length > 0 && env.RING_BELL.trim().toLowerCase() === "true"));
 
 const header = `\
 // ==UserScript==
@@ -37,18 +31,16 @@ const header = `\
 // @license         ${pkg.license}
 // @author          ${pkg.author.name}
 // @copyright       ${pkg.author.name} (${pkg.author.url})
-${matchDirectives}\
 // @icon            https://raw.githubusercontent.com/${repo}/${branch}/assets/icon/icon.png
+// @match           https://music.youtube.com/*
+// @match           https://www.youtube.com/*
 // @run-at          document-start
+// @downloadURL     ${scriptUrl}
+// @updateURL       ${scriptUrl}
+// @connect         api.sv443.net
 // @grant           GM.getValue
 // @grant           GM.setValue
 // @grant           unsafeWindow
-// @connect         self
-// @connect         youtube.com
-// @connect         github.com
-// @connect         githubusercontent.com
-// @downloadURL     ${scriptUrl}
-// @updateURL       ${scriptUrl}
 // ==/UserScript==
 /*
  ▄▄▄                    ▄   ▄▄▄▄▄▄   ▄
@@ -90,7 +82,7 @@ ${matchDirectives}\
 
     await writeFile(scriptPath, finalUserscript);
 
-    const envText = mode === "production" ? "\x1b[32mproduction" : "\x1b[33mdevelopment";
+    const envText = `${mode === "production" ? "\x1b[32m" : "\x1b[33m"}${mode}`;
     const sizeKiB = (Buffer.byteLength(finalUserscript, "utf8") / 1024).toFixed(2);
 
     console.info(`Successfully built for ${envText}\x1b[0m - build number (last commit SHA): \x1b[34m${lastCommitSha}\x1b[0m`);