@todesktop/cli 1.7.2 → 1.7.4

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
@@ -247,6 +247,12 @@ Example: `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
 
250
+ ### `asar` - (optional) boolean
251
+
252
+ Default: true
253
+
254
+ Whether to package your application's source code within an asar archive. You should only turn this off if you have a good reason to.
255
+
250
256
  ### `asarUnpack` - (optional) boolean or array of glob patterns
251
257
 
252
258
  Default: [`**/*.node`]
@@ -584,7 +590,7 @@ Default: If `yarn.lock` exists, `yarn` is used. If `pnpm-lock.yaml` or `shrinkwr
584
590
 
585
591
  Example: `yarn`
586
592
 
587
- The package manager to use when installing dependencies. Valid values are `npm`, `yarn` or `npm`.
593
+ The package manager to use when installing dependencies. Valid values are `npm`, `yarn` or `pnpm`.
588
594
 
589
595
  ### `schemaVersion` - number
590
596
 
@@ -843,10 +849,10 @@ const { writeFile } = require("fs/promises");
843
849
  module.exports = async ({ appOutDir, packager }) => {
844
850
  if (os.platform() === "darwin") {
845
851
  const appName = packager.appInfo.productFilename;
846
- const appPath = path.join(`${appOutDir}`, `${APP_NAME}.app`);
852
+ const appPath = path.join(`${appOutDir}`, `${appName}.app`);
847
853
  await writeFile(
848
854
  path.join(appPath, "copyright.txt"),
849
- `Copyright © ${new Date().getFullYear()} ${APP_NAME}`
855
+ `Copyright © ${new Date().getFullYear()} ${appName}`
850
856
  );
851
857
  }
852
858
  };
@@ -970,6 +976,23 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
970
976
 
971
977
  ## Changelog
972
978
 
979
+ ### v1.7.4
980
+
981
+ - Fix: Linux/Windows platform links no longer have mac/zip/{arch} added to the end of the download URL
982
+
983
+ ### v1.7.3
984
+
985
+ - Add asar configuration support
986
+
987
+ ### v1.7.1
988
+
989
+ - Add support for specifying custom `appBuilderLibVersion` in config
990
+ - Show suggestion to run a Smoke Test when releasing an untested build
991
+
992
+ ### v1.7.0
993
+
994
+ - Add `todesktop smoke-test` command
995
+
973
996
  ### v1.6.3
974
997
 
975
998
  - Add support for specifying custom `windows.nsisCustomBinary` in config
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
  ));
@@ -304,11 +308,16 @@ var useExit_default = () => {
304
308
  return (error = void 0) => {
305
309
  logger_default.debug({ error }, "Exit called");
306
310
  firestore_default.terminate().catch(
307
- (e) => logger_default.error(e)
311
+ (e) => (
312
+ // Ignore
313
+ logger_default.error(e)
314
+ )
308
315
  );
309
316
  let timeoutId;
310
317
  Promise.race([
318
+ // flush the analytics to make sure all outstanding events are pushed to segment
311
319
  new Promise((resolve4) => flush(() => resolve4())),
320
+ // If it takes longer than 1 second, resolve early to proceed with program exit
312
321
  new Promise(
313
322
  (resolve4) => timeoutId = setTimeout(() => resolve4(), 1e3)
314
323
  )
@@ -393,7 +402,7 @@ var PlatformProgress = ({
393
402
  }) => {
394
403
  let progressIndicator;
395
404
  if (activityType === "done") {
396
- if (process.platform === "darwin") {
405
+ if (platform === "mac") {
397
406
  downloadUrl = import_path3.default.posix.join(downloadUrl, "mac", "zip", process.arch);
398
407
  }
399
408
  progressIndicator = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ink3.Box, { flexDirection: "column", marginBottom: 1, children: [
@@ -455,7 +464,8 @@ var isPlatformBuildRunning = (platformBuild) => {
455
464
  if (!platformBuild) {
456
465
  return false;
457
466
  }
458
- return !platformBuild.shouldSkip && !["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
467
+ return !platformBuild.shouldSkip && // <-- Noteworthy
468
+ !["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
459
469
  };
460
470
 
461
471
  // src/components/BuildProgress.tsx
@@ -601,6 +611,7 @@ var ProgressBar = ({ left, right, percent }) => /* @__PURE__ */ (0, import_jsx_r
601
611
  ProgressBar.propTypes = {
602
612
  left: import_prop_types5.default.number,
603
613
  right: import_prop_types5.default.number,
614
+ // 0 -> 1
604
615
  percent: import_prop_types5.default.number.isRequired
605
616
  };
606
617
  var ProgressBar_default = ProgressBar;
@@ -1067,6 +1078,7 @@ var packageJSON_default = (context) => {
1067
1078
  dependencies: {
1068
1079
  type: "object",
1069
1080
  required: ["@todesktop/runtime"],
1081
+ // custom keyword that checks package names aren't included in dependencies
1070
1082
  excludedDependencies: {
1071
1083
  dependencyKey: "dependencies",
1072
1084
  blacklist: ["@todesktop/cli"]
@@ -1455,6 +1467,10 @@ var full_default = (context) => {
1455
1467
  mustBeElectronApp: true
1456
1468
  }
1457
1469
  },
1470
+ asar: {
1471
+ type: "boolean",
1472
+ default: true
1473
+ },
1458
1474
  asarUnpack: {
1459
1475
  oneOf: [
1460
1476
  { type: "boolean" },
@@ -2089,19 +2105,36 @@ var uploadApplicationSource_default = async ({ appId, appPkgJson, buildId, confi
2089
2105
  );
2090
2106
  let totalBytes = 0;
2091
2107
  const files = [
2108
+ /*
2109
+ App files (stored in app/ in the ZIP)
2110
+ */
2092
2111
  ...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
+ */
2093
2119
  ...(config2.extraContentFiles || []).map(({ from, to = "." }) => {
2094
2120
  return {
2095
2121
  from,
2096
2122
  to: path8.join("extraContentFiles", to, path8.basename(from))
2097
2123
  };
2098
2124
  }),
2125
+ /*
2126
+ Optional extra resources (stored in extraResources/ in the ZIP).
2127
+ Similar to extra content files above
2128
+ */
2099
2129
  ...(config2.extraResources || []).map(({ from, to = "." }) => {
2100
2130
  return {
2101
2131
  from,
2102
2132
  to: path8.join("extraResources", to, path8.basename(from))
2103
2133
  };
2104
2134
  }),
2135
+ /*
2136
+ Icons (more may be added below)
2137
+ */
2105
2138
  {
2106
2139
  from: config2.icon,
2107
2140
  to: path8.join("icons", "appIcon" + path8.extname(config2.icon))
@@ -2755,6 +2788,7 @@ var findAppUserId = async (appId) => {
2755
2788
  if (doc.exists)
2756
2789
  return user;
2757
2790
  } catch (err) {
2791
+ console.error(err);
2758
2792
  }
2759
2793
  }
2760
2794
  return primaryUser;
@@ -3345,7 +3379,7 @@ async function getBuilds({
3345
3379
 
3346
3380
  // src/utilities/getRelativeDateFromDateString.ts
3347
3381
  var dateFns = __toESM(require("date-fns"));
3348
- var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), new Date()) + " ago";
3382
+ var getRelativeDateFromDateString_default = (input) => dateFns.formatDistance(new Date(input), /* @__PURE__ */ new Date()) + " ago";
3349
3383
 
3350
3384
  // src/components/SyntaxHighlight.tsx
3351
3385
  var import_chalk2 = __toESM(require("chalk"));
@@ -3660,7 +3694,9 @@ var SelectTable = ({ data, onSelect }) => {
3660
3694
  });
3661
3695
  };
3662
3696
  const ItemComponent = ({
3697
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3663
3698
  label,
3699
+ // Make it compatible to SelectInput type, not used actually
3664
3700
  index,
3665
3701
  isSelected
3666
3702
  }) => {
@@ -3879,9 +3915,10 @@ async function getBuildAttributes({
3879
3915
  configPath
3880
3916
  }) {
3881
3917
  const { id: appId, nodeVersion } = getProjectConfig(configPath).config;
3882
- const userId = await fetchUserIdByAppId(appId);
3918
+ const { id: userId } = await findAppUserId_default(appId);
3919
+ const { uid: contextUserId } = currentUser();
3883
3920
  const build = await fetchBuild({ appId, buildId, userId });
3884
- return { appId, build, buildId, nodeVersion, userId };
3921
+ return { appId, build, buildId, contextUserId, nodeVersion, userId };
3885
3922
  }
3886
3923
  async function fetchBuild({
3887
3924
  appId,
@@ -3894,14 +3931,6 @@ async function fetchBuild({
3894
3931
  }
3895
3932
  return build;
3896
3933
  }
3897
- async function fetchUserIdByAppId(appId) {
3898
- try {
3899
- const { id: userId } = await findAppUserId_default(appId);
3900
- return userId;
3901
- } catch (e) {
3902
- throw new Error(`Can't fetch user for app ${appId}, ${e.message}`);
3903
- }
3904
- }
3905
3934
 
3906
3935
  // src/commands/release/components/ReleaseBuild.tsx
3907
3936
  var import_jsx_runtime35 = require("react/jsx-runtime");
@@ -4121,7 +4150,7 @@ function validateBuild(build) {
4121
4150
  }
4122
4151
  if (!isRuntimeVerRangeAllowed(build.todesktopRuntimeVersionSpecified)) {
4123
4152
  throw new SmokeError(
4124
- `The build should have @todesktop/shared@${MIN_RUNTIME_VERSION} installed at least`
4153
+ `This build should have @todesktop/runtime version ${MIN_RUNTIME_VERSION} or later to run smoke tests.`
4125
4154
  );
4126
4155
  }
4127
4156
  }
@@ -4443,6 +4472,7 @@ function OsProgress({
4443
4472
  error: "red",
4444
4473
  done: "green",
4445
4474
  skipped: "yellow"
4475
+ // Not used actually, just for type matching
4446
4476
  };
4447
4477
  const text = progress.message + (progress.state === "progress" ? "..." : "");
4448
4478
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -4530,6 +4560,7 @@ async function cancelSmokeTest({
4530
4560
  async function queueSmokeTest({
4531
4561
  appId,
4532
4562
  buildId,
4563
+ contextUserId,
4533
4564
  nodeVersion,
4534
4565
  userId
4535
4566
  }) {
@@ -4538,7 +4569,8 @@ async function queueSmokeTest({
4538
4569
  appId,
4539
4570
  buildId,
4540
4571
  nodeVersion,
4541
- userId
4572
+ userId,
4573
+ contextUserId
4542
4574
  });
4543
4575
  } catch (e) {
4544
4576
  if (["failed-precondition", "not-found"].includes(e.code)) {
@@ -4647,14 +4679,20 @@ async function smokeTestWorkflow({
4647
4679
  updateState
4648
4680
  }) {
4649
4681
  try {
4650
- const { appId, build, nodeVersion, userId } = await getBuildAttributes({
4682
+ const { appId, build, contextUserId, nodeVersion, userId } = await getBuildAttributes({
4651
4683
  buildId,
4652
4684
  configPath
4653
4685
  });
4654
4686
  updateState({ appId, build, userId });
4655
4687
  validateBuild(build);
4656
4688
  if (!abortSignal.aborted && !isTestRunning(build)) {
4657
- await queueSmokeTest({ appId, buildId, nodeVersion, userId });
4689
+ await queueSmokeTest({
4690
+ appId,
4691
+ buildId,
4692
+ nodeVersion,
4693
+ userId,
4694
+ contextUserId
4695
+ });
4658
4696
  }
4659
4697
  updateState({ state: "progress" });
4660
4698
  const { total } = await waitUntilFinished({
@@ -4666,6 +4704,7 @@ async function smokeTestWorkflow({
4666
4704
  const stateMap = {
4667
4705
  done: "complete",
4668
4706
  progress: "complete",
4707
+ // Not actually used, just for TS
4669
4708
  error: "progress-error",
4670
4709
  canceled: "canceled"
4671
4710
  };
@@ -4746,7 +4785,7 @@ var package_default = {
4746
4785
  access: "public"
4747
4786
  },
4748
4787
  name: "@todesktop/cli",
4749
- version: "1.7.1",
4788
+ version: "1.7.3",
4750
4789
  license: "MIT",
4751
4790
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
4752
4791
  homepage: "https://todesktop.com/cli",