@todesktop/cli 1.10.4 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -150,6 +150,7 @@ We also support:
150
150
  - `todesktop build --config=<path.to.another.todesktop.json>`. Run a build with a different configuration file.
151
151
  - `todesktop build --async`. Run a build in the background. This is handy for CI environments.
152
152
  - `todesktop build --webhook URL`. Send a POST request to the webhook URL when the build is finished. It's especially useful together with the `--async` flag.
153
+ - `todesktop build --ignore-extends-errors`. Ignore `id` and `appId` validation errors when extending another todesktop.json file.
153
154
  - `todesktop release`. Release a build. This will publish a new download and an auto-update for existing users. By default it shows a list of builds for you to choose from.
154
155
  - Use `todesktop release <id>` to release a specific build by ID.
155
156
  - `todesktop release --latest` will release the latest build.
@@ -772,6 +773,14 @@ Example: `true`.
772
773
 
773
774
  Whether or not the snap should automatically start on login.
774
775
 
776
+ #### `snap.base` - (optional) string
777
+
778
+ Default: `core18`.
779
+
780
+ Example: `core20`.
781
+
782
+ The base snap to use for building this snap.
783
+
775
784
  #### `snap.buildPackages` - (optional) array of strings
776
785
 
777
786
  Default: `[]`.
@@ -1138,6 +1147,15 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1138
1147
 
1139
1148
  ## Changelog
1140
1149
 
1150
+ ### v1.11.0
1151
+
1152
+ - Add additional `id` and `appId` validation when extending another `todesktop.json` file. Can be disabled with the `--ignore-extends-errors` flag.
1153
+
1154
+ ### v1.10.5
1155
+
1156
+ - Add support for `snap.base` in snap configuration
1157
+ - Fix required JSON validation when extending another json file
1158
+
1141
1159
  ### v1.10.4
1142
1160
 
1143
1161
  - Add support for additional token verification when cancelling smoke test
package/dist/cli.js CHANGED
@@ -972,9 +972,9 @@ async function postToFirebaseFunction_default(functionName, body = {}, config2 =
972
972
  }
973
973
 
974
974
  // src/utilities/projectConfig/getProjectConfig.ts
975
- var import_path3 = require("path");
976
- var import_fs = require("fs");
977
975
  var import_find_up = __toESM(require("find-up"));
976
+ var import_fs = require("fs");
977
+ var import_path3 = require("path");
978
978
 
979
979
  // src/utilities/projectConfig/loadConfig.ts
980
980
  function loadConfig(configPath) {
@@ -1448,8 +1448,16 @@ var addCustomKeywords_default = (ajv, context) => {
1448
1448
  // schemas/schema.json
1449
1449
  var schema_default = {
1450
1450
  type: "object",
1451
- required: ["id", "icon", "schemaVersion"],
1452
1451
  additionalProperties: false,
1452
+ if: {
1453
+ required: ["extends"]
1454
+ },
1455
+ then: {
1456
+ required: ["id"]
1457
+ },
1458
+ else: {
1459
+ required: ["id", "icon", "schemaVersion"]
1460
+ },
1453
1461
  properties: {
1454
1462
  appBuilderLibVersion: {
1455
1463
  type: "string",
@@ -1885,6 +1893,9 @@ var schema_default = {
1885
1893
  autoStart: {
1886
1894
  type: "boolean"
1887
1895
  },
1896
+ base: {
1897
+ type: "string"
1898
+ },
1888
1899
  buildPackages: {
1889
1900
  type: "array",
1890
1901
  items: {
@@ -2038,9 +2049,9 @@ ${output}`
2038
2049
  }
2039
2050
 
2040
2051
  // src/utilities/projectConfig/computeFullProjectConfig.ts
2041
- var import_path2 = require("path");
2042
2052
  var import_lodash2 = __toESM(require("lodash.merge"));
2043
- function computeFullProjectConfig(partialConfig, projectRoot) {
2053
+ var import_path2 = require("path");
2054
+ function computeFullProjectConfig(partialConfig, projectRoot, flags) {
2044
2055
  if (!partialConfig.extends) {
2045
2056
  logger_default.debug("No extends field, returning partial config");
2046
2057
  return partialConfig;
@@ -2051,8 +2062,19 @@ function computeFullProjectConfig(partialConfig, projectRoot) {
2051
2062
  parentConfig.appPath = parentConfig.appPath || ".";
2052
2063
  const parentFullConfig = computeFullProjectConfig(
2053
2064
  parentConfig,
2054
- projectRoot
2065
+ projectRoot,
2066
+ flags
2055
2067
  );
2068
+ if ((flags == null ? void 0 : flags.build) && !flags.build.ignoreExtendsErrors) {
2069
+ const hasSameId = partialConfig.id === parentFullConfig.id;
2070
+ const hasSameAppId = partialConfig.appId === parentFullConfig.appId;
2071
+ if (hasSameId || hasSameAppId) {
2072
+ throw new Error(`
2073
+ todesktop.json invalid. Cannot have the same "id" or "appId" as an extended todesktop.json file.
2074
+
2075
+ You can disable this error by running todesktop build with the --ignore-extends-errors flag.`);
2076
+ }
2077
+ }
2056
2078
  const result = (0, import_lodash2.default)({}, parentFullConfig, partialConfig);
2057
2079
  delete result.extends;
2058
2080
  return result;
@@ -2060,7 +2082,7 @@ function computeFullProjectConfig(partialConfig, projectRoot) {
2060
2082
  }
2061
2083
 
2062
2084
  // src/utilities/projectConfig/getProjectConfig.ts
2063
- function getProjectConfig(configPath) {
2085
+ function getProjectConfig(configPath, flags) {
2064
2086
  if (!configPath) {
2065
2087
  logger_default.debug("No config path provided, searching for one");
2066
2088
  configPath = import_find_up.default.sync("todesktop.json");
@@ -2078,7 +2100,7 @@ function getProjectConfig(configPath) {
2078
2100
  }
2079
2101
  const projectRoot = (0, import_path3.dirname)(configPath);
2080
2102
  const partialConfig = loadConfig(configPath);
2081
- const config2 = computeFullProjectConfig(partialConfig, projectRoot);
2103
+ const config2 = computeFullProjectConfig(partialConfig, projectRoot, flags);
2082
2104
  validateConfig({ config: config2, projectRoot });
2083
2105
  const result = resolveConfigPaths({ config: config2, projectRoot });
2084
2106
  return { config: result, unprocessedConfig: config2, projectRoot };
@@ -2596,15 +2618,15 @@ async function exists(filePath) {
2596
2618
  // src/commands/build/utilities/runBuild.ts
2597
2619
  async function runBuild({
2598
2620
  configPath,
2599
- exitAfterUploading,
2600
- shouldCodeSign = true,
2601
- onBuildFinishedWebhook,
2602
- updateState
2621
+ updateState,
2622
+ flags
2603
2623
  }) {
2604
2624
  var _a, _b, _c;
2605
2625
  logForCI_default("Getting application information...");
2606
2626
  const primaryUserId = (_a = currentUser()) == null ? void 0 : _a.uid;
2607
- const { config: config2, unprocessedConfig } = getProjectConfig(configPath);
2627
+ const { config: config2, unprocessedConfig } = getProjectConfig(configPath, {
2628
+ build: flags
2629
+ });
2608
2630
  const appId = config2.id;
2609
2631
  const appPkgJson = getPackageJson_default({ config: config2 });
2610
2632
  const buildObserver = spyBuild();
@@ -2625,9 +2647,9 @@ async function runBuild({
2625
2647
  appPkgProductName: appPkgJson.productName,
2626
2648
  appVersion: appPkgJson.version,
2627
2649
  id: config2.id,
2628
- onBuildFinishedWebhook,
2650
+ onBuildFinishedWebhook: flags.onBuildFinishedWebhook,
2629
2651
  projectConfig: unprocessedConfig,
2630
- shouldCodeSign: shouldCodeSign !== false,
2652
+ shouldCodeSign: flags.shouldCodeSign !== false,
2631
2653
  shouldRelease: false,
2632
2654
  userId: primaryUserId,
2633
2655
  versionControlInfo: await getVersionControlInfo_default(config2.appPath),
@@ -2684,7 +2706,7 @@ async function runBuild({
2684
2706
  } catch (e) {
2685
2707
  throw addErrorMessage(e, "Failed while kicking off build");
2686
2708
  }
2687
- if (exitAfterUploading) {
2709
+ if (flags.exitAfterUploading) {
2688
2710
  updateState({ state: "exit-after-uploading" });
2689
2711
  return;
2690
2712
  }
@@ -2717,21 +2739,13 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
2717
2739
  function Build({
2718
2740
  commandUsed,
2719
2741
  configPath,
2720
- exitAfterUploading,
2721
- onBuildFinishedWebhook,
2722
- shouldCodeSign
2742
+ flags
2723
2743
  }) {
2724
2744
  var _a, _b, _c, _d, _e, _f;
2725
2745
  const exit = useExit_default();
2726
2746
  const [state, setState] = (0, import_react6.useState)({ state: "initializing" });
2727
2747
  (0, import_react6.useEffect)(() => {
2728
- runBuild({
2729
- configPath,
2730
- exitAfterUploading,
2731
- onBuildFinishedWebhook,
2732
- shouldCodeSign,
2733
- updateState
2734
- }).catch((e) => {
2748
+ runBuild({ configPath, flags, updateState }).catch((e) => {
2735
2749
  const error = e.response ? e.response.data : e;
2736
2750
  logForCI_default(error);
2737
2751
  updateState({ state: "error", error });
@@ -3537,16 +3551,14 @@ var useAnalyticsCommand = (command, flags = {}, properties = {}) => {
3537
3551
  var import_jsx_runtime21 = require("react/jsx-runtime");
3538
3552
  function BuildCommand({
3539
3553
  configPath,
3540
- exitAfterUploading,
3541
- onBuildFinishedWebhook,
3542
- shouldCodeSign
3554
+ flags
3543
3555
  }) {
3544
3556
  checkIfReactIsUsable_default();
3545
3557
  useAnalyticsCommand("build", {
3546
- async: exitAfterUploading,
3547
- codeSign: shouldCodeSign,
3558
+ async: flags.exitAfterUploading,
3559
+ codeSign: flags.shouldCodeSign,
3548
3560
  config: configPath,
3549
- webhook: onBuildFinishedWebhook
3561
+ webhook: flags.onBuildFinishedWebhook
3550
3562
  });
3551
3563
  const commandUsed = "todesktop build";
3552
3564
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorBoundary_default, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LoginHOC_default, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OngoingBuildGuard_default, { configPath, commandUsed, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -3554,9 +3566,7 @@ function BuildCommand({
3554
3566
  {
3555
3567
  commandUsed,
3556
3568
  configPath,
3557
- exitAfterUploading,
3558
- onBuildFinishedWebhook,
3559
- shouldCodeSign
3569
+ flags
3560
3570
  }
3561
3571
  ) }) }) });
3562
3572
  }
@@ -5422,7 +5432,7 @@ var package_default = {
5422
5432
  access: "public"
5423
5433
  },
5424
5434
  name: "@todesktop/cli",
5425
- version: "1.10.3",
5435
+ version: "1.10.5",
5426
5436
  license: "MIT",
5427
5437
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
5428
5438
  homepage: "https://todesktop.com/cli",
@@ -5673,12 +5683,18 @@ import_commander.program.command("build").description(
5673
5683
  ).option(
5674
5684
  "--webhook [string]",
5675
5685
  "Send POST request to the webhook URL after building is finished"
5676
- ).addOption(configOption).action(({ async, codeSign, config: config2, webhook }) => {
5686
+ ).option(
5687
+ "--ignore-extends-errors [bool]",
5688
+ "Ignore `id` and `appId` validation errors when extending another todesktop.json file"
5689
+ ).addOption(configOption).action(({ async, codeSign, config: config2, webhook, ignoreExtendsErrors }) => {
5677
5690
  runCommand(BuildCommand, {
5678
5691
  configPath: config2,
5679
- exitAfterUploading: async === true,
5680
- onBuildFinishedWebhook: webhook,
5681
- shouldCodeSign: codeSign !== "false"
5692
+ flags: {
5693
+ exitAfterUploading: async === true,
5694
+ shouldCodeSign: codeSign !== "false",
5695
+ ignoreExtendsErrors: ignoreExtendsErrors === true,
5696
+ onBuildFinishedWebhook: webhook
5697
+ }
5682
5698
  });
5683
5699
  });
5684
5700
  import_commander.program.command("builds").description("View your builds").argument("[id]", "View a specific build by ID").option("--latest", "View the latest build").addOption(configOption).option("--count [number]", "Number of builds to show per page", parseCount).addOption(