@craftspace/cli 0.6.0 → 0.8.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/dist/index.js +8 -2
- package/dist/machine.js +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19898,7 +19898,7 @@ var SaveWorkstationBodySchema = external_exports.object({
|
|
|
19898
19898
|
var WorkstationResponseSchema = external_exports.object({ workstation: WorkstationSchema });
|
|
19899
19899
|
|
|
19900
19900
|
// ../../shared/dist/machines/machine.js
|
|
19901
|
-
var CLI_VERSION = "0.
|
|
19901
|
+
var CLI_VERSION = "0.8.0";
|
|
19902
19902
|
var CLI_PACKAGE = "@craftspace/cli";
|
|
19903
19903
|
var CLI_INSTALL = `npm i -g ${CLI_PACKAGE}`;
|
|
19904
19904
|
var MACHINE_BEAT_INTERVAL_MS = 15e3;
|
|
@@ -23247,6 +23247,8 @@ ${ui.ok(`Signed in as ${signed.ownerName}. This machine is ${ui.name(signed.name
|
|
|
23247
23247
|
},
|
|
23248
23248
|
schema: MachineBeatResponseSchema
|
|
23249
23249
|
});
|
|
23250
|
+
if (answer.cli !== null && isNewer(answer.cli.version))
|
|
23251
|
+
updateWanted = answer.cli.version;
|
|
23250
23252
|
await writeAuthorizedKeys(answer.authorizedKeys);
|
|
23251
23253
|
const building2 = buildEnvironment(answer.environment, say);
|
|
23252
23254
|
if (say === void 0)
|
|
@@ -23266,8 +23268,10 @@ ${ui.ok(`Signed in as ${signed.ownerName}. This machine is ${ui.name(signed.name
|
|
|
23266
23268
|
let busy = false;
|
|
23267
23269
|
let checkedAt = 0;
|
|
23268
23270
|
for (; ; ) {
|
|
23269
|
-
|
|
23271
|
+
const asked = updateWanted !== null && Date.now() - checkedAt > UPDATE_AFTER_BEAT_MS;
|
|
23272
|
+
if (!busy && (asked || failures > 2 || Date.now() - checkedAt > UPDATE_EVERY_MS)) {
|
|
23270
23273
|
checkedAt = Date.now();
|
|
23274
|
+
updateWanted = null;
|
|
23271
23275
|
const moved = await update.toLatest();
|
|
23272
23276
|
if (moved !== null) {
|
|
23273
23277
|
process.stderr.write(`craftspace ${CLI_VERSION} -> ${moved}, restarting
|
|
@@ -23776,6 +23780,7 @@ var MAX_BACKOFF_MS = 12e4;
|
|
|
23776
23780
|
var KEYS_BEGIN = "# craftspace begin";
|
|
23777
23781
|
var KEYS_END = "# craftspace end";
|
|
23778
23782
|
var UPDATE_EVERY_MS = 6 * 60 * 60 * 1e3;
|
|
23783
|
+
var UPDATE_AFTER_BEAT_MS = 5 * 60 * 1e3;
|
|
23779
23784
|
var BEATING = "beating every 15s, outbound only, and keeps this set up";
|
|
23780
23785
|
var PORTABLE_TERMS = /* @__PURE__ */ new Set([
|
|
23781
23786
|
"ansi",
|
|
@@ -23796,6 +23801,7 @@ var LINGER_LINE = `sudo loginctl enable-linger ${os5.userInfo().username}`;
|
|
|
23796
23801
|
var DEFAULT_URL = process.env.CRAFTSPACE_URL ?? "https://craftspace.app";
|
|
23797
23802
|
var PROBE_EVERY_MS = 3e5;
|
|
23798
23803
|
var REBUILD_AFTER_MS = 216e5;
|
|
23804
|
+
var updateWanted = null;
|
|
23799
23805
|
var probed = null;
|
|
23800
23806
|
var building = false;
|
|
23801
23807
|
var reports = /* @__PURE__ */ new Map();
|
package/dist/machine.js
CHANGED
|
@@ -10,7 +10,7 @@ import { probe } from './probe.js';
|
|
|
10
10
|
import { runner } from './run.js';
|
|
11
11
|
import { setup } from './setup.js';
|
|
12
12
|
import { ui } from './ui.js';
|
|
13
|
-
import { update } from './update.js';
|
|
13
|
+
import { isNewer, update } from './update.js';
|
|
14
14
|
const run = promisify(execFile);
|
|
15
15
|
export const machine = {
|
|
16
16
|
home() {
|
|
@@ -95,6 +95,8 @@ export const machine = {
|
|
|
95
95
|
},
|
|
96
96
|
schema: MachineBeatResponseSchema,
|
|
97
97
|
});
|
|
98
|
+
if (answer.cli !== null && isNewer(answer.cli.version))
|
|
99
|
+
updateWanted = answer.cli.version;
|
|
98
100
|
await writeAuthorizedKeys(answer.authorizedKeys);
|
|
99
101
|
const building = buildEnvironment(answer.environment, say);
|
|
100
102
|
if (say === undefined)
|
|
@@ -118,8 +120,10 @@ export const machine = {
|
|
|
118
120
|
let busy = false;
|
|
119
121
|
let checkedAt = 0;
|
|
120
122
|
for (;;) {
|
|
121
|
-
|
|
123
|
+
const asked = updateWanted !== null && Date.now() - checkedAt > UPDATE_AFTER_BEAT_MS;
|
|
124
|
+
if (!busy && (asked || failures > 2 || Date.now() - checkedAt > UPDATE_EVERY_MS)) {
|
|
122
125
|
checkedAt = Date.now();
|
|
126
|
+
updateWanted = null;
|
|
123
127
|
const moved = await update.toLatest();
|
|
124
128
|
if (moved !== null) {
|
|
125
129
|
process.stderr.write(`craftspace ${CLI_VERSION} -> ${moved}, restarting\n`);
|
|
@@ -618,6 +622,7 @@ const MAX_BACKOFF_MS = 120_000;
|
|
|
618
622
|
const KEYS_BEGIN = '# craftspace begin';
|
|
619
623
|
const KEYS_END = '# craftspace end';
|
|
620
624
|
const UPDATE_EVERY_MS = 6 * 60 * 60 * 1_000;
|
|
625
|
+
const UPDATE_AFTER_BEAT_MS = 5 * 60 * 1_000;
|
|
621
626
|
const BEATING = 'beating every 15s, outbound only, and keeps this set up';
|
|
622
627
|
const PORTABLE_TERMS = new Set([
|
|
623
628
|
'ansi',
|
|
@@ -638,6 +643,7 @@ const LINGER_LINE = `sudo loginctl enable-linger ${os.userInfo().username}`;
|
|
|
638
643
|
const DEFAULT_URL = process.env.CRAFTSPACE_URL ?? 'https://craftspace.app';
|
|
639
644
|
const PROBE_EVERY_MS = 300_000;
|
|
640
645
|
const REBUILD_AFTER_MS = 21_600_000;
|
|
646
|
+
let updateWanted = null;
|
|
641
647
|
let probed = null;
|
|
642
648
|
let building = false;
|
|
643
649
|
const reports = new Map();
|