@todesktop/cli 1.7.4 → 1.7.6

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
@@ -239,11 +239,11 @@ The path can be absolute or a relative path from the project root. The directory
239
239
 
240
240
  Side note: if your `package.json` contains a `postinstall` script which references scripts, these must be accessible within the `appPath` directory as only the `appPath` is uploaded to our servers.
241
241
 
242
- ### `appProtocolScheme` - (optional) string
242
+ ### `appProtocolScheme` - (optional) string | string[]
243
243
 
244
244
  Default: no protocol scheme is registered.
245
245
 
246
- Example: `word`.
246
+ Example: `word` or `[word, ...]`.
247
247
 
248
248
  If you want to register a protocol for your application (e.g. `example://`) and or support deeplinking, you will need to use this option. If your desired protocol is `example://`, you would set `"appProtocolScheme": "example"`. NOTE: these features also require additional application logic.
249
249
 
@@ -548,12 +548,25 @@ Default: The root [`icon`](#icon---string) is used.
548
548
 
549
549
  The path to your application's Mac desktop icon. It must be an ICNS or PNG.
550
550
 
551
+ #### `mac.requirements` - (optional) string
552
+
553
+ Example: `./requirements.txt`.
554
+ Default: No requirements file is used by default.
555
+
556
+ The path to the [requirements file](https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used when signing your application.
557
+
551
558
  ### `nodeVersion` - string
552
559
 
553
560
  Example: `18.12.1`.
554
561
 
555
562
  The version of Node.js that ToDesktop should use to build your app.
556
563
 
564
+ ### `npmVersion` - string
565
+
566
+ Example: `9.8.1`.
567
+
568
+ The version of NPM that ToDesktop should use for installation.
569
+
557
570
  ### `packageJson` - (optional) object
558
571
 
559
572
  Default: `{}`
@@ -976,6 +989,15 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
976
989
 
977
990
  ## Changelog
978
991
 
992
+ ### v.7.6
993
+
994
+ - Add support for multiple app protocol schemes
995
+
996
+ ### v1.7.5
997
+
998
+ - Add support for specifying custom `npmVersion` in config
999
+ - Add support for bundling a requirements file for Mac
1000
+
979
1001
  ### v1.7.4
980
1002
 
981
1003
  - Fix: Linux/Windows platform links no longer have mac/zip/{arch} added to the end of the download URL
package/dist/cli.js CHANGED
@@ -14,10 +14,6 @@ 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.
21
17
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
18
  mod
23
19
  ));
@@ -308,16 +304,11 @@ var useExit_default = () => {
308
304
  return (error = void 0) => {
309
305
  logger_default.debug({ error }, "Exit called");
310
306
  firestore_default.terminate().catch(
311
- (e) => (
312
- // Ignore
313
- logger_default.error(e)
314
- )
307
+ (e) => logger_default.error(e)
315
308
  );
316
309
  let timeoutId;
317
310
  Promise.race([
318
- // flush the analytics to make sure all outstanding events are pushed to segment
319
311
  new Promise((resolve4) => flush(() => resolve4())),
320
- // If it takes longer than 1 second, resolve early to proceed with program exit
321
312
  new Promise(
322
313
  (resolve4) => timeoutId = setTimeout(() => resolve4(), 1e3)
323
314
  )
@@ -464,8 +455,7 @@ var isPlatformBuildRunning = (platformBuild) => {
464
455
  if (!platformBuild) {
465
456
  return false;
466
457
  }
467
- return !platformBuild.shouldSkip && // <-- Noteworthy
468
- !["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
458
+ return !platformBuild.shouldSkip && !["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
469
459
  };
470
460
 
471
461
  // src/components/BuildProgress.tsx
@@ -611,7 +601,6 @@ var ProgressBar = ({ left, right, percent }) => /* @__PURE__ */ (0, import_jsx_r
611
601
  ProgressBar.propTypes = {
612
602
  left: import_prop_types5.default.number,
613
603
  right: import_prop_types5.default.number,
614
- // 0 -> 1
615
604
  percent: import_prop_types5.default.number.isRequired
616
605
  };
617
606
  var ProgressBar_default = ProgressBar;
@@ -1023,6 +1012,9 @@ function resolveConfigPaths({
1023
1012
  if (config2.mac.entitlements) {
1024
1013
  result.mac.entitlements = resolvePath(config2.mac.entitlements);
1025
1014
  }
1015
+ if (config2.mac.requirements) {
1016
+ result.mac.requirements = resolvePath(config2.mac.requirements);
1017
+ }
1026
1018
  if (config2.mac.icon) {
1027
1019
  result.mac.icon = resolvePath(config2.mac.icon);
1028
1020
  }
@@ -1078,7 +1070,6 @@ var packageJSON_default = (context) => {
1078
1070
  dependencies: {
1079
1071
  type: "object",
1080
1072
  required: ["@todesktop/runtime"],
1081
- // custom keyword that checks package names aren't included in dependencies
1082
1073
  excludedDependencies: {
1083
1074
  dependencyKey: "dependencies",
1084
1075
  blacklist: ["@todesktop/cli"]
@@ -1458,7 +1449,16 @@ var full_default = (context) => {
1458
1449
  },
1459
1450
  minItems: 1
1460
1451
  },
1461
- appProtocolScheme: { type: "string", minLength: 1 },
1452
+ appProtocolScheme: {
1453
+ oneOf: [
1454
+ { type: "string", minLength: 1 },
1455
+ {
1456
+ type: "array",
1457
+ items: { type: "string", minLength: 1 },
1458
+ minItems: 1
1459
+ }
1460
+ ]
1461
+ },
1462
1462
  appPath: {
1463
1463
  type: "string",
1464
1464
  file: {
@@ -1603,7 +1603,16 @@ var full_default = (context) => {
1603
1603
  extendInfo: {
1604
1604
  type: "object"
1605
1605
  },
1606
- icon: getIconSchema()
1606
+ icon: getIconSchema(),
1607
+ requirements: {
1608
+ type: "string",
1609
+ file: {
1610
+ from: context.projectRoot,
1611
+ extensions: ["txt"],
1612
+ mustBeFile: true
1613
+ },
1614
+ minLength: 1
1615
+ }
1607
1616
  }
1608
1617
  },
1609
1618
  dmg: {
@@ -1649,6 +1658,11 @@ var full_default = (context) => {
1649
1658
  validSemver: {},
1650
1659
  minLength: 1
1651
1660
  },
1661
+ npmVersion: {
1662
+ type: "string",
1663
+ validSemver: {},
1664
+ minLength: 1
1665
+ },
1652
1666
  appBuilderLibVersion: {
1653
1667
  type: "string",
1654
1668
  validSemver: {},
@@ -2105,36 +2119,19 @@ var uploadApplicationSource_default = async ({ appId, appPkgJson, buildId, confi
2105
2119
  );
2106
2120
  let totalBytes = 0;
2107
2121
  const files = [
2108
- /*
2109
- App files (stored in app/ in the ZIP)
2110
- */
2111
2122
  ...await getAppFiles(config2.appFiles, config2.appPath, appPkgJson),
2112
- /*
2113
- Optional extra content files (stored in extraContentFiles/ in the ZIP). Their
2114
- paths within is the their relative path from the project root so
2115
- there will be no issues with clashing filenames. We also don't
2116
- also any file paths in our todesktop.json that are outside of the
2117
- project directory
2118
- */
2119
2123
  ...(config2.extraContentFiles || []).map(({ from, to = "." }) => {
2120
2124
  return {
2121
2125
  from,
2122
2126
  to: path8.join("extraContentFiles", to, path8.basename(from))
2123
2127
  };
2124
2128
  }),
2125
- /*
2126
- Optional extra resources (stored in extraResources/ in the ZIP).
2127
- Similar to extra content files above
2128
- */
2129
2129
  ...(config2.extraResources || []).map(({ from, to = "." }) => {
2130
2130
  return {
2131
2131
  from,
2132
2132
  to: path8.join("extraResources", to, path8.basename(from))
2133
2133
  };
2134
2134
  }),
2135
- /*
2136
- Icons (more may be added below)
2137
- */
2138
2135
  {
2139
2136
  from: config2.icon,
2140
2137
  to: path8.join("icons", "appIcon" + path8.extname(config2.icon))
@@ -2164,6 +2161,12 @@ var uploadApplicationSource_default = async ({ appId, appPkgJson, buildId, confi
2164
2161
  to: path8.join("icons", "appIcon-mac" + path8.extname(config2.mac.icon))
2165
2162
  });
2166
2163
  }
2164
+ if (config2.mac.requirements) {
2165
+ files.push({
2166
+ from: config2.mac.requirements,
2167
+ to: path8.join("other", "mac", "requirements.txt")
2168
+ });
2169
+ }
2167
2170
  }
2168
2171
  if (config2.dmg) {
2169
2172
  if (config2.dmg.background) {
@@ -2322,6 +2325,7 @@ var runBuild_default = async ({ onEvent, shouldCodeSign = true, configPath }) =>
2322
2325
  userId: primaryUserId,
2323
2326
  sourceArchiveDetails,
2324
2327
  nodeVersion: config2.nodeVersion,
2328
+ npmVersion: config2.npmVersion,
2325
2329
  appBuilderLibVersion: config2.appBuilderLibVersion
2326
2330
  });
2327
2331
  } catch (e) {
@@ -3379,7 +3383,7 @@ async function getBuilds({
3379
3383
 
3380
3384
  // src/utilities/getRelativeDateFromDateString.ts
3381
3385
  var dateFns = __toESM(require("date-fns"));
3382
- var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), /* @__PURE__ */ new Date()) + " ago";
3386
+ var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), new Date()) + " ago";
3383
3387
 
3384
3388
  // src/components/SyntaxHighlight.tsx
3385
3389
  var import_chalk2 = __toESM(require("chalk"));
@@ -3694,9 +3698,7 @@ var SelectTable = ({ data, onSelect }) => {
3694
3698
  });
3695
3699
  };
3696
3700
  const ItemComponent = ({
3697
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3698
3701
  label,
3699
- // Make it compatible to SelectInput type, not used actually
3700
3702
  index,
3701
3703
  isSelected
3702
3704
  }) => {
@@ -3914,11 +3916,23 @@ async function getBuildAttributes({
3914
3916
  buildId,
3915
3917
  configPath
3916
3918
  }) {
3917
- const { id: appId, nodeVersion } = getProjectConfig(configPath).config;
3919
+ const {
3920
+ id: appId,
3921
+ nodeVersion,
3922
+ npmVersion
3923
+ } = getProjectConfig(configPath).config;
3918
3924
  const { id: userId } = await findAppUserId_default(appId);
3919
3925
  const { uid: contextUserId } = currentUser();
3920
3926
  const build = await fetchBuild({ appId, buildId, userId });
3921
- return { appId, build, buildId, contextUserId, nodeVersion, userId };
3927
+ return {
3928
+ appId,
3929
+ build,
3930
+ buildId,
3931
+ contextUserId,
3932
+ nodeVersion,
3933
+ npmVersion,
3934
+ userId
3935
+ };
3922
3936
  }
3923
3937
  async function fetchBuild({
3924
3938
  appId,
@@ -4472,7 +4486,6 @@ function OsProgress({
4472
4486
  error: "red",
4473
4487
  done: "green",
4474
4488
  skipped: "yellow"
4475
- // Not used actually, just for type matching
4476
4489
  };
4477
4490
  const text = progress.message + (progress.state === "progress" ? "..." : "");
4478
4491
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -4562,6 +4575,7 @@ async function queueSmokeTest({
4562
4575
  buildId,
4563
4576
  contextUserId,
4564
4577
  nodeVersion,
4578
+ npmVersion,
4565
4579
  userId
4566
4580
  }) {
4567
4581
  try {
@@ -4569,6 +4583,7 @@ async function queueSmokeTest({
4569
4583
  appId,
4570
4584
  buildId,
4571
4585
  nodeVersion,
4586
+ npmVersion,
4572
4587
  userId,
4573
4588
  contextUserId
4574
4589
  });
@@ -4679,7 +4694,7 @@ async function smokeTestWorkflow({
4679
4694
  updateState
4680
4695
  }) {
4681
4696
  try {
4682
- const { appId, build, contextUserId, nodeVersion, userId } = await getBuildAttributes({
4697
+ const { appId, build, contextUserId, nodeVersion, npmVersion, userId } = await getBuildAttributes({
4683
4698
  buildId,
4684
4699
  configPath
4685
4700
  });
@@ -4690,6 +4705,7 @@ async function smokeTestWorkflow({
4690
4705
  appId,
4691
4706
  buildId,
4692
4707
  nodeVersion,
4708
+ npmVersion,
4693
4709
  userId,
4694
4710
  contextUserId
4695
4711
  });
@@ -4704,7 +4720,6 @@ async function smokeTestWorkflow({
4704
4720
  const stateMap = {
4705
4721
  done: "complete",
4706
4722
  progress: "complete",
4707
- // Not actually used, just for TS
4708
4723
  error: "progress-error",
4709
4724
  canceled: "canceled"
4710
4725
  };
@@ -4785,7 +4800,7 @@ var package_default = {
4785
4800
  access: "public"
4786
4801
  },
4787
4802
  name: "@todesktop/cli",
4788
- version: "1.7.3",
4803
+ version: "1.7.5",
4789
4804
  license: "MIT",
4790
4805
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
4791
4806
  homepage: "https://todesktop.com/cli",
@@ -4865,7 +4880,7 @@ var package_default = {
4865
4880
  "xdg-basedir": "^4.0.0"
4866
4881
  },
4867
4882
  devDependencies: {
4868
- "@todesktop/shared": "^7.180.0",
4883
+ "@todesktop/shared": "^7.186.6",
4869
4884
  "@types/bunyan": "^1.8.6",
4870
4885
  "@types/react": "^18.0.26",
4871
4886
  "@typescript-eslint/eslint-plugin": "^5.46.1",