@haakco/hostingctl 1.0.369 → 1.0.370
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/dist/main.js +2 -37
- package/dist/main.js.map +1 -1
- package/package.json +6 -6
package/dist/main.js
CHANGED
|
@@ -36925,7 +36925,7 @@ function writeUpdateState(state, env = process.env) {
|
|
|
36925
36925
|
}
|
|
36926
36926
|
//#endregion
|
|
36927
36927
|
//#region src/version.ts
|
|
36928
|
-
var VERSION = "
|
|
36928
|
+
var VERSION = "0.0.0-dev";
|
|
36929
36929
|
//#endregion
|
|
36930
36930
|
//#region src/commands/update.ts
|
|
36931
36931
|
/**
|
|
@@ -37000,7 +37000,7 @@ var update = {
|
|
|
37000
37000
|
}, process.env);
|
|
37001
37001
|
return {
|
|
37002
37002
|
...known,
|
|
37003
|
-
current: after ?? "
|
|
37003
|
+
current: after ?? "0.0.0-dev",
|
|
37004
37004
|
latest: after ?? latest,
|
|
37005
37005
|
upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
|
|
37006
37006
|
action: "run",
|
|
@@ -37238,13 +37238,6 @@ function startsWith(path, prefix) {
|
|
|
37238
37238
|
return prefix.every((one, index) => path[index] === one);
|
|
37239
37239
|
}
|
|
37240
37240
|
/**
|
|
37241
|
-
* How long the notice waits for the lock that guards the state file.
|
|
37242
|
-
*
|
|
37243
|
-
* Short, because the notice runs beside a command a person is waiting on: a machine that is busy updating
|
|
37244
|
-
* its session is not a reason to hold this one up, and the check simply happens again next time.
|
|
37245
|
-
*/
|
|
37246
|
-
var NOTICE_LOCK_WAIT_MS = 150;
|
|
37247
|
-
/**
|
|
37248
37241
|
* Tell the client, once a day, that a newer version is published.
|
|
37249
37242
|
*
|
|
37250
37243
|
* The notice goes to stderr, so it never mixes into a command's output, and it names `hostingctl update`
|
|
@@ -37253,34 +37246,6 @@ var NOTICE_LOCK_WAIT_MS = 150;
|
|
|
37253
37246
|
*/
|
|
37254
37247
|
async function printUpdateNotice(options) {
|
|
37255
37248
|
if (options.json) return;
|
|
37256
|
-
const env = options.env ?? process.env;
|
|
37257
|
-
if (isSet(env.CI)) return;
|
|
37258
|
-
if (isSet(env.HOSTINGCTL_NO_UPDATE_CHECK)) return;
|
|
37259
|
-
const state = readUpdateState(env);
|
|
37260
|
-
const now = Date.now();
|
|
37261
|
-
if (state !== null && now - state.checkedAt < 864e5) return;
|
|
37262
|
-
const latest = await latestVersion();
|
|
37263
|
-
try {
|
|
37264
|
-
mkdirSync(credentialDirectory(env), {
|
|
37265
|
-
recursive: true,
|
|
37266
|
-
mode: 448
|
|
37267
|
-
});
|
|
37268
|
-
await withCredentialLock(async () => {
|
|
37269
|
-
writeUpdateState({
|
|
37270
|
-
method: state?.method ?? null,
|
|
37271
|
-
entry: state?.entry ?? "",
|
|
37272
|
-
checkedAt: now,
|
|
37273
|
-
latest
|
|
37274
|
-
}, env);
|
|
37275
|
-
}, env, { waitMs: NOTICE_LOCK_WAIT_MS });
|
|
37276
|
-
} catch {}
|
|
37277
|
-
if (latest === null) return;
|
|
37278
|
-
if (!isNewerVersion(latest, "1.0.369")) return;
|
|
37279
|
-
process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
|
|
37280
|
-
}
|
|
37281
|
-
/** Whether an environment variable is set to something, which is how CI and the opt-out are read. */
|
|
37282
|
-
function isSet(value) {
|
|
37283
|
-
return value !== void 0 && value !== "";
|
|
37284
37249
|
}
|
|
37285
37250
|
//#endregion
|
|
37286
37251
|
//#region src/main.ts
|