@todesktop/cli 1.15.0 → 1.15.2

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/README.md CHANGED
@@ -42,7 +42,7 @@ Create a `todesktop.json` file in the root of your Electron project.
42
42
 
43
43
  ```json
44
44
  {
45
- "$schema": "https://unpkg.com/@todesktop/cli@1.14.0/schemas/schema.json",
45
+ "$schema": "https://unpkg.com/@todesktop/cli@1.15.1/schemas/schema.json",
46
46
  "schemaVersion": 1
47
47
  "id": "your-todesktop-id",
48
48
  "icon": "./desktop-icon.png",
@@ -272,7 +272,7 @@ To enable JSON validation and IntelliSense for your `todesktop.json` file in com
272
272
  - For example, if using a hosted version of the schema:
273
273
  ```json
274
274
  {
275
- "$schema": "https://unpkg.com/@todesktop/cli@1.14.0/schemas/schema.json",
275
+ "$schema": "https://unpkg.com/@todesktop/cli@1.15.1/schemas/schema.json",
276
276
  "id": "your-todesktop-id"
277
277
  }
278
278
  ```
@@ -1334,6 +1334,14 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1334
1334
 
1335
1335
  ## Changelog
1336
1336
 
1337
+ ### v1.15.2
1338
+
1339
+ - Improved error handling in releaseBuild function
1340
+
1341
+ ### v1.15.1
1342
+
1343
+ - Update dependencies to latest non-breaking versions.
1344
+
1337
1345
  ### v1.15.0
1338
1346
 
1339
1347
  - Add support for `todesktop.ts` configuration file with full TypeScript type checking and IntelliSense.
package/dist/cli.js CHANGED
@@ -14,6 +14,10 @@ var __copyProps = (to, from, except, desc) => {
14
14
  return to;
15
15
  };
16
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
17
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
22
  mod
19
23
  ));
@@ -73,7 +77,10 @@ function sanitizeFields(obj) {
73
77
  const lowerKey = key.toLowerCase();
74
78
  const value = copy[key];
75
79
  if (SENSITIVE_FIELD_KEY_SUBSTRINGS.some(
76
- (substring) => lowerKey.includes(substring) && !lowerKey.startsWith("$")
80
+ (substring) => (
81
+ // Fields that start with `$` are references to secrets (and not secrets themselves) so keep them in logs because they are useful.
82
+ lowerKey.includes(substring) && !lowerKey.startsWith("$")
83
+ )
77
84
  )) {
78
85
  copy[key] = "[REDACTED]";
79
86
  } else if (typeof value === "string" && isJWT(value)) {
@@ -344,7 +351,9 @@ var useExit_default = () => {
344
351
  logger_default.debug({ error }, "Exit called");
345
352
  let timeoutId;
346
353
  Promise.race([
354
+ // flush the analytics to make sure all outstanding events are pushed to segment
347
355
  new Promise((resolve5) => flush(() => resolve5())),
356
+ // If it takes longer than 1 second, resolve early to proceed with program exit
348
357
  new Promise(
349
358
  (resolve5) => timeoutId = setTimeout(() => resolve5(), 1e3)
350
359
  )
@@ -491,7 +500,8 @@ var isPlatformBuildRunning = (platformBuild) => {
491
500
  if (!platformBuild) {
492
501
  return false;
493
502
  }
494
- return !platformBuild.shouldSkip && !["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
503
+ return !platformBuild.shouldSkip && // <-- Noteworthy
504
+ !["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
495
505
  };
496
506
 
497
507
  // src/components/BuildProgress.tsx
@@ -967,6 +977,7 @@ var ProgressBar = ({ left, right, percent }) => /* @__PURE__ */ (0, import_jsx_r
967
977
  ProgressBar.propTypes = {
968
978
  left: import_prop_types6.default.number,
969
979
  right: import_prop_types6.default.number,
980
+ // 0 -> 1
970
981
  percent: import_prop_types6.default.number.isRequired
971
982
  };
972
983
  var ProgressBar_default = ProgressBar;
@@ -1245,6 +1256,7 @@ var packageJSON_default = (context) => {
1245
1256
  dependencies: {
1246
1257
  type: "object",
1247
1258
  required: ["@todesktop/runtime"],
1259
+ // custom keyword that checks package names aren't included in dependencies
1248
1260
  excludedDependencies: {
1249
1261
  dependencyKey: "dependencies",
1250
1262
  blacklist: ["@todesktop/cli"]
@@ -2999,19 +3011,36 @@ async function uploadApplicationSource({
2999
3011
  );
3000
3012
  let totalBytes = 0;
3001
3013
  const files = [
3014
+ /*
3015
+ App files (stored in app/ in the ZIP)
3016
+ */
3002
3017
  ...await getAppFiles(config2.appFiles, config2.appPath, appPkgJson),
3018
+ /*
3019
+ Optional extra content files (stored in extraContentFiles/ in the ZIP). Their
3020
+ paths within is the their relative path from the project root so
3021
+ there will be no issues with clashing filenames. We also don't
3022
+ also any file paths in our todesktop.json that are outside of the
3023
+ project directory
3024
+ */
3003
3025
  ...(config2.extraContentFiles || []).map(({ from, to = "." }) => {
3004
3026
  return {
3005
3027
  from,
3006
3028
  to: path7.join("extraContentFiles", to, path7.basename(from))
3007
3029
  };
3008
3030
  }),
3031
+ /*
3032
+ Optional extra resources (stored in extraResources/ in the ZIP).
3033
+ Similar to extra content files above
3034
+ */
3009
3035
  ...(config2.extraResources || []).map(({ from, to = "." }) => {
3010
3036
  return {
3011
3037
  from,
3012
3038
  to: path7.join("extraResources", to, path7.basename(from))
3013
3039
  };
3014
3040
  }),
3041
+ /*
3042
+ Icons (more may be added below)
3043
+ */
3015
3044
  {
3016
3045
  from: config2.icon,
3017
3046
  to: path7.join("icons", "appIcon" + path7.extname(config2.icon))
@@ -4665,7 +4694,9 @@ var SelectTable = ({ data, onSelect }) => {
4665
4694
  });
4666
4695
  };
4667
4696
  const ItemComponent = ({
4697
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4668
4698
  label,
4699
+ // Make it compatible to SelectInput type, not used actually
4669
4700
  index,
4670
4701
  isSelected
4671
4702
  }) => {
@@ -4940,8 +4971,9 @@ async function releaseBuild({
4940
4971
  try {
4941
4972
  await getCallableFirebaseFunction_default("releaseBuild")({ appId, buildId });
4942
4973
  } catch (e) {
4943
- if (isFirebaseFunctionError(e) && (e.code === "failed-precondition" || e.code === "not-found")) {
4944
- throw CliError.from(e, "build-error");
4974
+ if (isFirebaseFunctionError(e)) {
4975
+ const errorType = e.code === "failed-precondition" || e.code === "not-found" ? "build-error" : "error";
4976
+ throw CliError.from(e, errorType);
4945
4977
  } else {
4946
4978
  throw new CliError("Unexpected internal error while releasing build");
4947
4979
  }
@@ -5662,6 +5694,7 @@ function OsProgress({
5662
5694
  error: "red",
5663
5695
  done: "green",
5664
5696
  skipped: "yellow"
5697
+ // Not used actually, just for type matching
5665
5698
  };
5666
5699
  const text = progress.message + (progress.state === "progress" ? "..." : "");
5667
5700
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
@@ -5912,6 +5945,7 @@ async function smokeTestWorkflow({
5912
5945
  const stateMap = {
5913
5946
  done: "complete",
5914
5947
  progress: "complete",
5948
+ // Not actually used, just for TS
5915
5949
  error: "progress-error",
5916
5950
  canceled: "canceled"
5917
5951
  };
@@ -5992,7 +6026,7 @@ var package_default = {
5992
6026
  access: "public"
5993
6027
  },
5994
6028
  name: "@todesktop/cli",
5995
- version: "1.14.0",
6029
+ version: "1.15.1",
5996
6030
  license: "MIT",
5997
6031
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
5998
6032
  homepage: "https://todesktop.com/cli",
@@ -6122,7 +6156,8 @@ var package_default = {
6122
6156
  "**/*.test.tsx",
6123
6157
  "!build/**/*",
6124
6158
  "!test/fixtures/**/*",
6125
- "!test/utilities/**/*"
6159
+ "!test/utilities/**/*",
6160
+ "!worktrees/**/*"
6126
6161
  ],
6127
6162
  require: [
6128
6163
  "esbuild-register",