@todesktop/cli 1.7.0-1 → 1.7.0-3

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/cli.js CHANGED
@@ -4178,7 +4178,7 @@ function BuildPicker({
4178
4178
  state: state.state,
4179
4179
  updateState
4180
4180
  });
4181
- }, [buildId, configPath, state.state]);
4181
+ }, []);
4182
4182
  onInput((input, key) => {
4183
4183
  if (key.escape && ["show-builds", "loading"].includes(state.state)) {
4184
4184
  exit();
@@ -4411,7 +4411,8 @@ function OsProgress({
4411
4411
  const colors = {
4412
4412
  progress: "white",
4413
4413
  error: "red",
4414
- done: "green"
4414
+ done: "green",
4415
+ skipped: "yellow"
4415
4416
  };
4416
4417
  const text = progress.message + (progress.state === "progress" ? "..." : "");
4417
4418
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
@@ -4436,6 +4437,8 @@ function SmokeTestView({
4436
4437
  case "build-error": {
4437
4438
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BuildError, { build: state.build, message: (_a = state.error) == null ? void 0 : _a.message });
4438
4439
  }
4440
+ case "canceled":
4441
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ink36.Text, { children: "Smoke test canceled." });
4439
4442
  case "complete":
4440
4443
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ink36.Text, { bold: true, color: "greenBright", children: "Smoke test passed." });
4441
4444
  case "error":
@@ -4493,6 +4496,52 @@ function isBuildTestable(build) {
4493
4496
  return false;
4494
4497
  }
4495
4498
  }
4499
+ function isTestRunning(build) {
4500
+ const { isFinished } = makeProgress(build);
4501
+ return !isFinished;
4502
+ }
4503
+ function makeProgress(build) {
4504
+ var _a, _b, _c, _d, _e, _f;
4505
+ const def = {
4506
+ progress: 0,
4507
+ state: "progress",
4508
+ shouldSkip: false
4509
+ };
4510
+ const linux = {
4511
+ ...((_a = build.smokeTest) == null ? void 0 : _a.linux) || def,
4512
+ shouldSkip: ((_b = build.linux) == null ? void 0 : _b.shouldSkip) || false
4513
+ };
4514
+ const mac = {
4515
+ ...((_c = build.smokeTest) == null ? void 0 : _c.mac) || def,
4516
+ shouldSkip: ((_d = build.mac) == null ? void 0 : _d.shouldSkip) || false
4517
+ };
4518
+ const windows = {
4519
+ ...((_e = build.smokeTest) == null ? void 0 : _e.windows) || def,
4520
+ shouldSkip: ((_f = build.windows) == null ? void 0 : _f.shouldSkip) || false
4521
+ };
4522
+ const platforms = [linux, mac, windows].filter(
4523
+ (p) => !p.shouldSkip && p.state !== "skipped"
4524
+ );
4525
+ const isFinished = build.smokeTest.isCanceled || platforms.every((p) => p.state !== "progress");
4526
+ let totalState = "progress";
4527
+ if (build.smokeTest.isCanceled) {
4528
+ totalState = "canceled";
4529
+ } else if (platforms.every((p) => p.state === "done")) {
4530
+ totalState = "done";
4531
+ } else if (isFinished && platforms.some((p) => p.state === "error")) {
4532
+ totalState = "error";
4533
+ }
4534
+ return {
4535
+ isFinished,
4536
+ linux,
4537
+ mac,
4538
+ windows,
4539
+ total: {
4540
+ error: platforms.filter((p) => p.state === "error").map((p) => p.message).join("\n\n"),
4541
+ state: totalState
4542
+ }
4543
+ };
4544
+ }
4496
4545
  function validateBuild(build) {
4497
4546
  if (build.status !== "succeeded") {
4498
4547
  throw new SmokeError(
@@ -4604,46 +4653,6 @@ async function waitUntilFinished({
4604
4653
  );
4605
4654
  });
4606
4655
  }
4607
- function makeProgress(build) {
4608
- var _a, _b, _c, _d, _e, _f;
4609
- const def = {
4610
- progress: 0,
4611
- state: "progress",
4612
- shouldSkip: false
4613
- };
4614
- const linux = {
4615
- ...((_a = build.smokeTest) == null ? void 0 : _a.linux) || def,
4616
- shouldSkip: ((_b = build.linux) == null ? void 0 : _b.shouldSkip) || false
4617
- };
4618
- const mac = {
4619
- ...((_c = build.smokeTest) == null ? void 0 : _c.mac) || def,
4620
- shouldSkip: ((_d = build.mac) == null ? void 0 : _d.shouldSkip) || false
4621
- };
4622
- const windows = {
4623
- ...((_e = build.smokeTest) == null ? void 0 : _e.windows) || def,
4624
- shouldSkip: ((_f = build.windows) == null ? void 0 : _f.shouldSkip) || false
4625
- };
4626
- const platforms = [linux, mac, windows].filter(
4627
- (p) => !p.shouldSkip
4628
- );
4629
- const isFinished = platforms.every((p) => p.state !== "progress");
4630
- let totalState = "progress";
4631
- if (platforms.every((p) => p.state === "done")) {
4632
- totalState = "done";
4633
- } else if (isFinished && platforms.some((p) => p.state === "error")) {
4634
- totalState = "error";
4635
- }
4636
- return {
4637
- isFinished,
4638
- linux,
4639
- mac,
4640
- windows,
4641
- total: {
4642
- error: platforms.filter((p) => p.state === "error").map((p) => p.message).join("\n\n"),
4643
- state: totalState
4644
- }
4645
- };
4646
- }
4647
4656
 
4648
4657
  // src/commands/smoke-test/SmokeTestCommand.tsx
4649
4658
  var import_jsx_runtime42 = require("react/jsx-runtime");
@@ -4683,7 +4692,7 @@ function SmokeTestContainer({
4683
4692
  const abortSignal = abortController.signal;
4684
4693
  (0, import_react22.useEffect)(() => {
4685
4694
  smokeTestWorkflow({ abortSignal, buildId, configPath, updateState });
4686
- }, [buildId, configPath]);
4695
+ }, []);
4687
4696
  function updateState(changes) {
4688
4697
  setState((previousState) => ({ ...previousState, ...changes }));
4689
4698
  if (["build-error", "complete", "progress-error"].includes(changes.state)) {
@@ -4718,7 +4727,7 @@ async function smokeTestWorkflow({
4718
4727
  const build = await fetchBuild({ appId, buildId, userId });
4719
4728
  updateState({ appId, build, userId });
4720
4729
  validateBuild(build);
4721
- if (!abortSignal.aborted) {
4730
+ if (!abortSignal.aborted && !isTestRunning(build)) {
4722
4731
  await queueSmokeTest({ appId, buildId, nodeVersion, userId });
4723
4732
  }
4724
4733
  updateState({ state: "progress" });
@@ -4728,9 +4737,13 @@ async function smokeTestWorkflow({
4728
4737
  userId,
4729
4738
  onProgress: (progress) => updateState({ progress })
4730
4739
  });
4731
- updateState({
4732
- state: total.state == "error" ? "progress-error" : "complete"
4733
- });
4740
+ const stateMap = {
4741
+ done: "complete",
4742
+ progress: "complete",
4743
+ error: "progress-error",
4744
+ canceled: "canceled"
4745
+ };
4746
+ updateState({ state: stateMap[total.state] });
4734
4747
  } catch (error) {
4735
4748
  updateState({ error, state: error.type || "error" });
4736
4749
  }
@@ -4740,10 +4753,7 @@ function buildCanBeCanceled(build) {
4740
4753
  if ((_a = build == null ? void 0 : build.smokeTest) == null ? void 0 : _a.isCanceled) {
4741
4754
  return false;
4742
4755
  }
4743
- if (!((_b = build == null ? void 0 : build.smokeTest) == null ? void 0 : _b.buildServerExecutionId)) {
4744
- return false;
4745
- }
4746
- return true;
4756
+ return Boolean((_b = build == null ? void 0 : build.smokeTest) == null ? void 0 : _b.buildServerExecutionId);
4747
4757
  }
4748
4758
  function isCancelable(state) {
4749
4759
  const cancelableStates = ["loading", "progress"];
@@ -4810,7 +4820,7 @@ var package_default = {
4810
4820
  access: "public"
4811
4821
  },
4812
4822
  name: "@todesktop/cli",
4813
- version: "1.7.0-0",
4823
+ version: "1.7.0-2",
4814
4824
  license: "MIT",
4815
4825
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
4816
4826
  homepage: "https://todesktop.com/cli",
@@ -4890,7 +4900,7 @@ var package_default = {
4890
4900
  "xdg-basedir": "^4.0.0"
4891
4901
  },
4892
4902
  devDependencies: {
4893
- "@todesktop/shared": "^7.178.0",
4903
+ "@todesktop/shared": "^7.179.0",
4894
4904
  "@types/bunyan": "^1.8.6",
4895
4905
  "@types/react": "^18.0.26",
4896
4906
  "@typescript-eslint/eslint-plugin": "^5.46.1",