@todesktop/cli 1.17.0 → 1.18.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.
package/dist/cli.js CHANGED
@@ -136,18 +136,18 @@ try {
136
136
  };
137
137
  try {
138
138
  Sentry.captureException(e);
139
- } catch (err) {
139
+ } catch {
140
140
  }
141
141
  }
142
142
  var logger_default = logger;
143
143
 
144
144
  // src/utilities/logForCI.ts
145
- var logForCI_default = (...args2) => {
145
+ function logForCI(...args2) {
146
146
  logger_default.info({ args: args2 }, "logForCI");
147
147
  if (import_is_ci.default || !process.stdin.isTTY) {
148
- console.log(...args2);
148
+ console.info(...args2);
149
149
  }
150
- };
150
+ }
151
151
 
152
152
  // src/utilities/useExit.ts
153
153
  var import_ink = require("ink");
@@ -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
 
@@ -236,7 +241,7 @@ if (fs2.existsSync(oldConfigPath)) {
236
241
  const { email, accessToken, jwtToken } = require(oldConfigPath);
237
242
  setAuthConfig(email, accessToken, jwtToken);
238
243
  (0, import_del.default)(oldConfigPath, { force: true });
239
- } catch (err) {
244
+ } catch {
240
245
  (0, import_del.default)(oldConfigPath, { force: true });
241
246
  }
242
247
  }
@@ -293,26 +298,26 @@ function getAnalyticsBaseProperties() {
293
298
  name: import_os.default.platform(),
294
299
  version: import_os.default.release()
295
300
  };
296
- } catch (err) {
301
+ } catch {
297
302
  }
298
303
  try {
299
304
  baseProps.user = {
300
305
  email: getAuthConfig().email
301
306
  };
302
- } catch (err) {
307
+ } catch {
303
308
  }
304
309
  try {
305
310
  baseProps.app = {
306
311
  cliVersion: getCliVersion_default()
307
312
  };
308
- } catch (err) {
313
+ } catch {
309
314
  }
310
315
  try {
311
316
  baseProps.runtime = {
312
317
  name: "Node.js",
313
318
  version: process.version
314
319
  };
315
- } catch (err) {
320
+ } catch {
316
321
  }
317
322
  return baseProps;
318
323
  }
@@ -333,14 +338,14 @@ var track = (event, properties = {}, callback = () => {
333
338
  },
334
339
  callback
335
340
  );
336
- } catch (err) {
341
+ } catch {
337
342
  }
338
343
  };
339
344
  var identify = (id, traits = {}, callback = () => {
340
345
  }) => {
341
346
  try {
342
347
  analytics.identify({ userId: id, anonymousId, traits }, callback);
343
- } catch (err) {
348
+ } catch {
344
349
  }
345
350
  };
346
351
  var flush = (callback = () => {
@@ -382,13 +387,13 @@ 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
- logForCI_default(`Build complete! ${url}`);
396
+ logForCI(`Build complete! ${url}`);
392
397
  (0, import_react.useEffect)(() => {
393
398
  if (url) {
394
399
  setTimeout(exit, 10);
@@ -458,11 +463,11 @@ var PlatformProgress = ({
458
463
  if (activityNameToDisplay.length > 64) {
459
464
  activityNameToDisplay = `${activityNameToDisplay.substr(0, 61)}...`;
460
465
  }
461
- progressIndicator = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink3.Box, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink3.Text, { children: [
466
+ progressIndicator = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink3.Box, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink3.Text, { children: [
462
467
  ["preparation", "queue"].includes(activityType) ? void 0 : getProgressPercentageLabel(percent, activityType),
463
468
  activityNameToDisplay,
464
469
  activityType === "error" ? "" : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink3.Text, { children: "..." })
465
- ] }) }) });
470
+ ] }) });
466
471
  }
467
472
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink3.Box, { children: [
468
473
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink3.Box, { width: preLabelMaxWidth, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink3.Text, { children: [
@@ -508,7 +513,7 @@ var isPlatformBuildRunning = (platformBuild) => {
508
513
 
509
514
  // src/components/BuildProgress.tsx
510
515
  var import_jsx_runtime3 = require("react/jsx-runtime");
511
- var logForCIThrottled = (0, import_lodash.default)(logForCI_default, 60 * 1e3, { trailing: true });
516
+ var logForCIThrottled = (0, import_lodash.default)(logForCI, 60 * 1e3, { trailing: true });
512
517
  var BuildProgress = ({ build, onBuildFailure }) => {
513
518
  const exit = useExit_default();
514
519
  const [{ hasKickedOff }, setState] = (0, import_react2.useState)({
@@ -544,7 +549,7 @@ var BuildProgress = ({ build, onBuildFailure }) => {
544
549
  if (!hasKickedOff) {
545
550
  return null;
546
551
  }
547
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ink4.Box, { flexDirection: "column", children: platformsNotSkipped.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ink4.Box, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
552
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ink4.Box, { flexDirection: "column", children: platformsNotSkipped.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ink4.Box, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
548
553
  PlatformProgress_default,
549
554
  {
550
555
  activityName: build[platform].status === "failed" ? build[platform].errorMessage : build[platform].progressActivityName,
@@ -554,7 +559,7 @@ var BuildProgress = ({ build, onBuildFailure }) => {
554
559
  platform,
555
560
  shouldShowReadyPrefix: !(build && ["failed", "succeeded"].includes(build.status))
556
561
  }
557
- ) }, platform)) }) });
562
+ ) }, platform)) });
558
563
  };
559
564
  BuildProgress.propTypes = {
560
565
  build: import_prop_types3.default.object.isRequired,
@@ -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,
@@ -684,7 +690,7 @@ var CancelBuild = ({
684
690
  return;
685
691
  }
686
692
  setState((previousState) => ({ ...previousState, hasStarted: true }));
687
- logForCI_default("Cancelling build...");
693
+ logForCI("Cancelling build...");
688
694
  cancelBuild({ appId, buildId: id }).then((result) => {
689
695
  logger_default.debug(
690
696
  { appId, buildId: id, result },
@@ -899,7 +905,7 @@ var MainLayout = ({
899
905
  }));
900
906
  }, [build, isCancellingBuild, isRawModeSupported]);
901
907
  onInput(
902
- async (input, key) => {
908
+ async (_input, key) => {
903
909
  if (key.escape && canCancelBuild) {
904
910
  logger_default.debug("MainLayout component: esc pressed, cancelling build");
905
911
  setState((previousState) => ({
@@ -1013,14 +1019,18 @@ var import_pretty_bytes = __toESM(require("pretty-bytes"));
1013
1019
  // src/utilities/postToFirebaseFunction.ts
1014
1020
  var import_axios = __toESM(require("axios"));
1015
1021
  var { TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE } = getEnvironmentVariables_default();
1016
- async function postToFirebaseFunction_default(functionName, body = {}, config2 = {}) {
1022
+ async function postToFirebaseFunction(functionName, body = {}, config2 = {}) {
1017
1023
  logger_default.debug(
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
  );
@@ -1054,11 +1064,11 @@ function loadTypeScriptConfig(configPath) {
1054
1064
  const tsPath = (0, import_path2.resolve)(projectRoot, "node_modules", "typescript");
1055
1065
  typescript = require(tsPath);
1056
1066
  logger_default.debug(`Found TypeScript in user's project at: ${tsPath}`);
1057
- } catch (error) {
1067
+ } catch {
1058
1068
  try {
1059
1069
  typescript = require("typescript");
1060
1070
  logger_default.debug("Using globally available TypeScript installation");
1061
- } catch (globalError) {
1071
+ } catch {
1062
1072
  throw new Error(
1063
1073
  `TypeScript is required to load .ts configuration files but was not found. Please install TypeScript in your project: npm install --save-dev typescript`
1064
1074
  );
@@ -1366,7 +1376,7 @@ var addCustomKeywords_default = (ajv, context) => {
1366
1376
  addKeyword({
1367
1377
  keyword: "validSemver",
1368
1378
  type: "string",
1369
- validate: (schema, data) => {
1379
+ validate: (_schema, data) => {
1370
1380
  if (!(0, import_valid.default)(data)) {
1371
1381
  throw new import_ajv2.ValidationError([
1372
1382
  {
@@ -1399,7 +1409,7 @@ var addCustomKeywords_default = (ajv, context) => {
1399
1409
  addKeyword({
1400
1410
  keyword: "email",
1401
1411
  type: "string",
1402
- validate: (schema, data) => {
1412
+ validate: (_schema, data) => {
1403
1413
  if (!(0, import_email_regex.default)({ exact: true }).test(data)) {
1404
1414
  throw new import_ajv2.ValidationError([
1405
1415
  {
@@ -1482,7 +1492,7 @@ var addCustomKeywords_default = (ajv, context) => {
1482
1492
  let pkg;
1483
1493
  try {
1484
1494
  pkg = require(pkgPath);
1485
- } catch (e) {
1495
+ } catch {
1486
1496
  throw new import_ajv2.ValidationError([
1487
1497
  {
1488
1498
  keyword: "App",
@@ -1503,15 +1513,13 @@ var addCustomKeywords_default = (ajv, context) => {
1503
1513
  }
1504
1514
  ]);
1505
1515
  }
1506
- } else {
1507
- if (!fs3.existsSync(path4.join(appRoot, "index.js"))) {
1508
- throw new import_ajv2.ValidationError([
1509
- {
1510
- keyword: "App",
1511
- message: 'invalid. There is neither a "main" property in your package.json nor an index.js at the root of your app'
1512
- }
1513
- ]);
1514
- }
1516
+ } else if (!fs3.existsSync(path4.join(appRoot, "index.js"))) {
1517
+ throw new import_ajv2.ValidationError([
1518
+ {
1519
+ keyword: "App",
1520
+ message: 'invalid. There is neither a "main" property in your package.json nor an index.js at the root of your app'
1521
+ }
1522
+ ]);
1515
1523
  }
1516
1524
  }
1517
1525
  return true;
@@ -1520,7 +1528,7 @@ var addCustomKeywords_default = (ajv, context) => {
1520
1528
  });
1521
1529
  addKeyword({
1522
1530
  keyword: "npmAuthor",
1523
- validate: (schema, data) => {
1531
+ validate: (_schema, data) => {
1524
1532
  const dataType = typeof data;
1525
1533
  if (dataType === "undefined") {
1526
1534
  return true;
@@ -1558,24 +1566,22 @@ var addCustomKeywords_default = (ajv, context) => {
1558
1566
  message: `invalid. "email" property is missing.`
1559
1567
  }
1560
1568
  ]);
1561
- } else {
1562
- if (typeof data.email === "string") {
1563
- if (!(0, import_email_regex.default)({ exact: true }).test(data.email)) {
1564
- throw new import_ajv2.ValidationError([
1565
- {
1566
- keyword: "author",
1567
- message: `.email invalid. It does not look like an email.`
1568
- }
1569
- ]);
1570
- }
1571
- } else {
1569
+ } else if (typeof data.email === "string") {
1570
+ if (!(0, import_email_regex.default)({ exact: true }).test(data.email)) {
1572
1571
  throw new import_ajv2.ValidationError([
1573
1572
  {
1574
1573
  keyword: "author",
1575
- message: `.email invalid. It must be a string.`
1574
+ message: `.email invalid. It does not look like an email.`
1576
1575
  }
1577
1576
  ]);
1578
1577
  }
1578
+ } else {
1579
+ throw new import_ajv2.ValidationError([
1580
+ {
1581
+ keyword: "author",
1582
+ message: `.email invalid. It must be a string.`
1583
+ }
1584
+ ]);
1579
1585
  }
1580
1586
  }
1581
1587
  } else {
@@ -1659,6 +1665,7 @@ var schema_default = {
1659
1665
  }
1660
1666
  }
1661
1667
  },
1668
+ bytenode: { $ref: "#/definitions/bytenodeConfigProperty" },
1662
1669
  asar: { $ref: "#/definitions/asarProperty" },
1663
1670
  asarUnpack: { $ref: "#/definitions/asarUnpackProperty" },
1664
1671
  buildVersion: { $ref: "#/definitions/buildVersionProperty" },
@@ -1751,6 +1758,34 @@ var schema_default = {
1751
1758
  examples: ["com.microsoft.word"],
1752
1759
  default: "auto-generated"
1753
1760
  },
1761
+ bytenodeConfigProperty: {
1762
+ type: "object",
1763
+ additionalProperties: false,
1764
+ description: "Compile selected source files to .jsc using Bytenode during the build. Provide glob patterns relative to your appPath.",
1765
+ default: { enabled: false },
1766
+ properties: {
1767
+ enabled: {
1768
+ type: "boolean",
1769
+ default: false,
1770
+ description: "Enable Bytenode compilation."
1771
+ },
1772
+ files: {
1773
+ type: "array",
1774
+ items: { type: "string", minLength: 1 },
1775
+ minItems: 1,
1776
+ description: "Glob patterns relative to appPath for files to compile to Bytenode."
1777
+ }
1778
+ },
1779
+ allOf: [
1780
+ {
1781
+ if: {
1782
+ properties: { enabled: { const: true } },
1783
+ required: ["enabled"]
1784
+ },
1785
+ then: { required: ["files"] }
1786
+ }
1787
+ ]
1788
+ },
1754
1789
  appFilesProperty: {
1755
1790
  type: "array",
1756
1791
  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 +2469,7 @@ var schema_default = {
2434
2469
  description: "The path to your application's Windows desktop icon. It must be an ICO, ICNS, or PNG.",
2435
2470
  examples: ["./icon.ico"],
2436
2471
  file: {
2437
- extensions: ["icns", "png", "icon"],
2472
+ extensions: ["icns", "png", "ico"],
2438
2473
  mustBeFile: true
2439
2474
  },
2440
2475
  minLength: 3
@@ -2499,6 +2534,7 @@ var schema_default = {
2499
2534
  $ref: "#/definitions/appProtocolSchemeProperty"
2500
2535
  },
2501
2536
  appPath: { $ref: "#/definitions/appPathProperty" },
2537
+ bytenode: { $ref: "#/definitions/bytenodeConfigProperty" },
2502
2538
  asar: { $ref: "#/definitions/asarProperty" },
2503
2539
  asarUnpack: { $ref: "#/definitions/asarUnpackProperty" },
2504
2540
  buildVersion: { $ref: "#/definitions/buildVersionProperty" },
@@ -2540,8 +2576,7 @@ var schema_default = {
2540
2576
  // src/utilities/projectConfig/schema/full.ts
2541
2577
  var full_default = (context) => {
2542
2578
  function updateFileProperty(record) {
2543
- for (const key in record) {
2544
- const value = record[key];
2579
+ for (const [key, value] of Object.entries(record)) {
2545
2580
  if (key === "file" && typeof value === "object") {
2546
2581
  value["from"] = context.projectRoot;
2547
2582
  } else if (typeof value === "object" && value !== null) {
@@ -2651,6 +2686,9 @@ function getProjectConfig(configPath, flags) {
2651
2686
  const config2 = computeFullProjectConfig(partialConfig, projectRoot, flags);
2652
2687
  validateConfig({ config: config2, projectRoot });
2653
2688
  const result = resolveConfigPaths({ config: config2, projectRoot });
2689
+ if (process.env.TODESKTOP_CLI_APP_ID) {
2690
+ result.id = process.env.TODESKTOP_CLI_APP_ID;
2691
+ }
2654
2692
  return { config: result, unprocessedConfig: config2, projectRoot };
2655
2693
  }
2656
2694
 
@@ -2713,7 +2751,7 @@ var getVersionControlInfo_default = async (directory) => {
2713
2751
  versionControlSystemName: "git"
2714
2752
  };
2715
2753
  }
2716
- } catch (e) {
2754
+ } catch {
2717
2755
  }
2718
2756
  return result;
2719
2757
  };
@@ -2793,8 +2831,8 @@ function spyBuild() {
2793
2831
  function buildHasSettled(build) {
2794
2832
  return ["linux", "mac", "windows"].every(
2795
2833
  (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;
2834
+ var _a2, _b, _c, _d, _e;
2835
+ 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
2836
  }
2799
2837
  );
2800
2838
  }
@@ -2866,7 +2904,7 @@ var import_du = __toESM(require("du"));
2866
2904
  var import_fs2 = __toESM(require("fs"));
2867
2905
  var import_chalk = __toESM(require("chalk"));
2868
2906
  var import_path7 = __toESM(require("path"));
2869
- async function zip_default({
2907
+ async function zip({
2870
2908
  files,
2871
2909
  fileSizeLimit = 20,
2872
2910
  onError,
@@ -2875,7 +2913,7 @@ async function zip_default({
2875
2913
  }) {
2876
2914
  logger_default.debug({ files }, "zip");
2877
2915
  const stream = (0, import_archiver.default)("zip");
2878
- stream.on("warning", function(err) {
2916
+ stream.on("warning", (err) => {
2879
2917
  if (err.code === "ENOENT") {
2880
2918
  console.warn(err);
2881
2919
  logger_default.warn({ err }, "zip: stream warning ENOENT");
@@ -2883,7 +2921,7 @@ async function zip_default({
2883
2921
  onError(err);
2884
2922
  }
2885
2923
  });
2886
- stream.on("error", function(err) {
2924
+ stream.on("error", (err) => {
2887
2925
  onError(err);
2888
2926
  });
2889
2927
  const processedFiles = await Promise.all(
@@ -2938,7 +2976,7 @@ Your app is larger than ${fileSizeLimit}MB. Your app is ${import_chalk.default.b
2938
2976
  if (virtual) {
2939
2977
  stream.append(contentBuffer, {
2940
2978
  name: to,
2941
- mode: mode != null ? mode : 420
2979
+ mode: mode ?? 420
2942
2980
  });
2943
2981
  } else if (isDirectory) {
2944
2982
  stream.directory(from, to);
@@ -2947,7 +2985,7 @@ Your app is larger than ${fileSizeLimit}MB. Your app is ${import_chalk.default.b
2947
2985
  name: to
2948
2986
  });
2949
2987
  } else {
2950
- stream.file(from, { name: to, mode: mode != null ? mode : stats.mode });
2988
+ stream.file(from, { name: to, mode: mode ?? stats.mode });
2951
2989
  }
2952
2990
  });
2953
2991
  stream.finalize();
@@ -2977,9 +3015,9 @@ var DEFAULT_IGNORE_GLOBS = [
2977
3015
  "**/yarn-error.log"
2978
3016
  ];
2979
3017
  async function prepareWorkspaceBundle(input) {
2980
- var _a;
3018
+ var _a2;
2981
3019
  const { config: config2, appPkgJson, appPath } = input;
2982
- if (!((_a = config2.bundleWorkspacePackages) == null ? void 0 : _a.enabled)) {
3020
+ if (!((_a2 = config2.bundleWorkspacePackages) == null ? void 0 : _a2.enabled)) {
2983
3021
  return {
2984
3022
  appPackageJson: appPkgJson,
2985
3023
  entries: [],
@@ -3217,7 +3255,7 @@ function collectWorkspacePackages(definition) {
3217
3255
  if (!manifest || !manifest.name) {
3218
3256
  continue;
3219
3257
  }
3220
- const name = manifest.name;
3258
+ const { name } = manifest;
3221
3259
  if (packages.has(name)) {
3222
3260
  const existing = packages.get(name);
3223
3261
  throw new Error(
@@ -3292,11 +3330,9 @@ function collectDependencyReferences({
3292
3330
  ];
3293
3331
  for (const section of sections) {
3294
3332
  const deps = manifest[section];
3295
- if (!deps)
3296
- continue;
3333
+ if (!deps) continue;
3297
3334
  for (const [depName, spec] of Object.entries(deps)) {
3298
- if (typeof spec !== "string")
3299
- continue;
3335
+ if (typeof spec !== "string") continue;
3300
3336
  const target = resolveWorkspaceTarget({
3301
3337
  depName,
3302
3338
  packageDir,
@@ -3364,8 +3400,7 @@ function applyRewriteMap(manifest, rewriteMap) {
3364
3400
  ];
3365
3401
  for (const section of sections) {
3366
3402
  const sectionDeps = clone[section];
3367
- if (!sectionDeps)
3368
- continue;
3403
+ if (!sectionDeps) continue;
3369
3404
  for (const [depName, rewrite] of Object.entries(rewriteMap)) {
3370
3405
  if (sectionDeps[depName]) {
3371
3406
  sectionDeps[depName] = rewrite;
@@ -3381,7 +3416,7 @@ async function buildPackageEntries({
3381
3416
  contexts
3382
3417
  }) {
3383
3418
  const packageDir = workspacePackage.dir;
3384
- const manifest = workspacePackage.manifest;
3419
+ const { manifest } = workspacePackage;
3385
3420
  const filesToInclude = await gatherPackageFiles({ packageDir, manifest });
3386
3421
  const files = filesToInclude.map((absolutePath) => {
3387
3422
  const relative3 = import_path8.default.relative(packageDir, absolutePath);
@@ -3422,7 +3457,7 @@ async function gatherPackageFiles({
3422
3457
  const posixPattern = pattern.replace(/\\/g, "/");
3423
3458
  return [pattern, `${posixPattern}/**/*`];
3424
3459
  }
3425
- } catch (error) {
3460
+ } catch {
3426
3461
  }
3427
3462
  return [pattern];
3428
3463
  });
@@ -3459,7 +3494,7 @@ function buildRewriteMapForPackage({
3459
3494
  bundledNames,
3460
3495
  contexts
3461
3496
  }) {
3462
- var _a, _b;
3497
+ var _a2;
3463
3498
  const rewriteMap = {};
3464
3499
  const sections = [
3465
3500
  "dependencies",
@@ -3468,13 +3503,11 @@ function buildRewriteMapForPackage({
3468
3503
  ];
3469
3504
  for (const section of sections) {
3470
3505
  const deps = manifest[section];
3471
- if (!deps)
3472
- continue;
3506
+ if (!deps) continue;
3473
3507
  for (const [depName, spec] of Object.entries(deps)) {
3474
- if (typeof spec !== "string")
3475
- continue;
3508
+ if (typeof spec !== "string") continue;
3476
3509
  if (bundledNames.has(depName)) {
3477
- const targetBundlePath = (_b = (_a = contexts.get(depName)) == null ? void 0 : _a.bundlePath) != null ? _b : getBundlePath(depName);
3510
+ const targetBundlePath = ((_a2 = contexts.get(depName)) == null ? void 0 : _a2.bundlePath) ?? getBundlePath(depName);
3478
3511
  const fromPath = import_path8.default.posix.join(BUNDLED_ROOT, bundlePath);
3479
3512
  const toPath = import_path8.default.posix.join(BUNDLED_ROOT, targetBundlePath);
3480
3513
  const relative3 = import_path8.default.posix.relative(fromPath, toPath) || ".";
@@ -3574,7 +3607,7 @@ async function uploadApplicationSource({
3574
3607
  config: config2,
3575
3608
  onProgress
3576
3609
  }) {
3577
- var _a;
3610
+ var _a2;
3578
3611
  logger_default.debug(
3579
3612
  {
3580
3613
  scrub: {
@@ -3751,7 +3784,7 @@ async function uploadApplicationSource({
3751
3784
  }
3752
3785
  return uploadToS3_default({
3753
3786
  bucket: config2.bucket || void 0,
3754
- inputStream: await zip_default({
3787
+ inputStream: await zip({
3755
3788
  files,
3756
3789
  fileSizeLimit: config2.uploadSizeLimit,
3757
3790
  onError: (e) => {
@@ -3765,7 +3798,7 @@ async function uploadApplicationSource({
3765
3798
  key: generateS3Key_default({
3766
3799
  appId,
3767
3800
  buildId,
3768
- filenameSuffix: `${(_a = effectiveAppPkgJson.name) == null ? void 0 : _a.replaceAll("/", "")}.zip`
3801
+ filenameSuffix: `${(_a2 = effectiveAppPkgJson.name) == null ? void 0 : _a2.replaceAll("/", "")}.zip`
3769
3802
  }),
3770
3803
  onProgress({ loaded, total }) {
3771
3804
  onProgress(loaded / total * 100, loaded);
@@ -3776,7 +3809,7 @@ async function exists(filePath) {
3776
3809
  try {
3777
3810
  await fs6.promises.access(filePath);
3778
3811
  return true;
3779
- } catch (e) {
3812
+ } catch {
3780
3813
  return false;
3781
3814
  }
3782
3815
  }
@@ -3787,9 +3820,9 @@ async function runBuild({
3787
3820
  updateState,
3788
3821
  flags
3789
3822
  }) {
3790
- var _a, _b, _c, _d;
3791
- logForCI_default("Getting application information...");
3792
- const primaryUserId = (_a = currentUser()) == null ? void 0 : _a.uid;
3823
+ var _a2, _b, _c, _d;
3824
+ logForCI("Getting application information...");
3825
+ const primaryUserId = (_a2 = currentUser()) == null ? void 0 : _a2.uid;
3793
3826
  const { config: config2, unprocessedConfig } = getProjectConfig(configPath, {
3794
3827
  build: flags
3795
3828
  });
@@ -3805,10 +3838,10 @@ async function runBuild({
3805
3838
  preparationProgress: 0.02,
3806
3839
  state: "preparing"
3807
3840
  });
3808
- logForCI_default("Preparing...");
3841
+ logForCI("Preparing...");
3809
3842
  let buildId;
3810
3843
  try {
3811
- const prepareResult = await postToFirebaseFunction_default("prepareNewBuild", {
3844
+ const prepareResult = await postToFirebaseFunction("prepareNewBuild", {
3812
3845
  appPkgName: appPkgJson.name,
3813
3846
  appPkgProductName: appPkgJson.productName,
3814
3847
  appVersion: appPkgJson.version,
@@ -3827,12 +3860,12 @@ async function runBuild({
3827
3860
  } catch (e) {
3828
3861
  throw addErrorMessage(e, "Failed while preparing new build");
3829
3862
  }
3830
- logForCI_default(`Retrieved build ID: ${buildId}`);
3863
+ logForCI(`Retrieved build ID: ${buildId}`);
3831
3864
  updateState({
3832
3865
  preparationProgress: 0.05,
3833
3866
  preparationStageLabel: "Uploading"
3834
3867
  });
3835
- logForCI_default("Uploading...");
3868
+ logForCI("Uploading...");
3836
3869
  let sourceArchiveDetails;
3837
3870
  try {
3838
3871
  sourceArchiveDetails = await uploadApplicationSource({
@@ -3855,9 +3888,9 @@ async function runBuild({
3855
3888
  throw addErrorMessage(e, "Failed while uploading application source");
3856
3889
  }
3857
3890
  updateState({ state: "building" });
3858
- logForCI_default("Kicking off build...");
3891
+ logForCI("Kicking off build...");
3859
3892
  try {
3860
- await postToFirebaseFunction_default("kickOffBuild", {
3893
+ await postToFirebaseFunction("kickOffBuild", {
3861
3894
  appBuilderLibVersion: config2.appBuilderLibVersion,
3862
3895
  appId,
3863
3896
  appPkgName: appPkgJson.name,
@@ -3884,9 +3917,9 @@ async function runBuild({
3884
3917
  }
3885
3918
  }
3886
3919
  function addErrorMessage(e, message2) {
3887
- var _a, _b;
3920
+ var _a2, _b;
3888
3921
  let originalMessage = "";
3889
- if (import_axios2.default.isAxiosError(e) && ((_b = (_a = e.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message)) {
3922
+ if (import_axios2.default.isAxiosError(e) && ((_b = (_a2 = e.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message)) {
3890
3923
  originalMessage = e.response.data.message;
3891
3924
  } else if (e instanceof Error) {
3892
3925
  originalMessage = e.message;
@@ -3909,18 +3942,18 @@ function Build({
3909
3942
  configPath,
3910
3943
  flags
3911
3944
  }) {
3912
- var _a, _b, _c, _d, _e, _f;
3945
+ var _a2, _b, _c, _d, _e, _f;
3913
3946
  const exit = useExit_default();
3914
3947
  const [state, setState] = (0, import_react6.useState)({ state: "initializing" });
3915
3948
  (0, import_react6.useEffect)(() => {
3916
3949
  runBuild({ configPath, flags, updateState }).catch((e) => {
3917
3950
  const error = e.response ? e.response.data : e;
3918
- logForCI_default(error);
3951
+ logForCI(error);
3919
3952
  updateState({ state: "error", error });
3920
3953
  });
3921
3954
  return () => {
3922
- var _a2;
3923
- return (_a2 = state.onUnmount) == null ? void 0 : _a2.call(state);
3955
+ var _a3;
3956
+ return (_a3 = state.onUnmount) == null ? void 0 : _a3.call(state);
3924
3957
  };
3925
3958
  }, []);
3926
3959
  function updateState(changes) {
@@ -3943,7 +3976,7 @@ function Build({
3943
3976
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3944
3977
  MainLayout_default,
3945
3978
  {
3946
- appName: state.build.appName || ((_a = state.appPkg) == null ? void 0 : _a.name) || "",
3979
+ appName: state.build.appName || ((_a2 = state.appPkg) == null ? void 0 : _a2.name) || "",
3947
3980
  appVersion: state.build.appVersion || ((_b = state.appPkg) == null ? void 0 : _b.version) || "",
3948
3981
  build: state.build,
3949
3982
  commandUsed,
@@ -4023,8 +4056,7 @@ var loginFields = [
4023
4056
  placeholder: "name@email.com",
4024
4057
  Input: TextInput_default,
4025
4058
  validate: (value) => {
4026
- if (!value)
4027
- return "Required";
4059
+ if (!value) return "Required";
4028
4060
  }
4029
4061
  },
4030
4062
  {
@@ -4033,8 +4065,7 @@ var loginFields = [
4033
4065
  placeholder: "********",
4034
4066
  Input: TextInput_default,
4035
4067
  validate: (value) => {
4036
- if (!value)
4037
- return "Required";
4068
+ if (!value) return "Required";
4038
4069
  },
4039
4070
  mask: "*"
4040
4071
  }
@@ -4050,11 +4081,11 @@ var Login = ({ setIsLoggedIn }) => {
4050
4081
  setActiveField(0);
4051
4082
  };
4052
4083
  const onSubmitLogin = async ({ email, accessToken }) => {
4053
- var _a, _b;
4084
+ var _a2, _b;
4054
4085
  setFailureMessage(null);
4055
4086
  setIsSubmittingForm(true);
4056
4087
  try {
4057
- const jwtToken = await postToFirebaseFunction_default("loginWithAccessToken", {
4088
+ const jwtToken = await postToFirebaseFunction("loginWithAccessToken", {
4058
4089
  email,
4059
4090
  accessToken
4060
4091
  });
@@ -4070,13 +4101,12 @@ var Login = ({ setIsLoggedIn }) => {
4070
4101
  setError(err);
4071
4102
  } else {
4072
4103
  onFailure(
4073
- `Login unsuccessful: ${((_b = (_a = err == null ? void 0 : err.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || err.message}`
4104
+ `Login unsuccessful: ${((_b = (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || err.message}`
4074
4105
  );
4075
4106
  }
4076
4107
  }
4077
4108
  };
4078
- if (error)
4079
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorDisplay, { error });
4109
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ErrorDisplay, { error });
4080
4110
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4081
4111
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink14.Text, { children: "You are not currently logged in." }),
4082
4112
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ink14.Text, { children: "Log in below:" }),
@@ -4153,7 +4183,7 @@ var LoginHOC = ({ children, isInteractive = true }) => {
4153
4183
  const { TODESKTOP_ACCESS_TOKEN, TODESKTOP_EMAIL } = getEnvironmentVariables_default();
4154
4184
  try {
4155
4185
  if (TODESKTOP_ACCESS_TOKEN && TODESKTOP_EMAIL) {
4156
- const newJwtToken = await postToFirebaseFunction_default(
4186
+ const newJwtToken = await postToFirebaseFunction(
4157
4187
  "loginWithAccessToken",
4158
4188
  {
4159
4189
  email: TODESKTOP_EMAIL,
@@ -4162,8 +4192,7 @@ var LoginHOC = ({ children, isInteractive = true }) => {
4162
4192
  );
4163
4193
  if (newJwtToken) {
4164
4194
  userCreds = await signInWithCustomToken(newJwtToken);
4165
- if (userCreds.user)
4166
- setIsLoggedIn(true);
4195
+ if (userCreds.user) setIsLoggedIn(true);
4167
4196
  }
4168
4197
  } else if (!isRawModeSupported || import_is_ci4.default) {
4169
4198
  setError(
@@ -4181,25 +4210,23 @@ var LoginHOC = ({ children, isInteractive = true }) => {
4181
4210
  try {
4182
4211
  if (!userCreds && jwtToken) {
4183
4212
  userCreds = await signInWithCustomToken(jwtToken);
4184
- if (userCreds.user)
4185
- setIsLoggedIn(true);
4213
+ if (userCreds.user) setIsLoggedIn(true);
4186
4214
  }
4187
- } catch (err) {
4215
+ } catch {
4188
4216
  }
4189
4217
  try {
4190
4218
  if (!userCreds && accessToken && email) {
4191
- const newJwtToken = await postToFirebaseFunction_default(
4219
+ const newJwtToken = await postToFirebaseFunction(
4192
4220
  "loginWithAccessToken",
4193
4221
  { email, accessToken }
4194
4222
  );
4195
4223
  if (newJwtToken) {
4196
4224
  userCreds = await signInWithCustomToken(newJwtToken);
4197
4225
  setAuthConfig(email, accessToken, newJwtToken);
4198
- if (userCreds.user)
4199
- setIsLoggedIn(true);
4226
+ if (userCreds.user) setIsLoggedIn(true);
4200
4227
  }
4201
4228
  }
4202
- } catch (err) {
4229
+ } catch {
4203
4230
  }
4204
4231
  setEffectDone(true);
4205
4232
  }
@@ -4223,12 +4250,12 @@ LoginHOC.propTypes = {
4223
4250
  var LoginHOC_default = LoginHOC;
4224
4251
 
4225
4252
  // src/components/ErrorBoundary.tsx
4226
- var import_react10 = __toESM(require("react"));
4227
4253
  var Sentry2 = __toESM(require("@sentry/node"));
4254
+ var import_react10 = __toESM(require("react"));
4228
4255
  var ErrorBoundary = class extends import_react10.default.Component {
4229
4256
  constructor(props) {
4230
4257
  super(props);
4231
- this.state = { eventId: null, error: null };
4258
+ this.state = { error: null };
4232
4259
  }
4233
4260
  static getDerivedStateFromError(error) {
4234
4261
  return { error };
@@ -4236,15 +4263,16 @@ var ErrorBoundary = class extends import_react10.default.Component {
4236
4263
  componentDidCatch(error, errorInfo) {
4237
4264
  Sentry2.withScope((scope) => {
4238
4265
  scope.setExtras(errorInfo);
4239
- const eventId = Sentry2.captureException(error);
4240
- this.setState({ eventId });
4266
+ Sentry2.captureException(error);
4241
4267
  });
4242
4268
  }
4243
4269
  render() {
4244
- if (this.state.error) {
4245
- throw this.state.error;
4270
+ const { children } = this.props;
4271
+ const { error } = this.state;
4272
+ if (error) {
4273
+ throw error;
4246
4274
  }
4247
- return this.props.children;
4275
+ return children;
4248
4276
  }
4249
4277
  };
4250
4278
  var ErrorBoundary_default = ErrorBoundary;
@@ -4347,7 +4375,6 @@ var getCollection = async (collectionRef) => {
4347
4375
  };
4348
4376
  var acceptedUsersCollection = (id) => (0, import_firestore12.collection)(firestore_default, `users/${id}/acceptedUsers`);
4349
4377
  var findAppUserId = async (appId) => {
4350
- var _a;
4351
4378
  const authUser = currentUser();
4352
4379
  if (!(authUser == null ? void 0 : authUser.uid)) {
4353
4380
  throw new Error("A signed-in Firebase user is required");
@@ -4357,7 +4384,7 @@ var findAppUserId = async (appId) => {
4357
4384
  );
4358
4385
  const primaryUser = {
4359
4386
  id: authUser.uid,
4360
- label: (_a = authUser.email) != null ? _a : authUser.uid
4387
+ label: authUser.email ?? authUser.uid
4361
4388
  };
4362
4389
  const users = [
4363
4390
  primaryUser,
@@ -4367,8 +4394,7 @@ var findAppUserId = async (appId) => {
4367
4394
  try {
4368
4395
  const docRef = (0, import_firestore12.doc)(firestore_default, `users/${user.id}/applications/${appId}`);
4369
4396
  const docSnap = await (0, import_firestore12.getDoc)(docRef);
4370
- if (docSnap.exists())
4371
- return user;
4397
+ if (docSnap.exists()) return user;
4372
4398
  } catch (err) {
4373
4399
  console.error(err);
4374
4400
  }
@@ -4401,7 +4427,7 @@ var ViewBuild = ({ commandUsed, id, configPath }) => {
4401
4427
  });
4402
4428
  const onError = (e) => {
4403
4429
  const error2 = e.response ? e.response.data : e;
4404
- logForCI_default(error2);
4430
+ logForCI(error2);
4405
4431
  setState((prevState) => ({
4406
4432
  ...prevState,
4407
4433
  error: error2
@@ -4506,7 +4532,7 @@ var ViewBuild = ({ commandUsed, id, configPath }) => {
4506
4532
  );
4507
4533
  };
4508
4534
  ViewBuild.propTypes = {
4509
- id: (props, propName, componentName) => {
4535
+ id: (props, _propName, componentName) => {
4510
4536
  if ([props.id, props.shouldViewLatest].filter(Boolean).length !== 1) {
4511
4537
  return new Error(
4512
4538
  `Exactly one of 'id' and 'shouldViewLatest' must be specified in '${componentName}'`
@@ -4520,19 +4546,6 @@ ViewBuild.propTypes = {
4520
4546
  }
4521
4547
  },
4522
4548
  commandUsed: import_prop_types10.default.string.isRequired,
4523
- shouldViewLatest: (props, propName, componentName) => {
4524
- if ([props.id, props.shouldViewLatest].filter(Boolean).length !== 1) {
4525
- return new Error(
4526
- `Exactly one of 'id' and 'shouldViewLatest' must be specified in '${componentName}'`
4527
- );
4528
- }
4529
- const type = typeof props.shouldViewLatest;
4530
- if (!["boolean", "undefined"].includes(type)) {
4531
- return new Error(
4532
- `'shouldViewLatest' is a '${type}', not a boolean, in '${componentName}'.`
4533
- );
4534
- }
4535
- },
4536
4549
  configPath: import_prop_types10.default.string
4537
4550
  };
4538
4551
  var ViewBuild_default = ViewBuild;
@@ -4564,7 +4577,7 @@ var OngoingBuildGuard = ({
4564
4577
  try {
4565
4578
  const applicationId = getProjectConfig(configPath).config.id;
4566
4579
  const { id } = await findAppUserId_default(applicationId);
4567
- const now = new Date();
4580
+ const now = /* @__PURE__ */ new Date();
4568
4581
  const twentyFourHoursAgo = new Date(
4569
4582
  now.getTime() - 24 * 60 * 60 * 1e3
4570
4583
  );
@@ -4699,7 +4712,7 @@ var useAnalyticsCommand = (command, flags = {}, properties = {}) => {
4699
4712
  ...getProjectConfig()
4700
4713
  };
4701
4714
  }
4702
- } catch (err) {
4715
+ } catch {
4703
4716
  }
4704
4717
  (0, import_react13.useEffect)(() => {
4705
4718
  const authUnsubscribe = onUserAuth(async (user) => {
@@ -4720,7 +4733,7 @@ var useAnalyticsCommand = (command, flags = {}, properties = {}) => {
4720
4733
  },
4721
4734
  () => setTrackingAttempt(true)
4722
4735
  );
4723
- authUnsubscribe && authUnsubscribe();
4736
+ authUnsubscribe == null ? void 0 : authUnsubscribe();
4724
4737
  }
4725
4738
  );
4726
4739
  }
@@ -4846,10 +4859,10 @@ var TableRow = ({
4846
4859
  }),
4847
4860
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ink23.Text, { children: " \u2502" })
4848
4861
  ] });
4849
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_ink23.Box, { flexDirection: "column", children: [
4862
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_ink23.Box, { flexDirection: "column", children: [
4850
4863
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ink23.Text, { children: topLine }),
4851
4864
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ink23.Box, { children: content })
4852
- ] }) });
4865
+ ] });
4853
4866
  };
4854
4867
  TableRow.propTypes = {
4855
4868
  data: import_prop_types14.default.object.isRequired,
@@ -4873,7 +4886,7 @@ var TableBody = ({ data, getCellTextProps, keyDetails }) => {
4873
4886
  )) });
4874
4887
  };
4875
4888
  TableBody.propTypes = {
4876
- data: (props, propName, componentName) => {
4889
+ data: (props, _propName, componentName) => {
4877
4890
  const type = typeof props.data;
4878
4891
  if (Array.isArray("array")) {
4879
4892
  return new Error(
@@ -4924,7 +4937,7 @@ var Table = ({ data, getCellTextProps }) => {
4924
4937
  ] });
4925
4938
  };
4926
4939
  Table.propTypes = {
4927
- data: (props, propName, componentName) => {
4940
+ data: (props, _propName, componentName) => {
4928
4941
  const type = typeof props.data;
4929
4942
  if (Array.isArray("array")) {
4930
4943
  return new Error(
@@ -4983,7 +4996,7 @@ async function getBuilds({
4983
4996
 
4984
4997
  // src/utilities/getRelativeDateFromDateString.ts
4985
4998
  var dateFns = __toESM(require("date-fns"));
4986
- var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), new Date()) + " ago";
4999
+ var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), /* @__PURE__ */ new Date()) + " ago";
4987
5000
 
4988
5001
  // src/components/SyntaxHighlight.tsx
4989
5002
  var import_chalk2 = __toESM(require("chalk"));
@@ -5106,7 +5119,7 @@ var ViewBuilds = ({
5106
5119
  };
5107
5120
  });
5108
5121
  }).catch((e) => {
5109
- logForCI_default(e);
5122
+ logForCI(e);
5110
5123
  setState((previousState) => ({
5111
5124
  ...previousState,
5112
5125
  error: e,
@@ -5144,12 +5157,12 @@ var ViewBuilds = ({
5144
5157
  }
5145
5158
  if (builds.length) {
5146
5159
  const formatData = (builds2) => builds2.map((build) => ({
5147
- ID: build.id,
5148
- Version: build.appVersion || "n/a",
5160
+ "ID": build.id,
5161
+ "Version": build.appVersion || "n/a",
5149
5162
  "Creation date": getRelativeDateFromDateString_default(build.createdAt),
5150
- Status: capitalize_default(build.status),
5163
+ "Status": capitalize_default(build.status),
5151
5164
  "Release date": build.releasedAt ? getRelativeDateFromDateString_default(build.releasedAt) : "Unreleased",
5152
- Owner: user ? user.label : "unknown"
5165
+ "Owner": user ? user.label : "unknown"
5153
5166
  }));
5154
5167
  const getCellTextProps = ({ key, props, value }) => {
5155
5168
  const result = { ...props };
@@ -5331,7 +5344,7 @@ var SelectTable = ({ data, onSelect }) => {
5331
5344
  ] });
5332
5345
  };
5333
5346
  SelectTable.propTypes = {
5334
- data: (props, propName, componentName) => {
5347
+ data: (props, _propName, componentName) => {
5335
5348
  const type = typeof props.data;
5336
5349
  if (Array.isArray("array")) {
5337
5350
  return new Error(
@@ -5358,7 +5371,6 @@ async function getBuildById({
5358
5371
  buildId,
5359
5372
  userId
5360
5373
  }) {
5361
- var _a;
5362
5374
  logger_default.debug({ appId, buildId }, "getBuildById");
5363
5375
  const snapshot = await (0, import_firestore19.getDoc)(
5364
5376
  (0, import_firestore19.doc)(firestore_default, `users/${userId}/applications/${appId}/builds/${buildId}`)
@@ -5366,7 +5378,7 @@ async function getBuildById({
5366
5378
  if (!snapshot.exists()) {
5367
5379
  return null;
5368
5380
  }
5369
- return (_a = readDocumentSnapshot(snapshot)) != null ? _a : null;
5381
+ return readDocumentSnapshot(snapshot) ?? null;
5370
5382
  }
5371
5383
 
5372
5384
  // src/utilities/getLatestReleasedBuild.ts
@@ -5374,14 +5386,14 @@ async function getLatestReleasedBuild({
5374
5386
  appId,
5375
5387
  userId
5376
5388
  }) {
5377
- var _a, _b;
5389
+ var _a2, _b;
5378
5390
  const appRef = (0, import_firestore21.doc)(firestore_default, `users/${userId}/applications/${appId}`);
5379
5391
  const appSnapshot = await (0, import_firestore21.getDoc)(appRef);
5380
5392
  const app2 = readDocumentSnapshot(appSnapshot);
5381
5393
  if (!app2) {
5382
5394
  throw new Error(`Application with ID of ${appId} doesn't exist.`);
5383
5395
  }
5384
- if ((_a = app2.meta) == null ? void 0 : _a.latestReleaseBuildId) {
5396
+ if ((_a2 = app2.meta) == null ? void 0 : _a2.latestReleaseBuildId) {
5385
5397
  return await getBuildById({
5386
5398
  buildId: (_b = app2.meta) == null ? void 0 : _b.latestReleaseBuildId,
5387
5399
  appId,
@@ -5523,10 +5535,10 @@ async function getBuildItems({
5523
5535
  userId
5524
5536
  });
5525
5537
  return rawBuilds.filter((build) => buildFilter({ build, latestReleasedBuild })).slice(0, 5).map((build) => ({
5526
- ID: build.id,
5527
- Version: build.appVersion || "unknown",
5538
+ "ID": build.id,
5539
+ "Version": build.appVersion || "unknown",
5528
5540
  "Creation date": getRelativeDateFromDateString_default(build.createdAt),
5529
- Owner: userName || "unknown"
5541
+ "Owner": userName || "unknown"
5530
5542
  }));
5531
5543
  }
5532
5544
 
@@ -5538,7 +5550,7 @@ async function getBuildAttributes({
5538
5550
  buildId,
5539
5551
  configPath
5540
5552
  }) {
5541
- var _a;
5553
+ var _a2;
5542
5554
  const {
5543
5555
  id: appId,
5544
5556
  nodeVersion,
@@ -5546,7 +5558,7 @@ async function getBuildAttributes({
5546
5558
  pnpmVersion
5547
5559
  } = getProjectConfig(configPath).config;
5548
5560
  const { id: userId } = await findAppUserId_default(appId);
5549
- const contextUserId = (_a = currentUser()) == null ? void 0 : _a.uid;
5561
+ const contextUserId = (_a2 = currentUser()) == null ? void 0 : _a2.uid;
5550
5562
  const build = await fetchBuild({ appId, buildId, userId });
5551
5563
  return {
5552
5564
  appId,
@@ -5625,7 +5637,7 @@ function ReleaseBuildView({
5625
5637
  commandUsed,
5626
5638
  state
5627
5639
  }) {
5628
- var _a, _b;
5640
+ var _a2, _b;
5629
5641
  switch (state.state) {
5630
5642
  case "build-error": {
5631
5643
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
@@ -5633,7 +5645,7 @@ function ReleaseBuildView({
5633
5645
  {
5634
5646
  build: state.build,
5635
5647
  description: "Can't release build",
5636
- message: ((_a = state.error) == null ? void 0 : _a.message) || "Internal build error"
5648
+ message: ((_a2 = state.error) == null ? void 0 : _a2.message) || "Internal build error"
5637
5649
  }
5638
5650
  );
5639
5651
  }
@@ -5699,7 +5711,7 @@ async function releaseBuildWorkflow({
5699
5711
  updateState({ build });
5700
5712
  updateState({ state: "releasing" });
5701
5713
  await releaseBuild({ appId, buildId });
5702
- logForCI_default("Released!");
5714
+ logForCI("Released!");
5703
5715
  updateState({ state: "complete" });
5704
5716
  } catch (e) {
5705
5717
  const error = CliError.from(e);
@@ -5718,7 +5730,7 @@ function isBuildTestable(build) {
5718
5730
  try {
5719
5731
  validateBuild(build);
5720
5732
  return true;
5721
- } catch (e) {
5733
+ } catch {
5722
5734
  return false;
5723
5735
  }
5724
5736
  }
@@ -5736,7 +5748,7 @@ var defaultVM = {
5736
5748
  imageVersion: ""
5737
5749
  };
5738
5750
  function makeProgress(build) {
5739
- var _a, _b, _c, _d, _e, _f, _g;
5751
+ var _a2, _b, _c, _d, _e, _f, _g;
5740
5752
  const defaultProgress = {
5741
5753
  message: "Starting",
5742
5754
  progress: 0,
@@ -5746,7 +5758,7 @@ function makeProgress(build) {
5746
5758
  };
5747
5759
  const linux = {
5748
5760
  ...defaultProgress,
5749
- ...(_a = build.smokeTest) == null ? void 0 : _a.linux,
5761
+ ...(_a2 = build.smokeTest) == null ? void 0 : _a2.linux,
5750
5762
  shouldSkip: ((_b = build.linux) == null ? void 0 : _b.shouldSkip) || false
5751
5763
  };
5752
5764
  const mac = {
@@ -5960,7 +5972,7 @@ function ReleaseConfirmation({
5960
5972
  disabled = false,
5961
5973
  loadData = loadBuildsData
5962
5974
  }) {
5963
- var _a;
5975
+ var _a2;
5964
5976
  const [state, setState] = (0, import_react20.useState)({
5965
5977
  state: disabled ? "bypass" : "loading"
5966
5978
  });
@@ -5985,7 +5997,7 @@ function ReleaseConfirmation({
5985
5997
  {
5986
5998
  build: state.build,
5987
5999
  description: "Can't release build",
5988
- message: ((_a = state.error) == null ? void 0 : _a.message) || "Internal build error"
6000
+ message: ((_a2 = state.error) == null ? void 0 : _a2.message) || "Internal build error"
5989
6001
  }
5990
6002
  );
5991
6003
  }
@@ -6214,7 +6226,7 @@ function Cancellation({
6214
6226
  const [error, setError] = (0, import_react21.useState)();
6215
6227
  const onInput = useInput_default();
6216
6228
  const exit = useExit_default();
6217
- onInput(async (input, key) => {
6229
+ onInput(async (_input, key) => {
6218
6230
  if (key.escape) {
6219
6231
  cancel();
6220
6232
  }
@@ -6322,7 +6334,7 @@ function SmokeTestView({
6322
6334
  commandUsed = "",
6323
6335
  state
6324
6336
  }) {
6325
- var _a, _b, _c, _d;
6337
+ var _a2, _b, _c, _d;
6326
6338
  switch (state.state) {
6327
6339
  case "build-error": {
6328
6340
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -6330,7 +6342,7 @@ function SmokeTestView({
6330
6342
  {
6331
6343
  build: state.build,
6332
6344
  description: "Can't finish smoke test",
6333
- message: (_a = state.error) == null ? void 0 : _a.message
6345
+ message: (_a2 = state.error) == null ? void 0 : _a2.message
6334
6346
  }
6335
6347
  );
6336
6348
  }
@@ -6379,12 +6391,12 @@ async function cancelSmokeTest({
6379
6391
  buildId,
6380
6392
  userId
6381
6393
  }) {
6382
- var _a;
6383
- await postToFirebaseFunction_default("cancelSmokeTest_HTTP", {
6394
+ var _a2;
6395
+ await postToFirebaseFunction("cancelSmokeTest_HTTP", {
6384
6396
  appId,
6385
6397
  buildId,
6386
6398
  userId,
6387
- idToken: await ((_a = currentUser()) == null ? void 0 : _a.getIdToken())
6399
+ idToken: await ((_a2 = currentUser()) == null ? void 0 : _a2.getIdToken())
6388
6400
  });
6389
6401
  }
6390
6402
 
@@ -6398,9 +6410,9 @@ async function queueSmokeTest({
6398
6410
  pnpmVersion,
6399
6411
  userId
6400
6412
  }) {
6401
- var _a;
6413
+ var _a2;
6402
6414
  try {
6403
- await postToFirebaseFunction_default("queueSmokeTest_HTTP", {
6415
+ await postToFirebaseFunction("queueSmokeTest_HTTP", {
6404
6416
  appId,
6405
6417
  buildId,
6406
6418
  nodeVersion,
@@ -6408,7 +6420,7 @@ async function queueSmokeTest({
6408
6420
  pnpmVersion,
6409
6421
  userId,
6410
6422
  contextUserId,
6411
- idToken: await ((_a = currentUser()) == null ? void 0 : _a.getIdToken())
6423
+ idToken: await ((_a2 = currentUser()) == null ? void 0 : _a2.getIdToken())
6412
6424
  });
6413
6425
  } catch (e) {
6414
6426
  logger_default.error({ error: e });
@@ -6567,8 +6579,8 @@ async function smokeTestWorkflow({
6567
6579
  }
6568
6580
  }
6569
6581
  function buildCanBeCanceled(build) {
6570
- var _a, _b;
6571
- if ((_a = build == null ? void 0 : build.smokeTest) == null ? void 0 : _a.isCanceled) {
6582
+ var _a2, _b;
6583
+ if ((_a2 = build == null ? void 0 : build.smokeTest) == null ? void 0 : _a2.isCanceled) {
6572
6584
  return false;
6573
6585
  }
6574
6586
  return Boolean((_b = build == null ? void 0 : build.smokeTest) == null ? void 0 : _b.buildServerExecutionId);
@@ -6614,12 +6626,12 @@ var exitIfCLIOutOfDate_default = () => {
6614
6626
  const commandToUpdate = import_chalk3.default.greenBright(
6615
6627
  `npm install ${import_is_installed_globally.default ? "-g" : "--save-dev"} @todesktop/cli`
6616
6628
  );
6617
- console.log(
6629
+ console.warn(
6618
6630
  `Your version of @todesktop/cli is out of date.
6619
6631
  Run ${commandToUpdate} to update to v${latest}.`
6620
6632
  );
6621
6633
  if (!import_semver3.default.satisfies(latest, `^${pkg.version}`)) {
6622
- console.log(`CLI is exiting because it is out out of date.`);
6634
+ console.error(`CLI is exiting because it is out out of date.`);
6623
6635
  process.exit(1);
6624
6636
  }
6625
6637
  }
@@ -6637,7 +6649,7 @@ var package_default = {
6637
6649
  access: "public"
6638
6650
  },
6639
6651
  name: "@todesktop/cli",
6640
- version: "1.15.2",
6652
+ version: "1.18.1",
6641
6653
  license: "MIT",
6642
6654
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
6643
6655
  homepage: "https://todesktop.com/cli",
@@ -6652,23 +6664,20 @@ var package_default = {
6652
6664
  node: ">=16"
6653
6665
  },
6654
6666
  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",
6660
- lint: "npm run lint:types && npm run lint:styles",
6661
- "lint:styles": "eslint src test .eslintrc.js && prettier --check .",
6662
- format: "prettier --write .",
6663
- "lint:types": "tsc && tsc-strict",
6664
- "lint--fix": "eslint src test --fix",
6667
+ build: "node scripts/esbuild.js",
6668
+ dev: "node scripts/esbuild.js --link --watch --stage dev",
6669
+ "dev:local:prod": "node scripts/esbuild.js --link --watch --stage prod-local",
6670
+ "dev:prod": "node scripts/esbuild.js --link --watch",
6665
6671
  "docs:generate": "node scripts/generate-readme.js",
6672
+ format: "prettier . --write && eslint --fix",
6673
+ lint: "prettier . --check && eslint",
6666
6674
  "types:generate": "node scripts/generate-types.js",
6667
- release: "npm run docs:generate && npm run build && npx np --tag=latest",
6675
+ release: "npm run docs:generate && npm run build && pnpx np --tag=latest",
6668
6676
  "release-beta": "npm run docs:generate && npm run build && npx np --any-branch --no-tests --tag=beta",
6669
6677
  test: "ava",
6678
+ "test:e2e": "node test/output-snapshots/output.test.js",
6670
6679
  "test--watch": "npm test -- --watch",
6671
- postinstall: "node scripts/postinstall.js"
6680
+ typecheck: "tsc --noEmit"
6672
6681
  },
6673
6682
  files: [
6674
6683
  "scripts/postinstall.js",
@@ -6723,38 +6732,27 @@ var package_default = {
6723
6732
  "xdg-basedir": "^4.0.0"
6724
6733
  },
6725
6734
  devDependencies: {
6735
+ "@todesktop/dev-config": "workspace:*",
6726
6736
  "@todesktop/shared": "^7.189.6",
6727
6737
  "@types/bunyan": "^1.8.6",
6728
6738
  "@types/is-ci": "^3.0.4",
6729
6739
  "@types/node": "^20.8.4",
6730
6740
  "@types/react": "^18.0.26",
6731
- "@typescript-eslint/eslint-plugin": "^5.46.1",
6732
- "@typescript-eslint/parser": "^5.46.1",
6733
6741
  ava: "^4.3.1",
6734
6742
  "cp-cli": "^2.0.0",
6735
- esbuild: "^0.16.5",
6743
+ esbuild: "^0.25.10",
6736
6744
  "esbuild-register": "^3.4.1",
6737
- eslint: "^8.29.0",
6738
- "eslint-config-prettier": "^8.5.0",
6739
- "eslint-plugin-import": "^2.26.0",
6740
- "eslint-plugin-node": "^11.1.0",
6741
- "eslint-plugin-prettier": "^4.2.1",
6742
- "eslint-plugin-promise": "^6.1.1",
6743
- "eslint-plugin-react": "^7.31.11",
6744
- "eslint-plugin-react-hooks": "^4.6.0",
6745
- "eslint-plugin-standard": "^4.1.0",
6745
+ eslint: "catalog:",
6746
6746
  execa: "^4.0.3",
6747
6747
  "extract-zip": "^2.0.1",
6748
6748
  "fs-extra": "^9.0.1",
6749
- husky: "^4.3.0",
6750
6749
  "ink-testing-library": "^2.1.0",
6751
6750
  "json-schema-to-typescript": "^15.0.4",
6752
- "lint-staged": "^10.2.11",
6753
6751
  "package-json-type": "^1.0.3",
6754
- prettier: "^2.8.1",
6752
+ prettier: "catalog:",
6755
6753
  proxyquire: "^2.1.3",
6756
6754
  sinon: "^9.0.3",
6757
- typescript: "^4.9.4",
6755
+ typescript: "catalog:",
6758
6756
  "typescript-strict-plugin": "^2.2.1"
6759
6757
  },
6760
6758
  ava: {
@@ -6777,29 +6775,6 @@ var package_default = {
6777
6775
  ],
6778
6776
  timeout: "10m"
6779
6777
  },
6780
- "lint-staged": {
6781
- "**/*.{js,ts,tsx}": [
6782
- "eslint src --fix",
6783
- "git add"
6784
- ]
6785
- },
6786
- husky: {
6787
- hooks: {
6788
- "pre-commit": "lint-staged"
6789
- }
6790
- },
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
6778
  packageExtensions: {
6804
6779
  "ink-progress-bar@*": {
6805
6780
  dependencies: {
@@ -6822,33 +6797,33 @@ var initSentry_default = () => {
6822
6797
  const scope = Sentry3.getCurrentScope();
6823
6798
  try {
6824
6799
  scope.setUser({ email: getAuthConfig().email });
6825
- } catch (err) {
6800
+ } catch {
6826
6801
  }
6827
6802
  try {
6828
6803
  scope.setContext("os", {
6829
6804
  name: import_os2.default.platform(),
6830
6805
  version: import_os2.default.release()
6831
6806
  });
6832
- } catch (err) {
6807
+ } catch {
6833
6808
  }
6834
6809
  try {
6835
6810
  scope.setContext("runtime", {
6836
6811
  name: "Node.js",
6837
6812
  version: process.version
6838
6813
  });
6839
- } catch (err) {
6814
+ } catch {
6840
6815
  }
6841
6816
  try {
6842
6817
  scope.setContext("app", {
6843
6818
  app_name: package_default.name,
6844
6819
  app_version: package_default.version
6845
6820
  });
6846
- } catch (err) {
6821
+ } catch {
6847
6822
  }
6848
6823
  try {
6849
6824
  const configResult = getProjectConfig();
6850
6825
  scope.setExtra("config", configResult);
6851
- } catch (err) {
6826
+ } catch {
6852
6827
  }
6853
6828
  };
6854
6829