@todesktop/cli 1.17.0 → 1.18.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/cli.js CHANGED
@@ -192,6 +192,11 @@ var firebaseApp = (0, import_app.initializeApp)({
192
192
  });
193
193
  var auth = (0, import_auth.getAuth)(firebaseApp);
194
194
  var db = (0, import_firestore.getFirestore)(firebaseApp);
195
+ var _a;
196
+ var [host, port] = ((_a = environmentVariables.TODESKTOP_CLI_FIRESTORE_HOST) == null ? void 0 : _a.split(":")) || [];
197
+ if (host && port) {
198
+ (0, import_firestore.connectFirestoreEmulator)(db, host, Number.parseInt(port, 10));
199
+ }
195
200
  var currentUser = () => {
196
201
  return auth.currentUser;
197
202
  };
@@ -199,7 +204,7 @@ var signInWithCustomToken = async (token) => {
199
204
  return (0, import_auth.signInWithCustomToken)(auth, token);
200
205
  };
201
206
  var onUserAuth = (handler) => (0, import_auth.onAuthStateChanged)(auth, (user) => {
202
- handler(user != null ? user : {});
207
+ handler(user ?? {});
203
208
  });
204
209
  var firestore_default = db;
205
210
 
@@ -382,10 +387,10 @@ function fixMacUrl(url) {
382
387
  // src/components/BuildCompleteMessage.tsx
383
388
  var import_jsx_runtime = require("react/jsx-runtime");
384
389
  var BuildCompleteMessage = ({ build }) => {
385
- var _a;
390
+ var _a2;
386
391
  const exit = useExit_default();
387
392
  let url = build.standardUniversalDownloadUrl;
388
- if (process.platform === "darwin" && ((_a = build.mac) == null ? void 0 : _a.standardDownloadUrl)) {
393
+ if (process.platform === "darwin" && ((_a2 = build.mac) == null ? void 0 : _a2.standardDownloadUrl)) {
389
394
  url = fixMacUrl(build.mac.standardDownloadUrl);
390
395
  }
391
396
  logForCI_default(`Build complete! ${url}`);
@@ -567,18 +572,18 @@ var import_ink5 = require("ink");
567
572
  var import_react3 = require("react");
568
573
 
569
574
  // src/utilities/CliError.ts
570
- var CliError = class extends Error {
575
+ var CliError = class _CliError extends Error {
571
576
  constructor(message2, { cause, type = "error" } = {}) {
572
577
  super(message2, { cause });
573
578
  this.type = type;
574
579
  }
575
580
  static from(e, type = "error") {
576
581
  if (e instanceof Error) {
577
- return new CliError(e.message, { cause: e, type });
582
+ return new _CliError(e.message, { cause: e, type });
578
583
  } else if (typeof e === "string") {
579
- return new CliError(e, { type });
584
+ return new _CliError(e, { type });
580
585
  } else {
581
- return new CliError(JSON.stringify(e), { type });
586
+ return new _CliError(JSON.stringify(e), { type });
582
587
  }
583
588
  }
584
589
  };
@@ -649,8 +654,9 @@ var app = (0, import_app2.initializeApp)({
649
654
  appId: env.TODESKTOP_CLI_FIREBASE_ID
650
655
  });
651
656
  var functions = (0, import_functions.getFunctions)(app);
652
- if (env.TODESKTOP_CLI_ENV === "development") {
653
- const firebaseUrl = new URL(env.TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE);
657
+ var firebaseFunctionsBase = env.TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE || "";
658
+ if (firebaseFunctionsBase.includes("localhost")) {
659
+ const firebaseUrl = new URL(firebaseFunctionsBase);
654
660
  (0, import_functions.connectFunctionsEmulator)(
655
661
  functions,
656
662
  firebaseUrl.hostname,
@@ -1018,9 +1024,13 @@ async function postToFirebaseFunction_default(functionName, body = {}, config2 =
1018
1024
  { scrub: { functionName, body, config: config2 } },
1019
1025
  "postToFirebaseFunction"
1020
1026
  );
1027
+ let baseUrl = TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE;
1028
+ if (!baseUrl.endsWith("/")) {
1029
+ baseUrl += "/";
1030
+ }
1021
1031
  try {
1022
1032
  const response = await import_axios.default.post(
1023
- `${TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE}${functionName}`,
1033
+ `${baseUrl}${functionName}`,
1024
1034
  body,
1025
1035
  config2
1026
1036
  );
@@ -1659,6 +1669,7 @@ var schema_default = {
1659
1669
  }
1660
1670
  }
1661
1671
  },
1672
+ bytenode: { $ref: "#/definitions/bytenodeConfigProperty" },
1662
1673
  asar: { $ref: "#/definitions/asarProperty" },
1663
1674
  asarUnpack: { $ref: "#/definitions/asarUnpackProperty" },
1664
1675
  buildVersion: { $ref: "#/definitions/buildVersionProperty" },
@@ -1751,6 +1762,34 @@ var schema_default = {
1751
1762
  examples: ["com.microsoft.word"],
1752
1763
  default: "auto-generated"
1753
1764
  },
1765
+ bytenodeConfigProperty: {
1766
+ type: "object",
1767
+ additionalProperties: false,
1768
+ description: "Compile selected source files to .jsc using Bytenode during the build. Provide glob patterns relative to your appPath.",
1769
+ default: { enabled: false },
1770
+ properties: {
1771
+ enabled: {
1772
+ type: "boolean",
1773
+ default: false,
1774
+ description: "Enable Bytenode compilation."
1775
+ },
1776
+ files: {
1777
+ type: "array",
1778
+ items: { type: "string", minLength: 1 },
1779
+ minItems: 1,
1780
+ description: "Glob patterns relative to appPath for files to compile to Bytenode."
1781
+ }
1782
+ },
1783
+ allOf: [
1784
+ {
1785
+ if: {
1786
+ properties: { enabled: { const: true } },
1787
+ required: ["enabled"]
1788
+ },
1789
+ then: { required: ["files"] }
1790
+ }
1791
+ ]
1792
+ },
1754
1793
  appFilesProperty: {
1755
1794
  type: "array",
1756
1795
  description: "This option allows you to decide which files get uploaded to be built on the ToDesktop servers. By default, all files in your app path are included in your app, except for `node_modules` and `.git`. Dependencies are installed on our build servers as there could be platform-specific postinstall steps.",
@@ -2434,7 +2473,7 @@ var schema_default = {
2434
2473
  description: "The path to your application's Windows desktop icon. It must be an ICO, ICNS, or PNG.",
2435
2474
  examples: ["./icon.ico"],
2436
2475
  file: {
2437
- extensions: ["icns", "png", "icon"],
2476
+ extensions: ["icns", "png", "ico"],
2438
2477
  mustBeFile: true
2439
2478
  },
2440
2479
  minLength: 3
@@ -2499,6 +2538,7 @@ var schema_default = {
2499
2538
  $ref: "#/definitions/appProtocolSchemeProperty"
2500
2539
  },
2501
2540
  appPath: { $ref: "#/definitions/appPathProperty" },
2541
+ bytenode: { $ref: "#/definitions/bytenodeConfigProperty" },
2502
2542
  asar: { $ref: "#/definitions/asarProperty" },
2503
2543
  asarUnpack: { $ref: "#/definitions/asarUnpackProperty" },
2504
2544
  buildVersion: { $ref: "#/definitions/buildVersionProperty" },
@@ -2651,6 +2691,9 @@ function getProjectConfig(configPath, flags) {
2651
2691
  const config2 = computeFullProjectConfig(partialConfig, projectRoot, flags);
2652
2692
  validateConfig({ config: config2, projectRoot });
2653
2693
  const result = resolveConfigPaths({ config: config2, projectRoot });
2694
+ if (process.env.TODESKTOP_CLI_APP_ID) {
2695
+ result.id = process.env.TODESKTOP_CLI_APP_ID;
2696
+ }
2654
2697
  return { config: result, unprocessedConfig: config2, projectRoot };
2655
2698
  }
2656
2699
 
@@ -2793,8 +2836,8 @@ function spyBuild() {
2793
2836
  function buildHasSettled(build) {
2794
2837
  return ["linux", "mac", "windows"].every(
2795
2838
  (platform) => {
2796
- var _a, _b, _c, _d, _e;
2797
- return ((_a = build[platform]) == null ? void 0 : _a.shouldSkip) || "succeeded" === ((_b = build[platform]) == null ? void 0 : _b.status) || "cancelled" === ((_c = build[platform]) == null ? void 0 : _c.status) || "failed" === ((_d = build[platform]) == null ? void 0 : _d.status) && ((_e = build[platform]) == null ? void 0 : _e.numberOfAttemptedBuilds) === 2;
2839
+ var _a2, _b, _c, _d, _e;
2840
+ return ((_a2 = build[platform]) == null ? void 0 : _a2.shouldSkip) || "succeeded" === ((_b = build[platform]) == null ? void 0 : _b.status) || "cancelled" === ((_c = build[platform]) == null ? void 0 : _c.status) || "failed" === ((_d = build[platform]) == null ? void 0 : _d.status) && ((_e = build[platform]) == null ? void 0 : _e.numberOfAttemptedBuilds) === 2;
2798
2841
  }
2799
2842
  );
2800
2843
  }
@@ -2938,7 +2981,7 @@ Your app is larger than ${fileSizeLimit}MB. Your app is ${import_chalk.default.b
2938
2981
  if (virtual) {
2939
2982
  stream.append(contentBuffer, {
2940
2983
  name: to,
2941
- mode: mode != null ? mode : 420
2984
+ mode: mode ?? 420
2942
2985
  });
2943
2986
  } else if (isDirectory) {
2944
2987
  stream.directory(from, to);
@@ -2947,7 +2990,7 @@ Your app is larger than ${fileSizeLimit}MB. Your app is ${import_chalk.default.b
2947
2990
  name: to
2948
2991
  });
2949
2992
  } else {
2950
- stream.file(from, { name: to, mode: mode != null ? mode : stats.mode });
2993
+ stream.file(from, { name: to, mode: mode ?? stats.mode });
2951
2994
  }
2952
2995
  });
2953
2996
  stream.finalize();
@@ -2977,9 +3020,9 @@ var DEFAULT_IGNORE_GLOBS = [
2977
3020
  "**/yarn-error.log"
2978
3021
  ];
2979
3022
  async function prepareWorkspaceBundle(input) {
2980
- var _a;
3023
+ var _a2;
2981
3024
  const { config: config2, appPkgJson, appPath } = input;
2982
- if (!((_a = config2.bundleWorkspacePackages) == null ? void 0 : _a.enabled)) {
3025
+ if (!((_a2 = config2.bundleWorkspacePackages) == null ? void 0 : _a2.enabled)) {
2983
3026
  return {
2984
3027
  appPackageJson: appPkgJson,
2985
3028
  entries: [],
@@ -3292,11 +3335,9 @@ function collectDependencyReferences({
3292
3335
  ];
3293
3336
  for (const section of sections) {
3294
3337
  const deps = manifest[section];
3295
- if (!deps)
3296
- continue;
3338
+ if (!deps) continue;
3297
3339
  for (const [depName, spec] of Object.entries(deps)) {
3298
- if (typeof spec !== "string")
3299
- continue;
3340
+ if (typeof spec !== "string") continue;
3300
3341
  const target = resolveWorkspaceTarget({
3301
3342
  depName,
3302
3343
  packageDir,
@@ -3364,8 +3405,7 @@ function applyRewriteMap(manifest, rewriteMap) {
3364
3405
  ];
3365
3406
  for (const section of sections) {
3366
3407
  const sectionDeps = clone[section];
3367
- if (!sectionDeps)
3368
- continue;
3408
+ if (!sectionDeps) continue;
3369
3409
  for (const [depName, rewrite] of Object.entries(rewriteMap)) {
3370
3410
  if (sectionDeps[depName]) {
3371
3411
  sectionDeps[depName] = rewrite;
@@ -3459,7 +3499,7 @@ function buildRewriteMapForPackage({
3459
3499
  bundledNames,
3460
3500
  contexts
3461
3501
  }) {
3462
- var _a, _b;
3502
+ var _a2;
3463
3503
  const rewriteMap = {};
3464
3504
  const sections = [
3465
3505
  "dependencies",
@@ -3468,13 +3508,11 @@ function buildRewriteMapForPackage({
3468
3508
  ];
3469
3509
  for (const section of sections) {
3470
3510
  const deps = manifest[section];
3471
- if (!deps)
3472
- continue;
3511
+ if (!deps) continue;
3473
3512
  for (const [depName, spec] of Object.entries(deps)) {
3474
- if (typeof spec !== "string")
3475
- continue;
3513
+ if (typeof spec !== "string") continue;
3476
3514
  if (bundledNames.has(depName)) {
3477
- const targetBundlePath = (_b = (_a = contexts.get(depName)) == null ? void 0 : _a.bundlePath) != null ? _b : getBundlePath(depName);
3515
+ const targetBundlePath = ((_a2 = contexts.get(depName)) == null ? void 0 : _a2.bundlePath) ?? getBundlePath(depName);
3478
3516
  const fromPath = import_path8.default.posix.join(BUNDLED_ROOT, bundlePath);
3479
3517
  const toPath = import_path8.default.posix.join(BUNDLED_ROOT, targetBundlePath);
3480
3518
  const relative3 = import_path8.default.posix.relative(fromPath, toPath) || ".";
@@ -3574,7 +3612,7 @@ async function uploadApplicationSource({
3574
3612
  config: config2,
3575
3613
  onProgress
3576
3614
  }) {
3577
- var _a;
3615
+ var _a2;
3578
3616
  logger_default.debug(
3579
3617
  {
3580
3618
  scrub: {
@@ -3765,7 +3803,7 @@ async function uploadApplicationSource({
3765
3803
  key: generateS3Key_default({
3766
3804
  appId,
3767
3805
  buildId,
3768
- filenameSuffix: `${(_a = effectiveAppPkgJson.name) == null ? void 0 : _a.replaceAll("/", "")}.zip`
3806
+ filenameSuffix: `${(_a2 = effectiveAppPkgJson.name) == null ? void 0 : _a2.replaceAll("/", "")}.zip`
3769
3807
  }),
3770
3808
  onProgress({ loaded, total }) {
3771
3809
  onProgress(loaded / total * 100, loaded);
@@ -3787,9 +3825,9 @@ async function runBuild({
3787
3825
  updateState,
3788
3826
  flags
3789
3827
  }) {
3790
- var _a, _b, _c, _d;
3828
+ var _a2, _b, _c, _d;
3791
3829
  logForCI_default("Getting application information...");
3792
- const primaryUserId = (_a = currentUser()) == null ? void 0 : _a.uid;
3830
+ const primaryUserId = (_a2 = currentUser()) == null ? void 0 : _a2.uid;
3793
3831
  const { config: config2, unprocessedConfig } = getProjectConfig(configPath, {
3794
3832
  build: flags
3795
3833
  });
@@ -3884,9 +3922,9 @@ async function runBuild({
3884
3922
  }
3885
3923
  }
3886
3924
  function addErrorMessage(e, message2) {
3887
- var _a, _b;
3925
+ var _a2, _b;
3888
3926
  let originalMessage = "";
3889
- if (import_axios2.default.isAxiosError(e) && ((_b = (_a = e.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message)) {
3927
+ if (import_axios2.default.isAxiosError(e) && ((_b = (_a2 = e.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message)) {
3890
3928
  originalMessage = e.response.data.message;
3891
3929
  } else if (e instanceof Error) {
3892
3930
  originalMessage = e.message;
@@ -3909,7 +3947,7 @@ function Build({
3909
3947
  configPath,
3910
3948
  flags
3911
3949
  }) {
3912
- var _a, _b, _c, _d, _e, _f;
3950
+ var _a2, _b, _c, _d, _e, _f;
3913
3951
  const exit = useExit_default();
3914
3952
  const [state, setState] = (0, import_react6.useState)({ state: "initializing" });
3915
3953
  (0, import_react6.useEffect)(() => {
@@ -3919,8 +3957,8 @@ function Build({
3919
3957
  updateState({ state: "error", error });
3920
3958
  });
3921
3959
  return () => {
3922
- var _a2;
3923
- return (_a2 = state.onUnmount) == null ? void 0 : _a2.call(state);
3960
+ var _a3;
3961
+ return (_a3 = state.onUnmount) == null ? void 0 : _a3.call(state);
3924
3962
  };
3925
3963
  }, []);
3926
3964
  function updateState(changes) {
@@ -3943,7 +3981,7 @@ function Build({
3943
3981
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3944
3982
  MainLayout_default,
3945
3983
  {
3946
- appName: state.build.appName || ((_a = state.appPkg) == null ? void 0 : _a.name) || "",
3984
+ appName: state.build.appName || ((_a2 = state.appPkg) == null ? void 0 : _a2.name) || "",
3947
3985
  appVersion: state.build.appVersion || ((_b = state.appPkg) == null ? void 0 : _b.version) || "",
3948
3986
  build: state.build,
3949
3987
  commandUsed,
@@ -4023,8 +4061,7 @@ var loginFields = [
4023
4061
  placeholder: "name@email.com",
4024
4062
  Input: TextInput_default,
4025
4063
  validate: (value) => {
4026
- if (!value)
4027
- return "Required";
4064
+ if (!value) return "Required";
4028
4065
  }
4029
4066
  },
4030
4067
  {
@@ -4033,8 +4070,7 @@ var loginFields = [
4033
4070
  placeholder: "********",
4034
4071
  Input: TextInput_default,
4035
4072
  validate: (value) => {
4036
- if (!value)
4037
- return "Required";
4073
+ if (!value) return "Required";
4038
4074
  },
4039
4075
  mask: "*"
4040
4076
  }
@@ -4050,7 +4086,7 @@ var Login = ({ setIsLoggedIn }) => {
4050
4086
  setActiveField(0);
4051
4087
  };
4052
4088
  const onSubmitLogin = async ({ email, accessToken }) => {
4053
- var _a, _b;
4089
+ var _a2, _b;
4054
4090
  setFailureMessage(null);
4055
4091
  setIsSubmittingForm(true);
4056
4092
  try {
@@ -4070,13 +4106,12 @@ var Login = ({ setIsLoggedIn }) => {
4070
4106
  setError(err);
4071
4107
  } else {
4072
4108
  onFailure(
4073
- `Login unsuccessful: ${((_b = (_a = err == null ? void 0 : err.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || err.message}`
4109
+ `Login unsuccessful: ${((_b = (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || err.message}`
4074
4110
  );
4075
4111
  }
4076
4112
  }
4077
4113
  };
4078
- if (error)
4079
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorDisplay, { error });
4114
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorDisplay, { error });
4080
4115
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4081
4116
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink14.Text, { children: "You are not currently logged in." }),
4082
4117
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink14.Text, { children: "Log in below:" }),
@@ -4162,8 +4197,7 @@ var LoginHOC = ({ children, isInteractive = true }) => {
4162
4197
  );
4163
4198
  if (newJwtToken) {
4164
4199
  userCreds = await signInWithCustomToken(newJwtToken);
4165
- if (userCreds.user)
4166
- setIsLoggedIn(true);
4200
+ if (userCreds.user) setIsLoggedIn(true);
4167
4201
  }
4168
4202
  } else if (!isRawModeSupported || import_is_ci4.default) {
4169
4203
  setError(
@@ -4181,8 +4215,7 @@ var LoginHOC = ({ children, isInteractive = true }) => {
4181
4215
  try {
4182
4216
  if (!userCreds && jwtToken) {
4183
4217
  userCreds = await signInWithCustomToken(jwtToken);
4184
- if (userCreds.user)
4185
- setIsLoggedIn(true);
4218
+ if (userCreds.user) setIsLoggedIn(true);
4186
4219
  }
4187
4220
  } catch (err) {
4188
4221
  }
@@ -4195,8 +4228,7 @@ var LoginHOC = ({ children, isInteractive = true }) => {
4195
4228
  if (newJwtToken) {
4196
4229
  userCreds = await signInWithCustomToken(newJwtToken);
4197
4230
  setAuthConfig(email, accessToken, newJwtToken);
4198
- if (userCreds.user)
4199
- setIsLoggedIn(true);
4231
+ if (userCreds.user) setIsLoggedIn(true);
4200
4232
  }
4201
4233
  }
4202
4234
  } catch (err) {
@@ -4347,7 +4379,6 @@ var getCollection = async (collectionRef) => {
4347
4379
  };
4348
4380
  var acceptedUsersCollection = (id) => (0, import_firestore12.collection)(firestore_default, `users/${id}/acceptedUsers`);
4349
4381
  var findAppUserId = async (appId) => {
4350
- var _a;
4351
4382
  const authUser = currentUser();
4352
4383
  if (!(authUser == null ? void 0 : authUser.uid)) {
4353
4384
  throw new Error("A signed-in Firebase user is required");
@@ -4357,7 +4388,7 @@ var findAppUserId = async (appId) => {
4357
4388
  );
4358
4389
  const primaryUser = {
4359
4390
  id: authUser.uid,
4360
- label: (_a = authUser.email) != null ? _a : authUser.uid
4391
+ label: authUser.email ?? authUser.uid
4361
4392
  };
4362
4393
  const users = [
4363
4394
  primaryUser,
@@ -4367,8 +4398,7 @@ var findAppUserId = async (appId) => {
4367
4398
  try {
4368
4399
  const docRef = (0, import_firestore12.doc)(firestore_default, `users/${user.id}/applications/${appId}`);
4369
4400
  const docSnap = await (0, import_firestore12.getDoc)(docRef);
4370
- if (docSnap.exists())
4371
- return user;
4401
+ if (docSnap.exists()) return user;
4372
4402
  } catch (err) {
4373
4403
  console.error(err);
4374
4404
  }
@@ -4564,7 +4594,7 @@ var OngoingBuildGuard = ({
4564
4594
  try {
4565
4595
  const applicationId = getProjectConfig(configPath).config.id;
4566
4596
  const { id } = await findAppUserId_default(applicationId);
4567
- const now = new Date();
4597
+ const now = /* @__PURE__ */ new Date();
4568
4598
  const twentyFourHoursAgo = new Date(
4569
4599
  now.getTime() - 24 * 60 * 60 * 1e3
4570
4600
  );
@@ -4983,7 +5013,7 @@ async function getBuilds({
4983
5013
 
4984
5014
  // src/utilities/getRelativeDateFromDateString.ts
4985
5015
  var dateFns = __toESM(require("date-fns"));
4986
- var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), new Date()) + " ago";
5016
+ var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), /* @__PURE__ */ new Date()) + " ago";
4987
5017
 
4988
5018
  // src/components/SyntaxHighlight.tsx
4989
5019
  var import_chalk2 = __toESM(require("chalk"));
@@ -5358,7 +5388,6 @@ async function getBuildById({
5358
5388
  buildId,
5359
5389
  userId
5360
5390
  }) {
5361
- var _a;
5362
5391
  logger_default.debug({ appId, buildId }, "getBuildById");
5363
5392
  const snapshot = await (0, import_firestore19.getDoc)(
5364
5393
  (0, import_firestore19.doc)(firestore_default, `users/${userId}/applications/${appId}/builds/${buildId}`)
@@ -5366,7 +5395,7 @@ async function getBuildById({
5366
5395
  if (!snapshot.exists()) {
5367
5396
  return null;
5368
5397
  }
5369
- return (_a = readDocumentSnapshot(snapshot)) != null ? _a : null;
5398
+ return readDocumentSnapshot(snapshot) ?? null;
5370
5399
  }
5371
5400
 
5372
5401
  // src/utilities/getLatestReleasedBuild.ts
@@ -5374,14 +5403,14 @@ async function getLatestReleasedBuild({
5374
5403
  appId,
5375
5404
  userId
5376
5405
  }) {
5377
- var _a, _b;
5406
+ var _a2, _b;
5378
5407
  const appRef = (0, import_firestore21.doc)(firestore_default, `users/${userId}/applications/${appId}`);
5379
5408
  const appSnapshot = await (0, import_firestore21.getDoc)(appRef);
5380
5409
  const app2 = readDocumentSnapshot(appSnapshot);
5381
5410
  if (!app2) {
5382
5411
  throw new Error(`Application with ID of ${appId} doesn't exist.`);
5383
5412
  }
5384
- if ((_a = app2.meta) == null ? void 0 : _a.latestReleaseBuildId) {
5413
+ if ((_a2 = app2.meta) == null ? void 0 : _a2.latestReleaseBuildId) {
5385
5414
  return await getBuildById({
5386
5415
  buildId: (_b = app2.meta) == null ? void 0 : _b.latestReleaseBuildId,
5387
5416
  appId,
@@ -5538,7 +5567,7 @@ async function getBuildAttributes({
5538
5567
  buildId,
5539
5568
  configPath
5540
5569
  }) {
5541
- var _a;
5570
+ var _a2;
5542
5571
  const {
5543
5572
  id: appId,
5544
5573
  nodeVersion,
@@ -5546,7 +5575,7 @@ async function getBuildAttributes({
5546
5575
  pnpmVersion
5547
5576
  } = getProjectConfig(configPath).config;
5548
5577
  const { id: userId } = await findAppUserId_default(appId);
5549
- const contextUserId = (_a = currentUser()) == null ? void 0 : _a.uid;
5578
+ const contextUserId = (_a2 = currentUser()) == null ? void 0 : _a2.uid;
5550
5579
  const build = await fetchBuild({ appId, buildId, userId });
5551
5580
  return {
5552
5581
  appId,
@@ -5625,7 +5654,7 @@ function ReleaseBuildView({
5625
5654
  commandUsed,
5626
5655
  state
5627
5656
  }) {
5628
- var _a, _b;
5657
+ var _a2, _b;
5629
5658
  switch (state.state) {
5630
5659
  case "build-error": {
5631
5660
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
@@ -5633,7 +5662,7 @@ function ReleaseBuildView({
5633
5662
  {
5634
5663
  build: state.build,
5635
5664
  description: "Can't release build",
5636
- message: ((_a = state.error) == null ? void 0 : _a.message) || "Internal build error"
5665
+ message: ((_a2 = state.error) == null ? void 0 : _a2.message) || "Internal build error"
5637
5666
  }
5638
5667
  );
5639
5668
  }
@@ -5736,7 +5765,7 @@ var defaultVM = {
5736
5765
  imageVersion: ""
5737
5766
  };
5738
5767
  function makeProgress(build) {
5739
- var _a, _b, _c, _d, _e, _f, _g;
5768
+ var _a2, _b, _c, _d, _e, _f, _g;
5740
5769
  const defaultProgress = {
5741
5770
  message: "Starting",
5742
5771
  progress: 0,
@@ -5746,7 +5775,7 @@ function makeProgress(build) {
5746
5775
  };
5747
5776
  const linux = {
5748
5777
  ...defaultProgress,
5749
- ...(_a = build.smokeTest) == null ? void 0 : _a.linux,
5778
+ ...(_a2 = build.smokeTest) == null ? void 0 : _a2.linux,
5750
5779
  shouldSkip: ((_b = build.linux) == null ? void 0 : _b.shouldSkip) || false
5751
5780
  };
5752
5781
  const mac = {
@@ -5960,7 +5989,7 @@ function ReleaseConfirmation({
5960
5989
  disabled = false,
5961
5990
  loadData = loadBuildsData
5962
5991
  }) {
5963
- var _a;
5992
+ var _a2;
5964
5993
  const [state, setState] = (0, import_react20.useState)({
5965
5994
  state: disabled ? "bypass" : "loading"
5966
5995
  });
@@ -5985,7 +6014,7 @@ function ReleaseConfirmation({
5985
6014
  {
5986
6015
  build: state.build,
5987
6016
  description: "Can't release build",
5988
- message: ((_a = state.error) == null ? void 0 : _a.message) || "Internal build error"
6017
+ message: ((_a2 = state.error) == null ? void 0 : _a2.message) || "Internal build error"
5989
6018
  }
5990
6019
  );
5991
6020
  }
@@ -6322,7 +6351,7 @@ function SmokeTestView({
6322
6351
  commandUsed = "",
6323
6352
  state
6324
6353
  }) {
6325
- var _a, _b, _c, _d;
6354
+ var _a2, _b, _c, _d;
6326
6355
  switch (state.state) {
6327
6356
  case "build-error": {
6328
6357
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -6330,7 +6359,7 @@ function SmokeTestView({
6330
6359
  {
6331
6360
  build: state.build,
6332
6361
  description: "Can't finish smoke test",
6333
- message: (_a = state.error) == null ? void 0 : _a.message
6362
+ message: (_a2 = state.error) == null ? void 0 : _a2.message
6334
6363
  }
6335
6364
  );
6336
6365
  }
@@ -6379,12 +6408,12 @@ async function cancelSmokeTest({
6379
6408
  buildId,
6380
6409
  userId
6381
6410
  }) {
6382
- var _a;
6411
+ var _a2;
6383
6412
  await postToFirebaseFunction_default("cancelSmokeTest_HTTP", {
6384
6413
  appId,
6385
6414
  buildId,
6386
6415
  userId,
6387
- idToken: await ((_a = currentUser()) == null ? void 0 : _a.getIdToken())
6416
+ idToken: await ((_a2 = currentUser()) == null ? void 0 : _a2.getIdToken())
6388
6417
  });
6389
6418
  }
6390
6419
 
@@ -6398,7 +6427,7 @@ async function queueSmokeTest({
6398
6427
  pnpmVersion,
6399
6428
  userId
6400
6429
  }) {
6401
- var _a;
6430
+ var _a2;
6402
6431
  try {
6403
6432
  await postToFirebaseFunction_default("queueSmokeTest_HTTP", {
6404
6433
  appId,
@@ -6408,7 +6437,7 @@ async function queueSmokeTest({
6408
6437
  pnpmVersion,
6409
6438
  userId,
6410
6439
  contextUserId,
6411
- idToken: await ((_a = currentUser()) == null ? void 0 : _a.getIdToken())
6440
+ idToken: await ((_a2 = currentUser()) == null ? void 0 : _a2.getIdToken())
6412
6441
  });
6413
6442
  } catch (e) {
6414
6443
  logger_default.error({ error: e });
@@ -6567,8 +6596,8 @@ async function smokeTestWorkflow({
6567
6596
  }
6568
6597
  }
6569
6598
  function buildCanBeCanceled(build) {
6570
- var _a, _b;
6571
- if ((_a = build == null ? void 0 : build.smokeTest) == null ? void 0 : _a.isCanceled) {
6599
+ var _a2, _b;
6600
+ if ((_a2 = build == null ? void 0 : build.smokeTest) == null ? void 0 : _a2.isCanceled) {
6572
6601
  return false;
6573
6602
  }
6574
6603
  return Boolean((_b = build == null ? void 0 : build.smokeTest) == null ? void 0 : _b.buildServerExecutionId);
@@ -6637,7 +6666,7 @@ var package_default = {
6637
6666
  access: "public"
6638
6667
  },
6639
6668
  name: "@todesktop/cli",
6640
- version: "1.15.2",
6669
+ version: "1.18.0",
6641
6670
  license: "MIT",
6642
6671
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
6643
6672
  homepage: "https://todesktop.com/cli",
@@ -6652,23 +6681,23 @@ var package_default = {
6652
6681
  node: ">=16"
6653
6682
  },
6654
6683
  scripts: {
6655
- dev: "cp-cli dev.env .env && npm run build:dev && npm link",
6656
- "dev:prod": "cp-cli prod.env .env && npm run build && npm link",
6657
- "dev:local:prod": "cp-cli prod-local.env .env && npm run build && npm link && cp-cli prod-local.env .env",
6658
- build: "npm run types:generate && esbuild src/index.ts --packages=external --bundle --sourcemap --platform=node --outfile=dist/cli.js && cp-cli prod.env .env",
6659
- "build:dev": "npm run types:generate && esbuild src/index.ts --packages=external --bundle --sourcemap --platform=node --outfile=dist/cli.js && cp-cli dev.env .env",
6684
+ build: "scripts/esbuild.js",
6685
+ dev: "scripts/esbuild.js --link --watch --stage dev",
6686
+ "dev:local:prod": "scripts/esbuild.js --link --watch --stage prod-local",
6687
+ "dev:prod": "scripts/esbuild.js --link --watch",
6688
+ "docs:generate": "node scripts/generate-readme.js",
6689
+ format: "prettier --write .",
6660
6690
  lint: "npm run lint:types && npm run lint:styles",
6691
+ "lint--fix": "eslint src test --fix",
6661
6692
  "lint:styles": "eslint src test .eslintrc.js && prettier --check .",
6662
- format: "prettier --write .",
6663
6693
  "lint:types": "tsc && tsc-strict",
6664
- "lint--fix": "eslint src test --fix",
6665
- "docs:generate": "node scripts/generate-readme.js",
6666
6694
  "types:generate": "node scripts/generate-types.js",
6667
- release: "npm run docs:generate && npm run build && npx np --tag=latest",
6695
+ release: "npm run docs:generate && npm run build && pnpx np --tag=latest",
6668
6696
  "release-beta": "npm run docs:generate && npm run build && npx np --any-branch --no-tests --tag=beta",
6669
6697
  test: "ava",
6698
+ "test:e2e": "node test/output-snapshots/output.test.js",
6670
6699
  "test--watch": "npm test -- --watch",
6671
- postinstall: "node scripts/postinstall.js"
6700
+ typecheck: "tsc --noEmit"
6672
6701
  },
6673
6702
  files: [
6674
6703
  "scripts/postinstall.js",
@@ -6723,6 +6752,7 @@ var package_default = {
6723
6752
  "xdg-basedir": "^4.0.0"
6724
6753
  },
6725
6754
  devDependencies: {
6755
+ "@todesktop/dev-config": "workspace:*",
6726
6756
  "@todesktop/shared": "^7.189.6",
6727
6757
  "@types/bunyan": "^1.8.6",
6728
6758
  "@types/is-ci": "^3.0.4",
@@ -6732,7 +6762,7 @@ var package_default = {
6732
6762
  "@typescript-eslint/parser": "^5.46.1",
6733
6763
  ava: "^4.3.1",
6734
6764
  "cp-cli": "^2.0.0",
6735
- esbuild: "^0.16.5",
6765
+ esbuild: "^0.25.10",
6736
6766
  "esbuild-register": "^3.4.1",
6737
6767
  eslint: "^8.29.0",
6738
6768
  "eslint-config-prettier": "^8.5.0",
@@ -6754,7 +6784,7 @@ var package_default = {
6754
6784
  prettier: "^2.8.1",
6755
6785
  proxyquire: "^2.1.3",
6756
6786
  sinon: "^9.0.3",
6757
- typescript: "^4.9.4",
6787
+ typescript: "catalog:",
6758
6788
  "typescript-strict-plugin": "^2.2.1"
6759
6789
  },
6760
6790
  ava: {
@@ -6788,18 +6818,6 @@ var package_default = {
6788
6818
  "pre-commit": "lint-staged"
6789
6819
  }
6790
6820
  },
6791
- overrides: {
6792
- pastel: {
6793
- "parcel-bundler": {
6794
- deasync: "0.1.27"
6795
- }
6796
- }
6797
- },
6798
- resolutions: {
6799
- "pastel/parcel-bundler/deasync": "0.1.24",
6800
- ink: "3.2.0",
6801
- react: "17.0.2"
6802
- },
6803
6821
  packageExtensions: {
6804
6822
  "ink-progress-bar@*": {
6805
6823
  dependencies: {