onlineornot 1.2.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/onlineornot-dist/cli.js +349 -116
- package/onlineornot-dist/cli.js.map +4 -4
- package/package.json +1 -1
package/onlineornot-dist/cli.js
CHANGED
|
@@ -544,7 +544,7 @@ var require_has_flag = __commonJS({
|
|
|
544
544
|
var require_supports_colors = __commonJS({
|
|
545
545
|
"../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js"(exports, module2) {
|
|
546
546
|
"use strict";
|
|
547
|
-
var
|
|
547
|
+
var os8 = require("os");
|
|
548
548
|
var hasFlag3 = require_has_flag();
|
|
549
549
|
var env5 = process.env;
|
|
550
550
|
var forceColor = void 0;
|
|
@@ -582,7 +582,7 @@ var require_supports_colors = __commonJS({
|
|
|
582
582
|
}
|
|
583
583
|
var min = forceColor ? 1 : 0;
|
|
584
584
|
if (process.platform === "win32") {
|
|
585
|
-
var osRelease =
|
|
585
|
+
var osRelease = os8.release().split(".");
|
|
586
586
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
587
587
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
588
588
|
}
|
|
@@ -2071,9 +2071,9 @@ var require_strip_json_comments = __commonJS({
|
|
|
2071
2071
|
var require_utils2 = __commonJS({
|
|
2072
2072
|
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports) {
|
|
2073
2073
|
"use strict";
|
|
2074
|
-
var
|
|
2074
|
+
var fs6 = require("fs");
|
|
2075
2075
|
var ini = require_ini();
|
|
2076
|
-
var
|
|
2076
|
+
var path9 = require("path");
|
|
2077
2077
|
var stripJsonComments = require_strip_json_comments();
|
|
2078
2078
|
var parse = exports.parse = function(content) {
|
|
2079
2079
|
if (/^\s*{/.test(content))
|
|
@@ -2087,10 +2087,10 @@ var require_utils2 = __commonJS({
|
|
|
2087
2087
|
for (var i in args)
|
|
2088
2088
|
if ("string" !== typeof args[i])
|
|
2089
2089
|
return;
|
|
2090
|
-
var file2 =
|
|
2090
|
+
var file2 = path9.join.apply(null, args);
|
|
2091
2091
|
var content;
|
|
2092
2092
|
try {
|
|
2093
|
-
return
|
|
2093
|
+
return fs6.readFileSync(file2, "utf-8");
|
|
2094
2094
|
} catch (err) {
|
|
2095
2095
|
return;
|
|
2096
2096
|
}
|
|
@@ -2125,15 +2125,15 @@ var require_utils2 = __commonJS({
|
|
|
2125
2125
|
return obj;
|
|
2126
2126
|
};
|
|
2127
2127
|
var find = exports.find = function() {
|
|
2128
|
-
var rel =
|
|
2128
|
+
var rel = path9.join.apply(null, [].slice.call(arguments));
|
|
2129
2129
|
function find2(start, rel2) {
|
|
2130
|
-
var file2 =
|
|
2130
|
+
var file2 = path9.join(start, rel2);
|
|
2131
2131
|
try {
|
|
2132
|
-
|
|
2132
|
+
fs6.statSync(file2);
|
|
2133
2133
|
return file2;
|
|
2134
2134
|
} catch (err) {
|
|
2135
|
-
if (
|
|
2136
|
-
return find2(
|
|
2135
|
+
if (path9.dirname(start) !== start)
|
|
2136
|
+
return find2(path9.dirname(start), rel2);
|
|
2137
2137
|
}
|
|
2138
2138
|
}
|
|
2139
2139
|
return find2(process.cwd(), rel);
|
|
@@ -2635,8 +2635,8 @@ var require_registry_auth_token = __commonJS({
|
|
|
2635
2635
|
}
|
|
2636
2636
|
return void 0;
|
|
2637
2637
|
}
|
|
2638
|
-
function normalizePath2(
|
|
2639
|
-
return
|
|
2638
|
+
function normalizePath2(path9) {
|
|
2639
|
+
return path9[path9.length - 1] === "/" ? path9 : path9 + "/";
|
|
2640
2640
|
}
|
|
2641
2641
|
function getAuthInfoForUrl(regUrl, npmrc) {
|
|
2642
2642
|
var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
|
|
@@ -2683,19 +2683,19 @@ var require_update_check = __commonJS({
|
|
|
2683
2683
|
"../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports, module2) {
|
|
2684
2684
|
var { URL: URL2 } = require("url");
|
|
2685
2685
|
var { join } = require("path");
|
|
2686
|
-
var
|
|
2686
|
+
var fs6 = require("fs");
|
|
2687
2687
|
var { promisify: promisify2 } = require("util");
|
|
2688
2688
|
var { tmpdir: tmpdir2 } = require("os");
|
|
2689
2689
|
var registryUrl = require_registry_url();
|
|
2690
|
-
var writeFile2 = promisify2(
|
|
2691
|
-
var mkdir = promisify2(
|
|
2692
|
-
var readFile = promisify2(
|
|
2690
|
+
var writeFile2 = promisify2(fs6.writeFile);
|
|
2691
|
+
var mkdir = promisify2(fs6.mkdir);
|
|
2692
|
+
var readFile = promisify2(fs6.readFile);
|
|
2693
2693
|
var compareVersions = (a, b) => a.localeCompare(b, "en-US", { numeric: true });
|
|
2694
2694
|
var encode = (value) => encodeURIComponent(value).replace(/^%40/, "@");
|
|
2695
2695
|
var getFile = async (details, distTag) => {
|
|
2696
2696
|
const rootDir = tmpdir2();
|
|
2697
2697
|
const subDir = join(rootDir, "update-check");
|
|
2698
|
-
if (!
|
|
2698
|
+
if (!fs6.existsSync(subDir)) {
|
|
2699
2699
|
await mkdir(subDir);
|
|
2700
2700
|
}
|
|
2701
2701
|
let name = `${details.name}-${distTag}.json`;
|
|
@@ -2705,7 +2705,7 @@ var require_update_check = __commonJS({
|
|
|
2705
2705
|
return join(subDir, name);
|
|
2706
2706
|
};
|
|
2707
2707
|
var evaluateCache = async (file, time, interval) => {
|
|
2708
|
-
if (
|
|
2708
|
+
if (fs6.existsSync(file)) {
|
|
2709
2709
|
const content = await readFile(file, "utf8");
|
|
2710
2710
|
const { lastUpdate, latest } = JSON.parse(content);
|
|
2711
2711
|
const nextCheck = lastUpdate + interval;
|
|
@@ -2836,11 +2836,11 @@ var require_update_check = __commonJS({
|
|
|
2836
2836
|
var require_is_docker = __commonJS({
|
|
2837
2837
|
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports, module2) {
|
|
2838
2838
|
"use strict";
|
|
2839
|
-
var
|
|
2839
|
+
var fs6 = require("fs");
|
|
2840
2840
|
var isDocker;
|
|
2841
2841
|
function hasDockerEnv() {
|
|
2842
2842
|
try {
|
|
2843
|
-
|
|
2843
|
+
fs6.statSync("/.dockerenv");
|
|
2844
2844
|
return true;
|
|
2845
2845
|
} catch (_) {
|
|
2846
2846
|
return false;
|
|
@@ -2848,7 +2848,7 @@ var require_is_docker = __commonJS({
|
|
|
2848
2848
|
}
|
|
2849
2849
|
function hasDockerCGroup() {
|
|
2850
2850
|
try {
|
|
2851
|
-
return
|
|
2851
|
+
return fs6.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
2852
2852
|
} catch (_) {
|
|
2853
2853
|
return false;
|
|
2854
2854
|
}
|
|
@@ -2866,21 +2866,21 @@ var require_is_docker = __commonJS({
|
|
|
2866
2866
|
var require_is_wsl = __commonJS({
|
|
2867
2867
|
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports, module2) {
|
|
2868
2868
|
"use strict";
|
|
2869
|
-
var
|
|
2870
|
-
var
|
|
2869
|
+
var os8 = require("os");
|
|
2870
|
+
var fs6 = require("fs");
|
|
2871
2871
|
var isDocker = require_is_docker();
|
|
2872
2872
|
var isWsl = () => {
|
|
2873
2873
|
if (process.platform !== "linux") {
|
|
2874
2874
|
return false;
|
|
2875
2875
|
}
|
|
2876
|
-
if (
|
|
2876
|
+
if (os8.release().toLowerCase().includes("microsoft")) {
|
|
2877
2877
|
if (isDocker()) {
|
|
2878
2878
|
return false;
|
|
2879
2879
|
}
|
|
2880
2880
|
return true;
|
|
2881
2881
|
}
|
|
2882
2882
|
try {
|
|
2883
|
-
return
|
|
2883
|
+
return fs6.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
2884
2884
|
} catch (_) {
|
|
2885
2885
|
return false;
|
|
2886
2886
|
}
|
|
@@ -2919,17 +2919,17 @@ var require_define_lazy_prop = __commonJS({
|
|
|
2919
2919
|
// ../../node_modules/.pnpm/open@8.4.2/node_modules/open/index.js
|
|
2920
2920
|
var require_open = __commonJS({
|
|
2921
2921
|
"../../node_modules/.pnpm/open@8.4.2/node_modules/open/index.js"(exports, module2) {
|
|
2922
|
-
var
|
|
2922
|
+
var path9 = require("path");
|
|
2923
2923
|
var childProcess = require("child_process");
|
|
2924
|
-
var { promises:
|
|
2924
|
+
var { promises: fs6, constants: fsConstants } = require("fs");
|
|
2925
2925
|
var isWsl = require_is_wsl();
|
|
2926
2926
|
var isDocker = require_is_docker();
|
|
2927
2927
|
var defineLazyProperty = require_define_lazy_prop();
|
|
2928
|
-
var localXdgOpenPath =
|
|
2928
|
+
var localXdgOpenPath = path9.join(__dirname, "xdg-open");
|
|
2929
2929
|
var { platform, arch } = process;
|
|
2930
2930
|
var hasContainerEnv = () => {
|
|
2931
2931
|
try {
|
|
2932
|
-
|
|
2932
|
+
fs6.statSync("/run/.containerenv");
|
|
2933
2933
|
return true;
|
|
2934
2934
|
} catch {
|
|
2935
2935
|
return false;
|
|
@@ -2952,14 +2952,14 @@ var require_open = __commonJS({
|
|
|
2952
2952
|
const configFilePath = "/etc/wsl.conf";
|
|
2953
2953
|
let isConfigFileExists = false;
|
|
2954
2954
|
try {
|
|
2955
|
-
await
|
|
2955
|
+
await fs6.access(configFilePath, fsConstants.F_OK);
|
|
2956
2956
|
isConfigFileExists = true;
|
|
2957
2957
|
} catch {
|
|
2958
2958
|
}
|
|
2959
2959
|
if (!isConfigFileExists) {
|
|
2960
2960
|
return defaultMountPoint;
|
|
2961
2961
|
}
|
|
2962
|
-
const configContent = await
|
|
2962
|
+
const configContent = await fs6.readFile(configFilePath, { encoding: "utf8" });
|
|
2963
2963
|
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
2964
2964
|
if (!configMountPoint) {
|
|
2965
2965
|
return defaultMountPoint;
|
|
@@ -3059,7 +3059,7 @@ var require_open = __commonJS({
|
|
|
3059
3059
|
const isBundled = !__dirname || __dirname === "/";
|
|
3060
3060
|
let exeLocalXdgOpen = false;
|
|
3061
3061
|
try {
|
|
3062
|
-
await
|
|
3062
|
+
await fs6.access(localXdgOpenPath, fsConstants.X_OK);
|
|
3063
3063
|
exeLocalXdgOpen = true;
|
|
3064
3064
|
} catch {
|
|
3065
3065
|
}
|
|
@@ -3635,14 +3635,14 @@ var require_util = __commonJS({
|
|
|
3635
3635
|
}
|
|
3636
3636
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
3637
3637
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol}//${url2.hostname}:${port}`;
|
|
3638
|
-
let
|
|
3638
|
+
let path9 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
3639
3639
|
if (origin.endsWith("/")) {
|
|
3640
3640
|
origin = origin.substring(0, origin.length - 1);
|
|
3641
3641
|
}
|
|
3642
|
-
if (
|
|
3643
|
-
|
|
3642
|
+
if (path9 && !path9.startsWith("/")) {
|
|
3643
|
+
path9 = `/${path9}`;
|
|
3644
3644
|
}
|
|
3645
|
-
url2 = new URL(origin +
|
|
3645
|
+
url2 = new URL(origin + path9);
|
|
3646
3646
|
}
|
|
3647
3647
|
return url2;
|
|
3648
3648
|
}
|
|
@@ -5258,19 +5258,19 @@ var require_parseParams = __commonJS({
|
|
|
5258
5258
|
var require_basename = __commonJS({
|
|
5259
5259
|
"../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js"(exports, module2) {
|
|
5260
5260
|
"use strict";
|
|
5261
|
-
module2.exports = function basename2(
|
|
5262
|
-
if (typeof
|
|
5261
|
+
module2.exports = function basename2(path9) {
|
|
5262
|
+
if (typeof path9 !== "string") {
|
|
5263
5263
|
return "";
|
|
5264
5264
|
}
|
|
5265
|
-
for (var i =
|
|
5266
|
-
switch (
|
|
5265
|
+
for (var i = path9.length - 1; i >= 0; --i) {
|
|
5266
|
+
switch (path9.charCodeAt(i)) {
|
|
5267
5267
|
case 47:
|
|
5268
5268
|
case 92:
|
|
5269
|
-
|
|
5270
|
-
return
|
|
5269
|
+
path9 = path9.slice(i + 1);
|
|
5270
|
+
return path9 === ".." || path9 === "." ? "" : path9;
|
|
5271
5271
|
}
|
|
5272
5272
|
}
|
|
5273
|
-
return
|
|
5273
|
+
return path9 === ".." || path9 === "." ? "" : path9;
|
|
5274
5274
|
};
|
|
5275
5275
|
}
|
|
5276
5276
|
});
|
|
@@ -8296,7 +8296,7 @@ var require_request = __commonJS({
|
|
|
8296
8296
|
}
|
|
8297
8297
|
var Request = class {
|
|
8298
8298
|
constructor(origin, {
|
|
8299
|
-
path:
|
|
8299
|
+
path: path9,
|
|
8300
8300
|
method,
|
|
8301
8301
|
body,
|
|
8302
8302
|
headers,
|
|
@@ -8310,11 +8310,11 @@ var require_request = __commonJS({
|
|
|
8310
8310
|
throwOnError,
|
|
8311
8311
|
expectContinue
|
|
8312
8312
|
}, handler6) {
|
|
8313
|
-
if (typeof
|
|
8313
|
+
if (typeof path9 !== "string") {
|
|
8314
8314
|
throw new InvalidArgumentError("path must be a string");
|
|
8315
|
-
} else if (
|
|
8315
|
+
} else if (path9[0] !== "/" && !(path9.startsWith("http://") || path9.startsWith("https://")) && method !== "CONNECT") {
|
|
8316
8316
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
8317
|
-
} else if (invalidPathRegex.exec(
|
|
8317
|
+
} else if (invalidPathRegex.exec(path9) !== null) {
|
|
8318
8318
|
throw new InvalidArgumentError("invalid request path");
|
|
8319
8319
|
}
|
|
8320
8320
|
if (typeof method !== "string") {
|
|
@@ -8377,7 +8377,7 @@ var require_request = __commonJS({
|
|
|
8377
8377
|
this.completed = false;
|
|
8378
8378
|
this.aborted = false;
|
|
8379
8379
|
this.upgrade = upgrade || null;
|
|
8380
|
-
this.path = query ? util.buildURL(
|
|
8380
|
+
this.path = query ? util.buildURL(path9, query) : path9;
|
|
8381
8381
|
this.origin = origin;
|
|
8382
8382
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
8383
8383
|
this.blocking = blocking == null ? false : blocking;
|
|
@@ -9394,9 +9394,9 @@ var require_RedirectHandler = __commonJS({
|
|
|
9394
9394
|
return this.handler.onHeaders(statusCode, headers, resume, statusText);
|
|
9395
9395
|
}
|
|
9396
9396
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
9397
|
-
const
|
|
9397
|
+
const path9 = search ? `${pathname}${search}` : pathname;
|
|
9398
9398
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
9399
|
-
this.opts.path =
|
|
9399
|
+
this.opts.path = path9;
|
|
9400
9400
|
this.opts.origin = origin;
|
|
9401
9401
|
this.opts.maxRedirections = 0;
|
|
9402
9402
|
this.opts.query = null;
|
|
@@ -10636,7 +10636,7 @@ var require_client = __commonJS({
|
|
|
10636
10636
|
writeH2(client, client[kHTTP2Session], request);
|
|
10637
10637
|
return;
|
|
10638
10638
|
}
|
|
10639
|
-
const { body, method, path:
|
|
10639
|
+
const { body, method, path: path9, host, upgrade, headers, blocking, reset } = request;
|
|
10640
10640
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
10641
10641
|
if (body && typeof body.read === "function") {
|
|
10642
10642
|
body.read(0);
|
|
@@ -10686,7 +10686,7 @@ var require_client = __commonJS({
|
|
|
10686
10686
|
if (blocking) {
|
|
10687
10687
|
socket[kBlocking] = true;
|
|
10688
10688
|
}
|
|
10689
|
-
let header = `${method} ${
|
|
10689
|
+
let header = `${method} ${path9} HTTP/1.1\r
|
|
10690
10690
|
`;
|
|
10691
10691
|
if (typeof host === "string") {
|
|
10692
10692
|
header += `host: ${host}\r
|
|
@@ -10749,7 +10749,7 @@ upgrade: ${upgrade}\r
|
|
|
10749
10749
|
return true;
|
|
10750
10750
|
}
|
|
10751
10751
|
function writeH2(client, session, request) {
|
|
10752
|
-
const { body, method, path:
|
|
10752
|
+
const { body, method, path: path9, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
|
|
10753
10753
|
let headers;
|
|
10754
10754
|
if (typeof reqHeaders === "string")
|
|
10755
10755
|
headers = Request[kHTTP2CopyHeaders](reqHeaders.trim());
|
|
@@ -10795,7 +10795,7 @@ upgrade: ${upgrade}\r
|
|
|
10795
10795
|
});
|
|
10796
10796
|
return true;
|
|
10797
10797
|
}
|
|
10798
|
-
headers[HTTP2_HEADER_PATH] =
|
|
10798
|
+
headers[HTTP2_HEADER_PATH] = path9;
|
|
10799
10799
|
headers[HTTP2_HEADER_SCHEME] = "https";
|
|
10800
10800
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
10801
10801
|
if (body && typeof body.read === "function") {
|
|
@@ -13036,20 +13036,20 @@ var require_mock_utils = __commonJS({
|
|
|
13036
13036
|
}
|
|
13037
13037
|
return true;
|
|
13038
13038
|
}
|
|
13039
|
-
function safeUrl(
|
|
13040
|
-
if (typeof
|
|
13041
|
-
return
|
|
13039
|
+
function safeUrl(path9) {
|
|
13040
|
+
if (typeof path9 !== "string") {
|
|
13041
|
+
return path9;
|
|
13042
13042
|
}
|
|
13043
|
-
const pathSegments =
|
|
13043
|
+
const pathSegments = path9.split("?");
|
|
13044
13044
|
if (pathSegments.length !== 2) {
|
|
13045
|
-
return
|
|
13045
|
+
return path9;
|
|
13046
13046
|
}
|
|
13047
13047
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
13048
13048
|
qp.sort();
|
|
13049
13049
|
return [...pathSegments, qp.toString()].join("?");
|
|
13050
13050
|
}
|
|
13051
|
-
function matchKey(mockDispatch2, { path:
|
|
13052
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
13051
|
+
function matchKey(mockDispatch2, { path: path9, method, body, headers }) {
|
|
13052
|
+
const pathMatch = matchValue(mockDispatch2.path, path9);
|
|
13053
13053
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
13054
13054
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
13055
13055
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -13067,7 +13067,7 @@ var require_mock_utils = __commonJS({
|
|
|
13067
13067
|
function getMockDispatch(mockDispatches, key) {
|
|
13068
13068
|
const basePath = key.query ? buildURL(key.path, key.query) : key.path;
|
|
13069
13069
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
13070
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
13070
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path9 }) => matchValue(safeUrl(path9), resolvedPath));
|
|
13071
13071
|
if (matchedMockDispatches.length === 0) {
|
|
13072
13072
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
13073
13073
|
}
|
|
@@ -13104,9 +13104,9 @@ var require_mock_utils = __commonJS({
|
|
|
13104
13104
|
}
|
|
13105
13105
|
}
|
|
13106
13106
|
function buildKey(opts) {
|
|
13107
|
-
const { path:
|
|
13107
|
+
const { path: path9, method, body, headers, query } = opts;
|
|
13108
13108
|
return {
|
|
13109
|
-
path:
|
|
13109
|
+
path: path9,
|
|
13110
13110
|
method,
|
|
13111
13111
|
body,
|
|
13112
13112
|
headers,
|
|
@@ -13555,10 +13555,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
13555
13555
|
}
|
|
13556
13556
|
format(pendingInterceptors) {
|
|
13557
13557
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
13558
|
-
({ method, path:
|
|
13558
|
+
({ method, path: path9, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
13559
13559
|
Method: method,
|
|
13560
13560
|
Origin: origin,
|
|
13561
|
-
Path:
|
|
13561
|
+
Path: path9,
|
|
13562
13562
|
"Status code": statusCode,
|
|
13563
13563
|
Persistent: persist ? "\u2705" : "\u274C",
|
|
13564
13564
|
Invocations: timesInvoked,
|
|
@@ -18183,8 +18183,8 @@ var require_util6 = __commonJS({
|
|
|
18183
18183
|
}
|
|
18184
18184
|
}
|
|
18185
18185
|
}
|
|
18186
|
-
function validateCookiePath(
|
|
18187
|
-
for (const char of
|
|
18186
|
+
function validateCookiePath(path9) {
|
|
18187
|
+
for (const char of path9) {
|
|
18188
18188
|
const code = char.charCodeAt(0);
|
|
18189
18189
|
if (code < 33 || char === ";") {
|
|
18190
18190
|
throw new Error("Invalid cookie path");
|
|
@@ -19864,11 +19864,11 @@ var require_undici = __commonJS({
|
|
|
19864
19864
|
if (typeof opts.path !== "string") {
|
|
19865
19865
|
throw new InvalidArgumentError("invalid opts.path");
|
|
19866
19866
|
}
|
|
19867
|
-
let
|
|
19867
|
+
let path9 = opts.path;
|
|
19868
19868
|
if (!opts.path.startsWith("/")) {
|
|
19869
|
-
|
|
19869
|
+
path9 = `/${path9}`;
|
|
19870
19870
|
}
|
|
19871
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
19871
|
+
url2 = new URL(util.parseOrigin(url2).origin + path9);
|
|
19872
19872
|
} else {
|
|
19873
19873
|
if (!opts) {
|
|
19874
19874
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -23147,8 +23147,8 @@ var require_utils4 = __commonJS({
|
|
|
23147
23147
|
}
|
|
23148
23148
|
return ind;
|
|
23149
23149
|
}
|
|
23150
|
-
function removeDotSegments(
|
|
23151
|
-
let input =
|
|
23150
|
+
function removeDotSegments(path9) {
|
|
23151
|
+
let input = path9;
|
|
23152
23152
|
const output = [];
|
|
23153
23153
|
let nextSlash = -1;
|
|
23154
23154
|
let len = 0;
|
|
@@ -23347,8 +23347,8 @@ var require_schemes = __commonJS({
|
|
|
23347
23347
|
wsComponent.secure = void 0;
|
|
23348
23348
|
}
|
|
23349
23349
|
if (wsComponent.resourceName) {
|
|
23350
|
-
const [
|
|
23351
|
-
wsComponent.path =
|
|
23350
|
+
const [path9, query] = wsComponent.resourceName.split("?");
|
|
23351
|
+
wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
|
|
23352
23352
|
wsComponent.query = query;
|
|
23353
23353
|
wsComponent.resourceName = void 0;
|
|
23354
23354
|
}
|
|
@@ -27535,12 +27535,12 @@ var require_dist = __commonJS({
|
|
|
27535
27535
|
throw new Error(`Unknown format "${name}"`);
|
|
27536
27536
|
return f;
|
|
27537
27537
|
};
|
|
27538
|
-
function addFormats(ajv, list,
|
|
27538
|
+
function addFormats(ajv, list, fs6, exportName) {
|
|
27539
27539
|
var _a2;
|
|
27540
27540
|
var _b2;
|
|
27541
27541
|
(_a2 = (_b2 = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
27542
27542
|
for (const f of list)
|
|
27543
|
-
ajv.addFormat(f,
|
|
27543
|
+
ajv.addFormat(f, fs6[f]);
|
|
27544
27544
|
}
|
|
27545
27545
|
module2.exports = exports = formatsPlugin;
|
|
27546
27546
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -30522,11 +30522,11 @@ var parser = new YargsParser({
|
|
|
30522
30522
|
resolve: import_path.resolve,
|
|
30523
30523
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
30524
30524
|
// we can exercise all the lines below:
|
|
30525
|
-
require: (
|
|
30525
|
+
require: (path9) => {
|
|
30526
30526
|
if (typeof require !== "undefined") {
|
|
30527
|
-
return require(
|
|
30528
|
-
} else if (
|
|
30529
|
-
return JSON.parse((0, import_fs.readFileSync)(
|
|
30527
|
+
return require(path9);
|
|
30528
|
+
} else if (path9.match(/\.json$/)) {
|
|
30529
|
+
return JSON.parse((0, import_fs.readFileSync)(path9, "utf8"));
|
|
30530
30530
|
} else {
|
|
30531
30531
|
throw Error("only .json config files are supported in ESM");
|
|
30532
30532
|
}
|
|
@@ -31114,7 +31114,7 @@ var import_node_os = __toESM(require("node:os"));
|
|
|
31114
31114
|
var import_node_path = __toESM(require("node:path"));
|
|
31115
31115
|
|
|
31116
31116
|
// package.json
|
|
31117
|
-
var version = "1.
|
|
31117
|
+
var version = "1.3.0";
|
|
31118
31118
|
var package_default = {
|
|
31119
31119
|
name: "onlineornot",
|
|
31120
31120
|
version,
|
|
@@ -31183,7 +31183,7 @@ var package_default = {
|
|
|
31183
31183
|
var INSTALL_DIR = process.env.ONLINEORNOT_INSTALL_DIR || import_node_path.default.join(import_node_os.default.homedir(), ".onlineornot");
|
|
31184
31184
|
var PENDING_DIR = import_node_path.default.join(INSTALL_DIR, "pending");
|
|
31185
31185
|
var VERSION_FILE = import_node_path.default.join(INSTALL_DIR, "version");
|
|
31186
|
-
var REPO = "OnlineOrNot/onlineornot
|
|
31186
|
+
var REPO = "OnlineOrNot/onlineornot";
|
|
31187
31187
|
function isSEA() {
|
|
31188
31188
|
return process.env.ONLINEORNOT_SEA === "true";
|
|
31189
31189
|
}
|
|
@@ -35364,16 +35364,16 @@ function processSegment(segment, parts) {
|
|
|
35364
35364
|
}
|
|
35365
35365
|
return true;
|
|
35366
35366
|
}
|
|
35367
|
-
function parsePath(
|
|
35368
|
-
if (typeof
|
|
35369
|
-
throw new TypeError(`Expected a string, got ${typeof
|
|
35367
|
+
function parsePath(path9) {
|
|
35368
|
+
if (typeof path9 !== "string") {
|
|
35369
|
+
throw new TypeError(`Expected a string, got ${typeof path9}`);
|
|
35370
35370
|
}
|
|
35371
35371
|
const parts = [];
|
|
35372
35372
|
let currentSegment = "";
|
|
35373
35373
|
let currentPart = "start";
|
|
35374
35374
|
let isEscaping = false;
|
|
35375
35375
|
let position = 0;
|
|
35376
|
-
for (const character of
|
|
35376
|
+
for (const character of path9) {
|
|
35377
35377
|
position++;
|
|
35378
35378
|
if (isEscaping) {
|
|
35379
35379
|
currentSegment += character;
|
|
@@ -35483,13 +35483,13 @@ function parsePath(path8) {
|
|
|
35483
35483
|
}
|
|
35484
35484
|
return parts;
|
|
35485
35485
|
}
|
|
35486
|
-
function normalizePath(
|
|
35487
|
-
if (typeof
|
|
35488
|
-
return parsePath(
|
|
35486
|
+
function normalizePath(path9) {
|
|
35487
|
+
if (typeof path9 === "string") {
|
|
35488
|
+
return parsePath(path9);
|
|
35489
35489
|
}
|
|
35490
|
-
if (Array.isArray(
|
|
35490
|
+
if (Array.isArray(path9)) {
|
|
35491
35491
|
const normalized = [];
|
|
35492
|
-
for (const [index, segment] of
|
|
35492
|
+
for (const [index, segment] of path9.entries()) {
|
|
35493
35493
|
if (typeof segment !== "string" && typeof segment !== "number") {
|
|
35494
35494
|
throw new TypeError(`Expected a string or number for path segment at index ${index}, got ${typeof segment}`);
|
|
35495
35495
|
}
|
|
@@ -35509,11 +35509,11 @@ function normalizePath(path8) {
|
|
|
35509
35509
|
}
|
|
35510
35510
|
return [];
|
|
35511
35511
|
}
|
|
35512
|
-
function getProperty(object,
|
|
35513
|
-
if (!isObject(object) || typeof
|
|
35512
|
+
function getProperty(object, path9, value) {
|
|
35513
|
+
if (!isObject(object) || typeof path9 !== "string" && !Array.isArray(path9)) {
|
|
35514
35514
|
return value === void 0 ? object : value;
|
|
35515
35515
|
}
|
|
35516
|
-
const pathArray = normalizePath(
|
|
35516
|
+
const pathArray = normalizePath(path9);
|
|
35517
35517
|
if (pathArray.length === 0) {
|
|
35518
35518
|
return value;
|
|
35519
35519
|
}
|
|
@@ -35529,12 +35529,12 @@ function getProperty(object, path8, value) {
|
|
|
35529
35529
|
}
|
|
35530
35530
|
return object === void 0 ? value : object;
|
|
35531
35531
|
}
|
|
35532
|
-
function setProperty(object,
|
|
35533
|
-
if (!isObject(object) || typeof
|
|
35532
|
+
function setProperty(object, path9, value) {
|
|
35533
|
+
if (!isObject(object) || typeof path9 !== "string" && !Array.isArray(path9)) {
|
|
35534
35534
|
return object;
|
|
35535
35535
|
}
|
|
35536
35536
|
const root = object;
|
|
35537
|
-
const pathArray = normalizePath(
|
|
35537
|
+
const pathArray = normalizePath(path9);
|
|
35538
35538
|
if (pathArray.length === 0) {
|
|
35539
35539
|
return object;
|
|
35540
35540
|
}
|
|
@@ -35551,11 +35551,11 @@ function setProperty(object, path8, value) {
|
|
|
35551
35551
|
}
|
|
35552
35552
|
return root;
|
|
35553
35553
|
}
|
|
35554
|
-
function deleteProperty(object,
|
|
35555
|
-
if (!isObject(object) || typeof
|
|
35554
|
+
function deleteProperty(object, path9) {
|
|
35555
|
+
if (!isObject(object) || typeof path9 !== "string" && !Array.isArray(path9)) {
|
|
35556
35556
|
return false;
|
|
35557
35557
|
}
|
|
35558
|
-
const pathArray = normalizePath(
|
|
35558
|
+
const pathArray = normalizePath(path9);
|
|
35559
35559
|
if (pathArray.length === 0) {
|
|
35560
35560
|
return false;
|
|
35561
35561
|
}
|
|
@@ -35575,11 +35575,11 @@ function deleteProperty(object, path8) {
|
|
|
35575
35575
|
}
|
|
35576
35576
|
}
|
|
35577
35577
|
}
|
|
35578
|
-
function hasProperty(object,
|
|
35579
|
-
if (!isObject(object) || typeof
|
|
35578
|
+
function hasProperty(object, path9) {
|
|
35579
|
+
if (!isObject(object) || typeof path9 !== "string" && !Array.isArray(path9)) {
|
|
35580
35580
|
return false;
|
|
35581
35581
|
}
|
|
35582
|
-
const pathArray = normalizePath(
|
|
35582
|
+
const pathArray = normalizePath(path9);
|
|
35583
35583
|
if (pathArray.length === 0) {
|
|
35584
35584
|
return false;
|
|
35585
35585
|
}
|
|
@@ -38161,15 +38161,242 @@ async function logoutHandler() {
|
|
|
38161
38161
|
logger.log("Successfully logged out.");
|
|
38162
38162
|
}
|
|
38163
38163
|
|
|
38164
|
-
// src/
|
|
38164
|
+
// src/uninstall.ts
|
|
38165
38165
|
var import_promises2 = __toESM(require("node:fs/promises"));
|
|
38166
38166
|
var import_node_os6 = __toESM(require("node:os"));
|
|
38167
38167
|
var import_node_path7 = __toESM(require("node:path"));
|
|
38168
38168
|
var INSTALL_DIR2 = process.env.ONLINEORNOT_INSTALL_DIR || import_node_path7.default.join(import_node_os6.default.homedir(), ".onlineornot");
|
|
38169
|
-
var
|
|
38169
|
+
var CONFIG_DIR = import_node_path7.default.join(
|
|
38170
|
+
process.env.XDG_CONFIG_HOME || import_node_path7.default.join(import_node_os6.default.homedir(), ".config"),
|
|
38171
|
+
"onlineornot"
|
|
38172
|
+
);
|
|
38170
38173
|
function isSEA2() {
|
|
38171
38174
|
return process.env.ONLINEORNOT_SEA === "true";
|
|
38172
38175
|
}
|
|
38176
|
+
function shortenPath(p) {
|
|
38177
|
+
const home = import_node_os6.default.homedir();
|
|
38178
|
+
if (p.startsWith(home)) {
|
|
38179
|
+
return p.replace(home, "~");
|
|
38180
|
+
}
|
|
38181
|
+
return p;
|
|
38182
|
+
}
|
|
38183
|
+
async function getDirectorySize(dir) {
|
|
38184
|
+
let total = 0;
|
|
38185
|
+
const walk = async (current) => {
|
|
38186
|
+
const entries = await import_promises2.default.readdir(current, { withFileTypes: true }).catch(() => []);
|
|
38187
|
+
for (const entry of entries) {
|
|
38188
|
+
const full = import_node_path7.default.join(current, entry.name);
|
|
38189
|
+
if (entry.isDirectory()) {
|
|
38190
|
+
await walk(full);
|
|
38191
|
+
} else if (entry.isFile()) {
|
|
38192
|
+
const stat = await import_promises2.default.stat(full).catch(() => null);
|
|
38193
|
+
if (stat)
|
|
38194
|
+
total += stat.size;
|
|
38195
|
+
}
|
|
38196
|
+
}
|
|
38197
|
+
};
|
|
38198
|
+
await walk(dir);
|
|
38199
|
+
return total;
|
|
38200
|
+
}
|
|
38201
|
+
function formatSize(bytes) {
|
|
38202
|
+
if (bytes < 1024)
|
|
38203
|
+
return `${bytes} B`;
|
|
38204
|
+
if (bytes < 1024 * 1024)
|
|
38205
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
38206
|
+
if (bytes < 1024 * 1024 * 1024)
|
|
38207
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
38208
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
38209
|
+
}
|
|
38210
|
+
async function getShellConfigFile() {
|
|
38211
|
+
const shell = import_node_path7.default.basename(process.env.SHELL || "bash");
|
|
38212
|
+
const home = import_node_os6.default.homedir();
|
|
38213
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || import_node_path7.default.join(home, ".config");
|
|
38214
|
+
const configFiles = {
|
|
38215
|
+
fish: [import_node_path7.default.join(xdgConfig, "fish", "config.fish")],
|
|
38216
|
+
zsh: [
|
|
38217
|
+
import_node_path7.default.join(home, ".zshrc"),
|
|
38218
|
+
import_node_path7.default.join(home, ".zshenv"),
|
|
38219
|
+
import_node_path7.default.join(xdgConfig, "zsh", ".zshrc"),
|
|
38220
|
+
import_node_path7.default.join(xdgConfig, "zsh", ".zshenv")
|
|
38221
|
+
],
|
|
38222
|
+
bash: [
|
|
38223
|
+
import_node_path7.default.join(home, ".bashrc"),
|
|
38224
|
+
import_node_path7.default.join(home, ".bash_profile"),
|
|
38225
|
+
import_node_path7.default.join(home, ".profile"),
|
|
38226
|
+
import_node_path7.default.join(xdgConfig, "bash", ".bashrc"),
|
|
38227
|
+
import_node_path7.default.join(xdgConfig, "bash", ".bash_profile")
|
|
38228
|
+
],
|
|
38229
|
+
ash: [import_node_path7.default.join(home, ".ashrc"), import_node_path7.default.join(home, ".profile")],
|
|
38230
|
+
sh: [import_node_path7.default.join(home, ".profile")]
|
|
38231
|
+
};
|
|
38232
|
+
const candidates = configFiles[shell] || configFiles.bash;
|
|
38233
|
+
for (const file of candidates) {
|
|
38234
|
+
const exists = await import_promises2.default.access(file).then(() => true).catch(() => false);
|
|
38235
|
+
if (!exists)
|
|
38236
|
+
continue;
|
|
38237
|
+
const content = await import_promises2.default.readFile(file, "utf-8").catch(() => "");
|
|
38238
|
+
if (content.includes("# onlineornot") || content.includes(".onlineornot/bin")) {
|
|
38239
|
+
return file;
|
|
38240
|
+
}
|
|
38241
|
+
}
|
|
38242
|
+
return null;
|
|
38243
|
+
}
|
|
38244
|
+
async function cleanShellConfig(file) {
|
|
38245
|
+
const content = await import_promises2.default.readFile(file, "utf-8");
|
|
38246
|
+
const lines = content.split("\n");
|
|
38247
|
+
const filtered = [];
|
|
38248
|
+
let skip = false;
|
|
38249
|
+
for (const line of lines) {
|
|
38250
|
+
const trimmed = line.trim();
|
|
38251
|
+
if (trimmed === "# onlineornot") {
|
|
38252
|
+
skip = true;
|
|
38253
|
+
continue;
|
|
38254
|
+
}
|
|
38255
|
+
if (skip) {
|
|
38256
|
+
skip = false;
|
|
38257
|
+
if (trimmed.includes(".onlineornot/bin") || trimmed.includes("fish_add_path")) {
|
|
38258
|
+
continue;
|
|
38259
|
+
}
|
|
38260
|
+
}
|
|
38261
|
+
if (trimmed.startsWith("export PATH=") && trimmed.includes(".onlineornot/bin") || trimmed.startsWith("fish_add_path") && trimmed.includes(".onlineornot")) {
|
|
38262
|
+
continue;
|
|
38263
|
+
}
|
|
38264
|
+
filtered.push(line);
|
|
38265
|
+
}
|
|
38266
|
+
while (filtered.length > 0 && filtered[filtered.length - 1].trim() === "") {
|
|
38267
|
+
filtered.pop();
|
|
38268
|
+
}
|
|
38269
|
+
const output = filtered.join("\n") + "\n";
|
|
38270
|
+
await import_promises2.default.writeFile(file, output);
|
|
38271
|
+
}
|
|
38272
|
+
function uninstallOptions(yargs) {
|
|
38273
|
+
return yargs.option("keep-config", {
|
|
38274
|
+
alias: "c",
|
|
38275
|
+
type: "boolean",
|
|
38276
|
+
describe: "Keep configuration files (credentials)",
|
|
38277
|
+
default: false
|
|
38278
|
+
}).option("keep-data", {
|
|
38279
|
+
alias: "d",
|
|
38280
|
+
type: "boolean",
|
|
38281
|
+
describe: "Keep data directory",
|
|
38282
|
+
default: false
|
|
38283
|
+
}).option("dry-run", {
|
|
38284
|
+
type: "boolean",
|
|
38285
|
+
describe: "Show what would be removed without removing",
|
|
38286
|
+
default: false
|
|
38287
|
+
}).option("force", {
|
|
38288
|
+
alias: "f",
|
|
38289
|
+
type: "boolean",
|
|
38290
|
+
describe: "Skip confirmation prompts",
|
|
38291
|
+
default: false
|
|
38292
|
+
});
|
|
38293
|
+
}
|
|
38294
|
+
async function uninstallHandler(args) {
|
|
38295
|
+
logger.log("");
|
|
38296
|
+
logger.log(source_default.bold("Uninstall OnlineOrNot CLI"));
|
|
38297
|
+
logger.log("");
|
|
38298
|
+
const installMethod = isSEA2() ? "curl" : "npm";
|
|
38299
|
+
logger.log(source_default.dim(`Installation method: ${installMethod}`));
|
|
38300
|
+
logger.log("");
|
|
38301
|
+
const shellConfig = installMethod === "curl" ? await getShellConfigFile() : null;
|
|
38302
|
+
const binaryPath = installMethod === "curl" ? process.execPath : null;
|
|
38303
|
+
logger.log("The following will be removed:");
|
|
38304
|
+
logger.log("");
|
|
38305
|
+
const installDirExists = await import_promises2.default.access(INSTALL_DIR2).then(() => true).catch(() => false);
|
|
38306
|
+
if (installDirExists) {
|
|
38307
|
+
const size = await getDirectorySize(INSTALL_DIR2);
|
|
38308
|
+
const status = args.keepData ? source_default.dim(" (keeping)") : "";
|
|
38309
|
+
const prefix = args.keepData ? "\u25CB" : "\u2713";
|
|
38310
|
+
logger.log(
|
|
38311
|
+
` ${prefix} Data: ${shortenPath(INSTALL_DIR2)} ${source_default.dim(`(${formatSize(size)})`)}${status}`
|
|
38312
|
+
);
|
|
38313
|
+
}
|
|
38314
|
+
const configDirExists = await import_promises2.default.access(CONFIG_DIR).then(() => true).catch(() => false);
|
|
38315
|
+
if (configDirExists) {
|
|
38316
|
+
const size = await getDirectorySize(CONFIG_DIR);
|
|
38317
|
+
const status = args.keepConfig ? source_default.dim(" (keeping)") : "";
|
|
38318
|
+
const prefix = args.keepConfig ? "\u25CB" : "\u2713";
|
|
38319
|
+
logger.log(
|
|
38320
|
+
` ${prefix} Config: ${shortenPath(CONFIG_DIR)} ${source_default.dim(`(${formatSize(size)})`)}${status}`
|
|
38321
|
+
);
|
|
38322
|
+
}
|
|
38323
|
+
if (binaryPath) {
|
|
38324
|
+
logger.log(` \u2713 Binary: ${shortenPath(binaryPath)}`);
|
|
38325
|
+
}
|
|
38326
|
+
if (shellConfig) {
|
|
38327
|
+
logger.log(` \u2713 Shell PATH in ${shortenPath(shellConfig)}`);
|
|
38328
|
+
}
|
|
38329
|
+
if (installMethod !== "curl") {
|
|
38330
|
+
logger.log(` \u2713 Package: npm uninstall -g onlineornot`);
|
|
38331
|
+
}
|
|
38332
|
+
logger.log("");
|
|
38333
|
+
if (args.dryRun) {
|
|
38334
|
+
logger.warn("Dry run - no changes made");
|
|
38335
|
+
return;
|
|
38336
|
+
}
|
|
38337
|
+
if (!args.force) {
|
|
38338
|
+
const readline = await import("node:readline");
|
|
38339
|
+
const rl = readline.createInterface({
|
|
38340
|
+
input: process.stdin,
|
|
38341
|
+
output: process.stdout
|
|
38342
|
+
});
|
|
38343
|
+
const answer = await new Promise((resolve5) => {
|
|
38344
|
+
rl.question("Are you sure you want to uninstall? (y/N) ", resolve5);
|
|
38345
|
+
});
|
|
38346
|
+
rl.close();
|
|
38347
|
+
if (answer.toLowerCase() !== "y") {
|
|
38348
|
+
logger.log("Cancelled");
|
|
38349
|
+
return;
|
|
38350
|
+
}
|
|
38351
|
+
}
|
|
38352
|
+
logger.log("");
|
|
38353
|
+
if (installDirExists && !args.keepData) {
|
|
38354
|
+
logger.log(`Removing ${shortenPath(INSTALL_DIR2)}...`);
|
|
38355
|
+
await import_promises2.default.rm(INSTALL_DIR2, { recursive: true, force: true });
|
|
38356
|
+
logger.log(source_default.green("\u2713") + " Removed data directory");
|
|
38357
|
+
} else if (installDirExists && args.keepData) {
|
|
38358
|
+
logger.log(source_default.dim(`Skipping data (--keep-data)`));
|
|
38359
|
+
}
|
|
38360
|
+
if (configDirExists && !args.keepConfig) {
|
|
38361
|
+
logger.log(`Removing ${shortenPath(CONFIG_DIR)}...`);
|
|
38362
|
+
await import_promises2.default.rm(CONFIG_DIR, { recursive: true, force: true });
|
|
38363
|
+
logger.log(source_default.green("\u2713") + " Removed config directory");
|
|
38364
|
+
} else if (configDirExists && args.keepConfig) {
|
|
38365
|
+
logger.log(source_default.dim(`Skipping config (--keep-config)`));
|
|
38366
|
+
}
|
|
38367
|
+
if (shellConfig) {
|
|
38368
|
+
logger.log(`Cleaning ${shortenPath(shellConfig)}...`);
|
|
38369
|
+
await cleanShellConfig(shellConfig);
|
|
38370
|
+
logger.log(source_default.green("\u2713") + " Cleaned shell config");
|
|
38371
|
+
}
|
|
38372
|
+
if (installMethod === "curl" && binaryPath) {
|
|
38373
|
+
logger.log("");
|
|
38374
|
+
logger.log("To finish removing the binary, run:");
|
|
38375
|
+
logger.log(source_default.dim(` rm "${binaryPath}"`));
|
|
38376
|
+
const binDir = import_node_path7.default.dirname(binaryPath);
|
|
38377
|
+
if (binDir.includes(".onlineornot")) {
|
|
38378
|
+
logger.log(source_default.dim(` rmdir "${binDir}" 2>/dev/null`));
|
|
38379
|
+
}
|
|
38380
|
+
}
|
|
38381
|
+
if (installMethod !== "curl") {
|
|
38382
|
+
logger.log("");
|
|
38383
|
+
logger.log("To finish uninstalling, run:");
|
|
38384
|
+
logger.log(source_default.dim(" npm uninstall -g onlineornot"));
|
|
38385
|
+
}
|
|
38386
|
+
logger.log("");
|
|
38387
|
+
logger.log(source_default.green("\u2713") + " Thank you for using OnlineOrNot!");
|
|
38388
|
+
logger.log("");
|
|
38389
|
+
}
|
|
38390
|
+
|
|
38391
|
+
// src/update.ts
|
|
38392
|
+
var import_promises3 = __toESM(require("node:fs/promises"));
|
|
38393
|
+
var import_node_os7 = __toESM(require("node:os"));
|
|
38394
|
+
var import_node_path8 = __toESM(require("node:path"));
|
|
38395
|
+
var INSTALL_DIR3 = process.env.ONLINEORNOT_INSTALL_DIR || import_node_path8.default.join(import_node_os7.default.homedir(), ".onlineornot");
|
|
38396
|
+
var REPO2 = "OnlineOrNot/onlineornot";
|
|
38397
|
+
function isSEA3() {
|
|
38398
|
+
return process.env.ONLINEORNOT_SEA === "true";
|
|
38399
|
+
}
|
|
38173
38400
|
function isNewerVersion2(a, b) {
|
|
38174
38401
|
const partsA = a.replace(/^v/, "").split(".").map(Number);
|
|
38175
38402
|
const partsB = b.replace(/^v/, "").split(".").map(Number);
|
|
@@ -38198,7 +38425,7 @@ function updateOptions(yargs) {
|
|
|
38198
38425
|
}
|
|
38199
38426
|
async function updateHandler(args) {
|
|
38200
38427
|
const currentVersion = package_default.version;
|
|
38201
|
-
if (!
|
|
38428
|
+
if (!isSEA3()) {
|
|
38202
38429
|
logger.log("");
|
|
38203
38430
|
logger.log(
|
|
38204
38431
|
`You're running OnlineOrNot CLI via ${source_default.cyan("npm/pnpm")}, not as a standalone binary.`
|
|
@@ -38269,22 +38496,22 @@ async function updateHandler(args) {
|
|
|
38269
38496
|
const buffer = await binaryResponse.arrayBuffer();
|
|
38270
38497
|
const currentBinary = process.execPath;
|
|
38271
38498
|
const tempPath = `${currentBinary}.new`;
|
|
38272
|
-
await
|
|
38273
|
-
await
|
|
38499
|
+
await import_promises3.default.writeFile(tempPath, Buffer.from(buffer));
|
|
38500
|
+
await import_promises3.default.chmod(tempPath, 493);
|
|
38274
38501
|
const backupPath = `${currentBinary}.backup`;
|
|
38275
38502
|
try {
|
|
38276
|
-
await
|
|
38277
|
-
await
|
|
38278
|
-
await
|
|
38503
|
+
await import_promises3.default.copyFile(currentBinary, backupPath);
|
|
38504
|
+
await import_promises3.default.rename(tempPath, currentBinary);
|
|
38505
|
+
await import_promises3.default.rm(backupPath, { force: true });
|
|
38279
38506
|
} catch (error) {
|
|
38280
38507
|
try {
|
|
38281
|
-
await
|
|
38508
|
+
await import_promises3.default.rename(backupPath, currentBinary);
|
|
38282
38509
|
} catch {
|
|
38283
38510
|
}
|
|
38284
38511
|
throw error;
|
|
38285
38512
|
}
|
|
38286
|
-
await
|
|
38287
|
-
await
|
|
38513
|
+
await import_promises3.default.mkdir(INSTALL_DIR3, { recursive: true });
|
|
38514
|
+
await import_promises3.default.writeFile(import_node_path8.default.join(INSTALL_DIR3, "version"), latestVersion);
|
|
38288
38515
|
logger.log("");
|
|
38289
38516
|
logger.log(
|
|
38290
38517
|
source_default.green("\u2713") + ` Updated to version ${source_default.cyan(latestVersion)}!`
|
|
@@ -38478,6 +38705,12 @@ function createCLIParser(argv) {
|
|
|
38478
38705
|
updateOptions,
|
|
38479
38706
|
updateHandler
|
|
38480
38707
|
);
|
|
38708
|
+
onlineornot.command(
|
|
38709
|
+
"uninstall",
|
|
38710
|
+
"\u{1F5D1}\uFE0F Uninstall OnlineOrNot CLI and remove all related files",
|
|
38711
|
+
uninstallOptions,
|
|
38712
|
+
uninstallHandler
|
|
38713
|
+
);
|
|
38481
38714
|
onlineornot.exitProcess(false);
|
|
38482
38715
|
return onlineornot;
|
|
38483
38716
|
}
|