Skip to content

Commit a709757

Browse files
committed
fix: more example stuff
1 parent aab91c6 commit a709757

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

dist/#Example.user.js dist/Userscript Name.user.js

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==UserScript==
2-
// @name #Example
2+
// @name Userscript Name
33
// @namespace https://github.com/#REPLACE:User/Repo#readme
44
// @version 1.0.0
55
// @description #REPLACE:Userscript Description
@@ -8,11 +8,11 @@
88
// @license WTFPL
99
// @author #REPLACE:Author name
1010
// @copyright #REPLACE:Author name (#REPLACE:Author URL)
11-
// @icon https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/assets/images/logo_48.png?b=3f6dd30
11+
// @icon https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/assets/images/logo_48.png?b=aab91c6
1212
// @match #REPLACE:Match URL(s) - i.e. *://*.example.com/*
1313
// @run-at document-start
14-
// @downloadURL https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/dist/#Example.user.js
15-
// @updateURL https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/dist/#Example.user.js
14+
// @downloadURL https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/dist/Userscript Name.user.js
15+
// @updateURL https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/dist/Userscript Name.user.js
1616
// @connect github.com
1717
// @connect raw.githubusercontent.com
1818
// @grant GM.getValue
@@ -22,8 +22,8 @@
2222
// @grant GM.xmlHttpRequest
2323
// @grant GM.openInTab
2424
// @noframes
25-
// @resource img-icon https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/assets/images/icon.png?b=3f6dd30
26-
// @resource doc-changelog https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/CHANGELOG.md?b=3f6dd30
25+
// @resource img-icon https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/assets/images/icon.png?b=aab91c6
26+
// @resource doc-changelog https://raw.githubusercontent.com/#REPLACE:User/Repo/develop/CHANGELOG.md?b=aab91c6
2727
// @require https://cdn.jsdelivr.net/npm/@sv443-network/[email protected]/dist/index.global.js
2828
// @grant GM.registerMenuCommand
2929
// @grant GM.listValues
@@ -59,7 +59,10 @@ function __awaiter(thisArg, _arguments, P, generator) {
5959
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
6060
var e = new Error(message);
6161
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
62-
};/** Default compression format used throughout the entire script */
62+
};const buildNumberRaw = "aab91c6";
63+
/** The build number of the userscript */
64+
const buildNumber = (buildNumberRaw.match(/^#{{.+}}$/) ? "BUILD_ERROR!" : buildNumberRaw); // asserted as generic string instead of literal
65+
/** Default compression format used throughout the entire script */
6366
const compressionFormat = "deflate-raw";
6467
/** Whether sessionStorage is available and working */
6568
typeof (sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem) !== "undefined"
@@ -75,11 +78,11 @@ typeof (sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionS
7578
}
7679
})();
7780
/** Info about the userscript, parsed from the userscript header (tools/post-build.js) */
78-
({
81+
const scriptInfo = {
7982
name: GM.info.script.name,
8083
version: GM.info.script.version,
8184
namespace: GM.info.script.namespace,
82-
});let canCompress;
85+
};let canCompress;
8386
const config = new userutils.DataStore({
8487
id: "script-config",
8588
defaultData: {
@@ -173,6 +176,7 @@ function init() {
173176
function run() {
174177
return __awaiter(this, void 0, void 0, function* () {
175178
try {
179+
console.log(`Initializing ${scriptInfo.name} v${scriptInfo.version} (#${buildNumber})...`);
176180
// post-build these double quotes are replaced by backticks (because if backticks are used here, the bundler converts them to double quotes)
177181
addStyle("#{{GLOBAL_STYLE}}", "global");
178182
initObservers();
@@ -183,4 +187,4 @@ function run() {
183187
}
184188
});
185189
}
186-
init();})(UserUtils);//# sourceMappingURL=http://localhost:8710/#Example.user.js.map
190+
init();})(UserUtils);//# sourceMappingURL=http://localhost:8710/Userscript Name.user.js.map

src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { initConfig } from "./config";
2+
import { buildNumber, scriptInfo } from "./constants";
23
import { initObservers } from "./observers";
34
import { addStyle, domLoaded } from "./utils";
45

@@ -15,6 +16,8 @@ async function init() {
1516
/** Runs after the DOM is available */
1617
async function run() {
1718
try {
19+
console.log(`Initializing ${scriptInfo.name} v${scriptInfo.version} (#${buildNumber})...`);
20+
1821
// post-build these double quotes are replaced by backticks (because if backticks are used here, the bundler converts them to double quotes)
1922
addStyle("#{{GLOBAL_STYLE}}", "global");
2023

0 commit comments

Comments
 (0)