openship 0.6.0 → 0.6.1

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.
@@ -6,7 +6,7 @@ import {
6
6
  importMigratedSites,
7
7
  waitForApiHealth,
8
8
  waitForEdgeRunning
9
- } from "./chunk-VE2YOK4I.js";
9
+ } from "./chunk-2NZSUXOB.js";
10
10
  import "./chunk-XZYFZ6A5.js";
11
11
  import "./chunk-PDW4L3NV.js";
12
12
  import "./chunk-QWHBRY2K.js";
@@ -15,12 +15,12 @@ import "./chunk-42WQABXM.js";
15
15
  import "./chunk-DRK3MEDS.js";
16
16
  import "./chunk-3NQQXMDR.js";
17
17
  import "./chunk-TWJCLD4W.js";
18
- import "./chunk-PSZSKEPA.js";
18
+ import "./chunk-RRJJGVKE.js";
19
19
  import "./chunk-WNWQBB7F.js";
20
20
  import "./chunk-2GWYYHOR.js";
21
21
  import "./chunk-RXQBD4ZY.js";
22
- import "./chunk-EP2TNALB.js";
23
- import "./chunk-GUQ3QCJ7.js";
22
+ import "./chunk-3NZICQHF.js";
23
+ import "./chunk-IOT5ZX23.js";
24
24
  import "./chunk-ONKEYSMY.js";
25
25
  import "./chunk-ZWLDLTJP.js";
26
26
  import "./chunk-3FYIXVX5.js";
@@ -29,15 +29,15 @@ import "./chunk-IXM5245F.js";
29
29
  import "./chunk-JIMUYEKN.js";
30
30
  import "./chunk-IW2UKBVF.js";
31
31
  import "./chunk-VDDMADOF.js";
32
- import "./chunk-B3CE2OMR.js";
32
+ import "./chunk-UC7YIEHT.js";
33
33
  import "./chunk-6ODUBKUB.js";
34
34
  import "./chunk-ZCFVHA25.js";
35
35
  import "./chunk-6FH4AXVY.js";
36
- import "./chunk-QEH4QUBX.js";
36
+ import "./chunk-EW6KB2J7.js";
37
37
  import "./chunk-I3DPMTSF.js";
38
38
  import "./chunk-VZ2ZHPS2.js";
39
39
  import "./chunk-3LDWWY7U.js";
40
- import "./chunk-OGY63DGD.js";
40
+ import "./chunk-YIPMDGG6.js";
41
41
  import "./chunk-ZFJXPCQP.js";
42
42
  import "./chunk-OTLSJYAC.js";
43
43
  import "./chunk-PXKCZB2I.js";
@@ -10,14 +10,14 @@ import {
10
10
  resolveEdgeImage,
11
11
  setDefaultEdgeImage,
12
12
  verifyEdgeServing
13
- } from "./chunk-GUQ3QCJ7.js";
13
+ } from "./chunk-IOT5ZX23.js";
14
14
  import "./chunk-IW2UKBVF.js";
15
15
  import "./chunk-ZCFVHA25.js";
16
- import "./chunk-QEH4QUBX.js";
16
+ import "./chunk-EW6KB2J7.js";
17
17
  import "./chunk-I3DPMTSF.js";
18
18
  import "./chunk-VZ2ZHPS2.js";
19
19
  import "./chunk-3LDWWY7U.js";
20
- import "./chunk-OGY63DGD.js";
20
+ import "./chunk-YIPMDGG6.js";
21
21
  import "./chunk-ZFJXPCQP.js";
22
22
  import "./chunk-OTLSJYAC.js";
23
23
  import "./chunk-PXKCZB2I.js";
@@ -8,7 +8,7 @@ import {
8
8
  createExecutor,
9
9
  createHostExecutor,
10
10
  hostControlDisabled
11
- } from "./chunk-B3CE2OMR.js";
11
+ } from "./chunk-UC7YIEHT.js";
12
12
  import "./chunk-6ODUBKUB.js";
13
13
  import "./chunk-ZCFVHA25.js";
14
14
  import {
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
  sourceBuildDir,
47
47
  storedApiPort,
48
48
  storedDashboardPort
49
- } from "./chunk-VE2YOK4I.js";
49
+ } from "./chunk-2NZSUXOB.js";
50
50
  import "./chunk-XZYFZ6A5.js";
51
51
  import "./chunk-PDW4L3NV.js";
52
52
  import "./chunk-QWHBRY2K.js";
@@ -55,11 +55,11 @@ import "./chunk-42WQABXM.js";
55
55
  import "./chunk-DRK3MEDS.js";
56
56
  import "./chunk-3NQQXMDR.js";
57
57
  import "./chunk-TWJCLD4W.js";
58
- import "./chunk-PSZSKEPA.js";
58
+ import "./chunk-RRJJGVKE.js";
59
59
  import "./chunk-WNWQBB7F.js";
60
60
  import "./chunk-2GWYYHOR.js";
61
61
  import "./chunk-RXQBD4ZY.js";
62
- import "./chunk-EP2TNALB.js";
62
+ import "./chunk-3NZICQHF.js";
63
63
  import {
64
64
  beginEdgeTakeover,
65
65
  collectProxyCerts,
@@ -74,7 +74,7 @@ import {
74
74
  rollbackEdgeTakeover,
75
75
  scanImportableSites,
76
76
  unreachableStaticRoots
77
- } from "./chunk-GUQ3QCJ7.js";
77
+ } from "./chunk-IOT5ZX23.js";
78
78
  import "./chunk-ONKEYSMY.js";
79
79
  import "./chunk-ZWLDLTJP.js";
80
80
  import "./chunk-3FYIXVX5.js";
@@ -83,13 +83,13 @@ import "./chunk-IXM5245F.js";
83
83
  import "./chunk-JIMUYEKN.js";
84
84
  import "./chunk-IW2UKBVF.js";
85
85
  import "./chunk-VDDMADOF.js";
86
- import "./chunk-B3CE2OMR.js";
86
+ import "./chunk-UC7YIEHT.js";
87
87
  import "./chunk-6ODUBKUB.js";
88
88
  import "./chunk-ZCFVHA25.js";
89
89
  import {
90
90
  LocalExecutor
91
91
  } from "./chunk-6FH4AXVY.js";
92
- import "./chunk-QEH4QUBX.js";
92
+ import "./chunk-EW6KB2J7.js";
93
93
  import "./chunk-I3DPMTSF.js";
94
94
  import {
95
95
  edgeCrashReason,
@@ -97,7 +97,7 @@ import {
97
97
  ourEdgeContainerRunning
98
98
  } from "./chunk-VZ2ZHPS2.js";
99
99
  import "./chunk-3LDWWY7U.js";
100
- import "./chunk-OGY63DGD.js";
100
+ import "./chunk-YIPMDGG6.js";
101
101
  import "./chunk-ZFJXPCQP.js";
102
102
  import {
103
103
  CLOUD_DASHBOARD_URL,
@@ -268,7 +268,7 @@ function getDashboardUrl(name) {
268
268
  }
269
269
 
270
270
  // src/lib/api-client.ts
271
- var USER_AGENT = `openship-cli/${true ? "0.6.0" : "dev"}`;
271
+ var USER_AGENT = `openship-cli/${true ? "0.6.1" : "dev"}`;
272
272
  function getApiUrl2() {
273
273
  return `${getApiUrl()}/api`;
274
274
  }
@@ -2278,7 +2278,7 @@ async function runForeground(opts, source) {
2278
2278
  const uiSpinner = ora("Preparing the dashboard\u2026").start();
2279
2279
  try {
2280
2280
  const bundle = await ensureDashboard({
2281
- tag: source ? "local" : opts.uiVersion || `v${"0.6.0"}`,
2281
+ tag: source ? "local" : opts.uiVersion || `v${"0.6.1"}`,
2282
2282
  onProgress: (received, total) => {
2283
2283
  if (total) {
2284
2284
  uiSpinner.text = `Downloading dashboard\u2026 ${Math.round(received / total * 100)}%`;
@@ -6908,7 +6908,7 @@ var installCommand = new Command25("install").description("Download and install
6908
6908
  });
6909
6909
 
6910
6910
  // src/commands/update.ts
6911
- import { Command as Command26 } from "commander";
6911
+ import { Command as Command26, Option } from "commander";
6912
6912
  import { spawnSync as spawnSync10 } from "child_process";
6913
6913
 
6914
6914
  // src/lib/cli-payload.ts
@@ -7124,7 +7124,41 @@ async function ensureNodeRuntime(onLog) {
7124
7124
  return { node: await fetchVendoredNode(onLog), source: "vendored" };
7125
7125
  }
7126
7126
 
7127
+ // src/lib/update-reexec.ts
7128
+ var REEXEC_ENV = "OPENSHIP_UPDATE_REEXEC";
7129
+ function isReexecChild(env = process.env) {
7130
+ return env[REEXEC_ENV] === "1";
7131
+ }
7132
+ function applyOnlyArgv(selfArgs, json) {
7133
+ return [...selfArgs, ...json ? ["--json"] : [], "update", "--apply-only"];
7134
+ }
7135
+
7127
7136
  // src/commands/update.ts
7137
+ async function runReconcile() {
7138
+ if (readInstallMethod() === "compose") {
7139
+ const applied = await composeUpdate();
7140
+ if (isJsonMode()) printJson({ reconciled: applied, method: "compose" });
7141
+ else if (applied) ok("Compose stack regenerated, images pulled, services recreated.");
7142
+ else err("Bringing the compose stack up failed. Re-run `openship update`, or `openship up` to retry.");
7143
+ if (!applied) process.exitCode = 1;
7144
+ return applied;
7145
+ }
7146
+ const { restarted } = restart();
7147
+ if (isJsonMode()) printJson({ reconciled: restarted, method: "bare" });
7148
+ else if (restarted) ok("Restarted the service onto the new version.");
7149
+ else ok("Restart the server to run the new version: openship up");
7150
+ return restarted;
7151
+ }
7152
+ function reexecApply() {
7153
+ if (isReexecChild()) return { spawned: false, status: null };
7154
+ const { runtime, args } = selfInvocation();
7155
+ const argv = applyOnlyArgv(args, isJsonMode());
7156
+ const res = spawnSync10(runtime, argv, {
7157
+ stdio: "inherit",
7158
+ env: { ...process.env, [REEXEC_ENV]: "1" }
7159
+ });
7160
+ return { spawned: res.error == null, status: res.status };
7161
+ }
7128
7162
  async function runSourceUpdate(source, opts) {
7129
7163
  const current = shortSha(source.dir);
7130
7164
  const remote = remoteSha(source.repo, source.ref);
@@ -7154,18 +7188,24 @@ async function runSourceUpdate(source, opts) {
7154
7188
  process.exitCode = 1;
7155
7189
  return;
7156
7190
  }
7191
+ info(`Rebuilt from source (${source.ref} @ ${sha}).`);
7192
+ const r = reexecApply();
7193
+ if (r.spawned) {
7194
+ process.exitCode = r.status ?? 0;
7195
+ return;
7196
+ }
7157
7197
  const { restarted } = restart();
7158
7198
  if (isJsonMode()) {
7159
7199
  printJson({ updated: true, source: true, ref: source.ref, from: current, to: sha, restarted });
7160
7200
  } else if (restarted) {
7161
- ok(`Rebuilt from source (${source.ref} @ ${sha}) and restarted the service.`);
7201
+ ok(`Restarted the service \u2014 you're on ${sha}.`);
7162
7202
  } else {
7163
- ok(`Rebuilt from source (${source.ref} @ ${sha}). Restart to run it: openship up`);
7203
+ ok(`Restart to run it: openship up`);
7164
7204
  }
7165
7205
  }
7166
7206
  var REINSTALL_HINT = "curl -fsSL https://get.openship.io | sh";
7167
7207
  async function runTarballUpdate(install, opts) {
7168
- const current = "0.6.0";
7208
+ const current = "0.6.1";
7169
7209
  let latest;
7170
7210
  try {
7171
7211
  latest = (await resolveLatestTag()).replace(/^v/, "");
@@ -7206,6 +7246,11 @@ async function runTarballUpdate(install, opts) {
7206
7246
  return;
7207
7247
  }
7208
7248
  writeCliInstall({ ...install, tag, runtime });
7249
+ const applyViaChild = reexecApply();
7250
+ if (applyViaChild.spawned) {
7251
+ process.exitCode = applyViaChild.status ?? 0;
7252
+ return;
7253
+ }
7209
7254
  if (readInstallMethod() === "compose") {
7210
7255
  const applied = await composeUpdate(latest);
7211
7256
  if (isJsonMode()) {
@@ -7232,12 +7277,16 @@ function detectPackageManager2(override) {
7232
7277
  const hasBun = spawnSync10("bun", ["--version"], { stdio: "ignore" }).status === 0;
7233
7278
  return hasBun ? "bun" : "npm";
7234
7279
  }
7235
- var updateCommand = new Command26("update").description("Update the Openship CLI + bundled server to the latest release").option("--check", "Only report the current + latest version; don't install").option("--via <manager>", "Package manager to update with: bun | npm").option("--rebuild", "From-source installs: rebuild even if already at the remote tip").action(async (opts) => {
7280
+ var updateCommand = new Command26("update").description("Update the Openship CLI + bundled server to the latest release").option("--check", "Only report the current + latest version; don't install").option("--via <manager>", "Package manager to update with: bun | npm").option("--rebuild", "From-source installs: rebuild even if already at the remote tip").addOption(new Option("--apply-only").hideHelp()).action(async (opts) => {
7281
+ if (opts.applyOnly) {
7282
+ await runReconcile();
7283
+ return;
7284
+ }
7236
7285
  const source = readSourceInstall();
7237
7286
  if (source) return runSourceUpdate(source, opts);
7238
7287
  const cliInstall = readCliInstall();
7239
7288
  if (cliInstall?.method === "tarball") return runTarballUpdate(cliInstall, opts);
7240
- const current = "0.6.0";
7289
+ const current = "0.6.1";
7241
7290
  let latest;
7242
7291
  try {
7243
7292
  latest = (await resolveLatestTag()).replace(/^v/, "");
@@ -7271,6 +7320,11 @@ var updateCommand = new Command26("update").description("Update the Openship CLI
7271
7320
  process.exitCode = 1;
7272
7321
  return;
7273
7322
  }
7323
+ const applyViaChild = reexecApply();
7324
+ if (applyViaChild.spawned) {
7325
+ process.exitCode = applyViaChild.status ?? 0;
7326
+ return;
7327
+ }
7274
7328
  if (readInstallMethod() === "compose") {
7275
7329
  const applied = await composeUpdate(latest);
7276
7330
  if (isJsonMode()) {
@@ -7823,7 +7877,7 @@ async function runWizard() {
7823
7877
  }
7824
7878
  }
7825
7879
  }
7826
- const uiTag = `v${"0.6.0"}`;
7880
+ const uiTag = `v${"0.6.1"}`;
7827
7881
  if (method === "bare") {
7828
7882
  const dl = spinner4();
7829
7883
  dl.start("Pulling the Openship dist from GitHub");
@@ -7891,7 +7945,7 @@ async function runWizard() {
7891
7945
  dashboardPort,
7892
7946
  publicUrl,
7893
7947
  trustProxy: behindProxy,
7894
- version: "0.6.0",
7948
+ version: "0.6.1",
7895
7949
  noHostControl: !allowHostControl
7896
7950
  })) {
7897
7951
  cancel4("Couldn't fetch the Openship images \u2014 nothing on this box was changed.");
@@ -7916,7 +7970,7 @@ async function runWizard() {
7916
7970
  dashboardPort,
7917
7971
  publicUrl,
7918
7972
  trustProxy: behindProxy,
7919
- version: "0.6.0",
7973
+ version: "0.6.1",
7920
7974
  noHostControl: !allowHostControl
7921
7975
  });
7922
7976
  if (!up.ok) {
@@ -8258,7 +8312,7 @@ function attachCompletion(program2) {
8258
8312
 
8259
8313
  // src/index.ts
8260
8314
  var program = new Command28();
8261
- program.name("openship").description("Openship CLI \u2014 install, run, and manage Openship from your terminal").version("0.6.0").option("--json", "Machine-readable JSON output (stdout data only)").hook("preAction", (thisCommand) => {
8315
+ program.name("openship").description("Openship CLI \u2014 install, run, and manage Openship from your terminal").version("0.6.1").option("--json", "Machine-readable JSON output (stdout data only)").hook("preAction", (thisCommand) => {
8262
8316
  if (thisCommand.opts().json) setJsonMode(true);
8263
8317
  }).action(async () => {
8264
8318
  const installed = serviceStatus().installed || readInstallMethod() === "compose";
@@ -11,11 +11,11 @@ import {
11
11
  renderProxyOptions,
12
12
  renderProxyTlsOptions,
13
13
  summarizeCertbotFailure
14
- } from "./chunk-QEH4QUBX.js";
14
+ } from "./chunk-EW6KB2J7.js";
15
15
  import "./chunk-I3DPMTSF.js";
16
16
  import "./chunk-VZ2ZHPS2.js";
17
17
  import "./chunk-3LDWWY7U.js";
18
- import "./chunk-OGY63DGD.js";
18
+ import "./chunk-YIPMDGG6.js";
19
19
  import "./chunk-ZFJXPCQP.js";
20
20
  import "./chunk-OTLSJYAC.js";
21
21
  import "./chunk-PXKCZB2I.js";
@@ -38,7 +38,7 @@ import {
38
38
  ensureOpenRestyConfig,
39
39
  luaSourceAvailable,
40
40
  parseNginxVersion
41
- } from "./chunk-OGY63DGD.js";
41
+ } from "./chunk-YIPMDGG6.js";
42
42
  import "./chunk-ZFJXPCQP.js";
43
43
  import "./chunk-OTLSJYAC.js";
44
44
  import "./chunk-PXKCZB2I.js";