@todesktop/cli 1.19.0-0 → 1.19.0-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/dist/cli.js CHANGED
@@ -191,11 +191,11 @@ var allSuggestionTokens = Array.from(
191
191
  "hook:todesktop:afterPack:*"
192
192
  ])
193
193
  );
194
- function canonicalKey(config2) {
195
- if (config2.type === "phase") {
196
- return `phase:${config2.id}`;
194
+ function canonicalKey(config) {
195
+ if (config.type === "phase") {
196
+ return `phase:${config.id}`;
197
197
  }
198
- return `hook:${config2.id}:${config2.position}`;
198
+ return `hook:${config.id}:${config.position}`;
199
199
  }
200
200
  function levenshtein(a, b) {
201
201
  if (a === b) {
@@ -322,11 +322,11 @@ function parseBreakpointList(input) {
322
322
  function listBreakpointDefinitions() {
323
323
  return breakpointDefinitions.slice();
324
324
  }
325
- function formatBreakpoint(config2) {
326
- if (config2.type === "phase") {
327
- return config2.id;
325
+ function formatBreakpoint(config) {
326
+ if (config.type === "phase") {
327
+ return config.id;
328
328
  }
329
- return `hook:${config2.id}:${config2.position}`;
329
+ return `hook:${config.id}:${config.position}`;
330
330
  }
331
331
  function isHookBreakpointName(value) {
332
332
  return hookNames.includes(value);
@@ -467,16 +467,42 @@ var onUserAuth = (handler) => (0, import_auth.onAuthStateChanged)(auth, (user) =
467
467
  var firestore_default = db;
468
468
 
469
469
  // src/utilities/configStore.ts
470
- var fs = __toESM(require("fs"));
471
- var import_del = __toESM(require("del"));
472
470
  var import_conf = __toESM(require("conf"));
473
- var import_xdg_basedir = __toESM(require("xdg-basedir"));
474
- var config = new import_conf.default({ configName: "todesktop-cli" });
471
+ var customCwd = process.env.TODESKTOP_CONFIG_DIR;
472
+ var ephemeralMode = false;
473
+ var memoryStore = /* @__PURE__ */ new Map();
474
+ var configInstance = null;
475
+ var setConfigDir = (cwd) => {
476
+ customCwd = cwd;
477
+ };
478
+ var setEphemeralMode = (enabled) => {
479
+ ephemeralMode = enabled;
480
+ };
481
+ var getConfigInstance = () => {
482
+ if (!configInstance) {
483
+ configInstance = new import_conf.default({
484
+ configName: "todesktop-cli",
485
+ ...customCwd && { cwd: customCwd }
486
+ });
487
+ }
488
+ return configInstance;
489
+ };
475
490
  var accessTokenConfigKey = "accessToken";
476
491
  var emailConfigKey = "email";
477
492
  var jwtTokenConfigKey = "jwtToken";
478
- var setConfig = (key, value) => config.set(key, value);
479
- var getConfig = (key) => config.get(key);
493
+ var setConfig = (key, value) => {
494
+ if (ephemeralMode) {
495
+ memoryStore.set(key, value);
496
+ } else {
497
+ getConfigInstance().set(key, value);
498
+ }
499
+ };
500
+ var getConfig = (key) => {
501
+ if (ephemeralMode) {
502
+ return memoryStore.get(key);
503
+ }
504
+ return getConfigInstance().get(key);
505
+ };
480
506
  var setAuthConfig = (email, accessToken, jwtToken) => {
481
507
  setConfig(emailConfigKey, email);
482
508
  setConfig(accessTokenConfigKey, accessToken);
@@ -489,20 +515,17 @@ var getAuthConfig = () => {
489
515
  return { accessToken, jwtToken, email };
490
516
  };
491
517
  var deleteAuthConfig = () => {
492
- config.delete(emailConfigKey);
493
- config.delete(accessTokenConfigKey);
494
- config.delete(jwtTokenConfigKey);
495
- };
496
- var oldConfigPath = `${import_xdg_basedir.default.config}/configstore/config.json.json`;
497
- if (fs.existsSync(oldConfigPath)) {
498
- try {
499
- const { email, accessToken, jwtToken } = require(oldConfigPath);
500
- setAuthConfig(email, accessToken, jwtToken);
501
- (0, import_del.default)(oldConfigPath, { force: true });
502
- } catch {
503
- (0, import_del.default)(oldConfigPath, { force: true });
518
+ if (ephemeralMode) {
519
+ memoryStore.delete(emailConfigKey);
520
+ memoryStore.delete(accessTokenConfigKey);
521
+ memoryStore.delete(jwtTokenConfigKey);
522
+ } else {
523
+ const config = getConfigInstance();
524
+ config.delete(emailConfigKey);
525
+ config.delete(accessTokenConfigKey);
526
+ config.delete(jwtTokenConfigKey);
504
527
  }
505
- }
528
+ };
506
529
 
507
530
  // src/utilities/getToDesktopPackageJson.ts
508
531
  var import_pkg_up = __toESM(require("pkg-up"));
@@ -611,7 +634,7 @@ var flush = () => analytics == null ? void 0 : analytics.flush({ close: true });
611
634
 
612
635
  // src/utilities/logger.ts
613
636
  var import_bunyan = __toESM(require("bunyan"));
614
- var fs2 = __toESM(require("fs"));
637
+ var fs = __toESM(require("fs"));
615
638
  var os2 = __toESM(require("os"));
616
639
  var path2 = __toESM(require("path"));
617
640
  var Sentry = __toESM(require("@sentry/node"));
@@ -672,7 +695,7 @@ try {
672
695
  "logs"
673
696
  );
674
697
  }
675
- fs2.mkdirSync(parentDirectory, { recursive: true });
698
+ fs.mkdirSync(parentDirectory, { recursive: true });
676
699
  logger = import_bunyan.default.createLogger({
677
700
  name,
678
701
  serializers: {
@@ -1728,9 +1751,9 @@ var import_pretty_bytes = __toESM(require("pretty-bytes"));
1728
1751
  // src/utilities/postToFirebaseFunction.ts
1729
1752
  var import_axios = __toESM(require("axios"));
1730
1753
  var { TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE } = getEnvironmentVariables_default();
1731
- async function postToFirebaseFunction(functionName, body = {}, config2 = {}) {
1754
+ async function postToFirebaseFunction(functionName, body = {}, config = {}) {
1732
1755
  logger_default.debug(
1733
- { scrub: { functionName, body, config: config2 } },
1756
+ { scrub: { functionName, body, config } },
1734
1757
  "postToFirebaseFunction"
1735
1758
  );
1736
1759
  let baseUrl = TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE;
@@ -1741,7 +1764,7 @@ async function postToFirebaseFunction(functionName, body = {}, config2 = {}) {
1741
1764
  const response = await import_axios.default.post(
1742
1765
  `${baseUrl}${functionName}`,
1743
1766
  body,
1744
- config2
1767
+ config
1745
1768
  );
1746
1769
  logger_default.debug(
1747
1770
  { scrub: { responseData: response.data } },
@@ -1783,8 +1806,8 @@ function loadTypeScriptConfig(configPath) {
1783
1806
  );
1784
1807
  }
1785
1808
  }
1786
- const fs7 = require("fs");
1787
- const sourceCode = fs7.readFileSync(configPath, "utf8");
1809
+ const fs6 = require("fs");
1810
+ const sourceCode = fs6.readFileSync(configPath, "utf8");
1788
1811
  const result = typescript.transpile(sourceCode, {
1789
1812
  target: typescript.ScriptTarget.ES2018,
1790
1813
  module: typescript.ModuleKind.CommonJS,
@@ -1816,14 +1839,14 @@ function loadTypeScriptConfig(configPath) {
1816
1839
  configPath,
1817
1840
  (0, import_path2.resolve)(configPath, "..")
1818
1841
  );
1819
- const config2 = module2.exports.default || module2.exports;
1820
- if (!config2 || typeof config2 !== "object") {
1842
+ const config = module2.exports.default || module2.exports;
1843
+ if (!config || typeof config !== "object") {
1821
1844
  throw new Error(
1822
- `TypeScript configuration file must export a configuration object. Received: ${typeof config2}`
1845
+ `TypeScript configuration file must export a configuration object. Received: ${typeof config}`
1823
1846
  );
1824
1847
  }
1825
1848
  logger_default.debug("Successfully loaded and compiled TypeScript configuration");
1826
- return config2;
1849
+ return config;
1827
1850
  } catch (error) {
1828
1851
  logger_default.error(
1829
1852
  `Failed to load TypeScript configuration from ${configPath}:`,
@@ -1858,83 +1881,83 @@ function loadConfig(configPath) {
1858
1881
  // src/utilities/projectConfig/resolveConfigPaths.ts
1859
1882
  var path3 = __toESM(require("path"));
1860
1883
  function resolveConfigPaths({
1861
- config: config2,
1884
+ config,
1862
1885
  projectRoot
1863
1886
  }) {
1864
- const appRoot = config2.appPath ? path3.isAbsolute(config2.appPath) ? config2.appPath : path3.join(projectRoot, config2.appPath) : projectRoot;
1887
+ const appRoot = config.appPath ? path3.isAbsolute(config.appPath) ? config.appPath : path3.join(projectRoot, config.appPath) : projectRoot;
1865
1888
  const transformIfExists = (value, transformer) => value ? transformer(value) : void 0;
1866
1889
  const resolvePath = (filePath) => path3.isAbsolute(filePath) ? filePath : path3.join(projectRoot, filePath);
1867
1890
  const result = {
1868
- ...config2,
1891
+ ...config,
1869
1892
  appPath: appRoot,
1870
- icon: resolvePath(config2.icon)
1893
+ icon: resolvePath(config.icon)
1871
1894
  };
1872
- if (config2.extraContentFiles) {
1895
+ if (config.extraContentFiles) {
1873
1896
  result.extraContentFiles = transformIfExists(
1874
- config2.extraContentFiles,
1897
+ config.extraContentFiles,
1875
1898
  (extraContentFiles) => extraContentFiles.map((extraContentFile) => ({
1876
1899
  ...extraContentFile,
1877
1900
  from: resolvePath(extraContentFile.from)
1878
1901
  }))
1879
1902
  );
1880
1903
  }
1881
- if (config2.extraResources) {
1904
+ if (config.extraResources) {
1882
1905
  result.extraResources = transformIfExists(
1883
- config2.extraResources,
1906
+ config.extraResources,
1884
1907
  (extraResources) => extraResources.map((extraResource) => ({
1885
1908
  ...extraResource,
1886
1909
  from: resolvePath(extraResource.from)
1887
1910
  }))
1888
1911
  );
1889
1912
  }
1890
- if (config2.linux) {
1891
- result.linux = { ...config2.linux };
1892
- if (config2.linux.icon) {
1893
- result.linux.icon = resolvePath(config2.linux.icon);
1913
+ if (config.linux) {
1914
+ result.linux = { ...config.linux };
1915
+ if (config.linux.icon) {
1916
+ result.linux.icon = resolvePath(config.linux.icon);
1894
1917
  }
1895
1918
  }
1896
- if (config2.mac) {
1897
- result.mac = { ...config2.mac };
1898
- if (config2.mac.entitlements) {
1899
- result.mac.entitlements = resolvePath(config2.mac.entitlements);
1919
+ if (config.mac) {
1920
+ result.mac = { ...config.mac };
1921
+ if (config.mac.entitlements) {
1922
+ result.mac.entitlements = resolvePath(config.mac.entitlements);
1900
1923
  }
1901
- if (config2.mac.entitlementsInherit) {
1924
+ if (config.mac.entitlementsInherit) {
1902
1925
  result.mac.entitlementsInherit = resolvePath(
1903
- config2.mac.entitlementsInherit
1926
+ config.mac.entitlementsInherit
1904
1927
  );
1905
1928
  }
1906
- if (config2.mac.requirements) {
1907
- result.mac.requirements = resolvePath(config2.mac.requirements);
1929
+ if (config.mac.requirements) {
1930
+ result.mac.requirements = resolvePath(config.mac.requirements);
1908
1931
  }
1909
- if (config2.mac.icon) {
1910
- result.mac.icon = resolvePath(config2.mac.icon);
1932
+ if (config.mac.icon) {
1933
+ result.mac.icon = resolvePath(config.mac.icon);
1911
1934
  }
1912
1935
  }
1913
- if (config2.mas) {
1914
- result.mas = { ...config2.mas };
1915
- if (config2.mas.entitlements) {
1916
- result.mas.entitlements = resolvePath(config2.mas.entitlements);
1936
+ if (config.mas) {
1937
+ result.mas = { ...config.mas };
1938
+ if (config.mas.entitlements) {
1939
+ result.mas.entitlements = resolvePath(config.mas.entitlements);
1917
1940
  }
1918
- if (config2.mas.entitlementsInherit) {
1941
+ if (config.mas.entitlementsInherit) {
1919
1942
  result.mas.entitlementsInherit = resolvePath(
1920
- config2.mas.entitlementsInherit
1943
+ config.mas.entitlementsInherit
1921
1944
  );
1922
1945
  }
1923
- if (config2.mas.provisioningProfile) {
1946
+ if (config.mas.provisioningProfile) {
1924
1947
  result.mas.provisioningProfile = resolvePath(
1925
- config2.mas.provisioningProfile
1948
+ config.mas.provisioningProfile
1926
1949
  );
1927
1950
  }
1928
1951
  }
1929
- if (config2.dmg) {
1930
- if (config2.dmg.background) {
1931
- result.dmg.background = resolvePath(config2.dmg.background);
1952
+ if (config.dmg) {
1953
+ if (config.dmg.background) {
1954
+ result.dmg.background = resolvePath(config.dmg.background);
1932
1955
  }
1933
1956
  }
1934
- if (config2.windows) {
1935
- result.windows = { ...config2.windows };
1936
- if (config2.windows.icon) {
1937
- result.windows.icon = resolvePath(config2.windows.icon);
1957
+ if (config.windows) {
1958
+ result.windows = { ...config.windows };
1959
+ if (config.windows.icon) {
1960
+ result.windows.icon = resolvePath(config.windows.icon);
1938
1961
  }
1939
1962
  }
1940
1963
  return result;
@@ -1948,7 +1971,7 @@ var import_better_ajv_errors2 = __toESM(require("better-ajv-errors"));
1948
1971
  // src/utilities/projectConfig/addCustomKeywords.ts
1949
1972
  var import_ajv2 = require("ajv");
1950
1973
  var import_email_regex = __toESM(require("email-regex"));
1951
- var fs3 = __toESM(require("fs"));
1974
+ var fs2 = __toESM(require("fs"));
1952
1975
  var path4 = __toESM(require("path"));
1953
1976
  var import_parse_author = __toESM(require("parse-author"));
1954
1977
  var semver = __toESM(require("semver"));
@@ -2163,7 +2186,7 @@ var addCustomKeywords_default = (ajv, context) => {
2163
2186
  }
2164
2187
  ]);
2165
2188
  }
2166
- if (!fs3.existsSync(filePath)) {
2189
+ if (!fs2.existsSync(filePath)) {
2167
2190
  throw new import_ajv2.ValidationError([
2168
2191
  {
2169
2192
  keyword: mustBeDirectory ? "Directory" : "File",
@@ -2171,7 +2194,7 @@ var addCustomKeywords_default = (ajv, context) => {
2171
2194
  }
2172
2195
  ]);
2173
2196
  }
2174
- const stats = fs3.statSync(filePath);
2197
+ const stats = fs2.statSync(filePath);
2175
2198
  if (mustBeDirectory && stats.isFile()) {
2176
2199
  throw new import_ajv2.ValidationError([
2177
2200
  {
@@ -2190,7 +2213,7 @@ var addCustomKeywords_default = (ajv, context) => {
2190
2213
  if (schema.mustBeElectronApp) {
2191
2214
  const appRoot = path4.resolve(filePath);
2192
2215
  const pkgPath = path4.join(appRoot, "package.json");
2193
- if (!fs3.existsSync(pkgPath)) {
2216
+ if (!fs2.existsSync(pkgPath)) {
2194
2217
  throw new import_ajv2.ValidationError([
2195
2218
  {
2196
2219
  keyword: "App",
@@ -2214,7 +2237,7 @@ var addCustomKeywords_default = (ajv, context) => {
2214
2237
  const mainFilePath = pkg.main;
2215
2238
  if (mainFilePath) {
2216
2239
  const resolvedMainFilePath = path4.join(appRoot, mainFilePath);
2217
- if (!fs3.existsSync(resolvedMainFilePath)) {
2240
+ if (!fs2.existsSync(resolvedMainFilePath)) {
2218
2241
  throw new import_ajv2.ValidationError([
2219
2242
  {
2220
2243
  keyword: "App",
@@ -2222,7 +2245,7 @@ var addCustomKeywords_default = (ajv, context) => {
2222
2245
  }
2223
2246
  ]);
2224
2247
  }
2225
- } else if (!fs3.existsSync(path4.join(appRoot, "index.js"))) {
2248
+ } else if (!fs2.existsSync(path4.join(appRoot, "index.js"))) {
2226
2249
  throw new import_ajv2.ValidationError([
2227
2250
  {
2228
2251
  keyword: "App",
@@ -3305,7 +3328,7 @@ var full_default = (context) => {
3305
3328
 
3306
3329
  // src/utilities/projectConfig/validateConfig.ts
3307
3330
  function validateConfig({
3308
- config: config2,
3331
+ config,
3309
3332
  projectRoot
3310
3333
  }) {
3311
3334
  const context = { projectRoot };
@@ -3314,7 +3337,7 @@ function validateConfig({
3314
3337
  (0, import_ajv_formats2.default)(ajv);
3315
3338
  addCustomKeywords_default(ajv, context);
3316
3339
  const validate = ajv.compile(schema);
3317
- if (config2.productName) {
3340
+ if (config.productName) {
3318
3341
  throw new Error(
3319
3342
  `todesktop.json invalid.
3320
3343
 
@@ -3323,8 +3346,8 @@ The "productName" property is no longer supported in todesktop.json. Please remo
3323
3346
  We made this change because Electron also uses the "productName" if it exists in your app's package.json. If you do not add it to your package.json, your app name will default to the value of the "name" property in your package.json.`
3324
3347
  );
3325
3348
  }
3326
- if (!validate(config2)) {
3327
- const output = (0, import_better_ajv_errors2.default)(schema, config2, validate.errors, {
3349
+ if (!validate(config)) {
3350
+ const output = (0, import_better_ajv_errors2.default)(schema, config, validate.errors, {
3328
3351
  indent: 2
3329
3352
  });
3330
3353
  throw new Error(
@@ -3398,13 +3421,13 @@ function getProjectConfig(configPath, flags) {
3398
3421
  }
3399
3422
  const projectRoot = (0, import_path5.dirname)(configPath);
3400
3423
  const partialConfig = loadConfig(configPath);
3401
- const config2 = computeFullProjectConfig(partialConfig, projectRoot, flags);
3402
- validateConfig({ config: config2, projectRoot });
3403
- const result = resolveConfigPaths({ config: config2, projectRoot });
3424
+ const config = computeFullProjectConfig(partialConfig, projectRoot, flags);
3425
+ validateConfig({ config, projectRoot });
3426
+ const result = resolveConfigPaths({ config, projectRoot });
3404
3427
  if (process.env.TODESKTOP_CLI_APP_ID) {
3405
3428
  result.id = process.env.TODESKTOP_CLI_APP_ID;
3406
3429
  }
3407
- return { config: result, unprocessedConfig: config2, projectRoot };
3430
+ return { config: result, unprocessedConfig: config, projectRoot };
3408
3431
  }
3409
3432
 
3410
3433
  // src/utilities/shouldExitOnBuildFailure.ts
@@ -3439,10 +3462,10 @@ function removeNullDependencies(pkgJson) {
3439
3462
  }
3440
3463
  return pkgJson;
3441
3464
  }
3442
- function getAppPkgJson({ config: config2 }) {
3443
- const packageJsonFromConfig = config2.packageJson || {};
3465
+ function getAppPkgJson({ config }) {
3466
+ const packageJsonFromConfig = config.packageJson || {};
3444
3467
  const extendsFrom = packageJsonFromConfig.extends || "package.json";
3445
- const packageJsonFromFile = readJson(import_path6.default.join(config2.appPath, extendsFrom));
3468
+ const packageJsonFromFile = readJson(import_path6.default.join(config.appPath, extendsFrom));
3446
3469
  return removeNullDependencies(
3447
3470
  (0, import_lodash3.default)({}, packageJsonFromFile, packageJsonFromConfig)
3448
3471
  );
@@ -3554,7 +3577,7 @@ function buildHasSettled(build) {
3554
3577
 
3555
3578
  // src/commands/build/utilities/uploadApplicationSource.ts
3556
3579
  var import_fast_glob2 = __toESM(require("fast-glob"));
3557
- var fs6 = __toESM(require("fs"));
3580
+ var fs5 = __toESM(require("fs"));
3558
3581
  var path8 = __toESM(require("path"));
3559
3582
 
3560
3583
  // src/commands/build/utilities/generateS3Key.ts
@@ -3731,8 +3754,8 @@ var DEFAULT_IGNORE_GLOBS = [
3731
3754
  ];
3732
3755
  async function prepareWorkspaceBundle(input) {
3733
3756
  var _a2;
3734
- const { config: config2, appPkgJson, appPath } = input;
3735
- if (!((_a2 = config2.bundleWorkspacePackages) == null ? void 0 : _a2.enabled)) {
3757
+ const { config, appPkgJson, appPath } = input;
3758
+ if (!((_a2 = config.bundleWorkspacePackages) == null ? void 0 : _a2.enabled)) {
3736
3759
  return {
3737
3760
  appPackageJson: appPkgJson,
3738
3761
  entries: [],
@@ -4362,7 +4385,7 @@ var getAppFiles = async (globsInput, appPath, appPkgJson) => {
4362
4385
  if (appPkgJson.main) {
4363
4386
  mainFilePath = path8.join(mainFilePath, appPkgJson.main);
4364
4387
  }
4365
- if (fs6.statSync(mainFilePath).isDirectory()) {
4388
+ if (fs5.statSync(mainFilePath).isDirectory()) {
4366
4389
  mainFilePath = path8.join(mainFilePath, "index.js");
4367
4390
  }
4368
4391
  if (!absolutePaths.includes(mainFilePath)) {
@@ -4382,7 +4405,7 @@ async function uploadApplicationSource({
4382
4405
  appId,
4383
4406
  appPkgJson,
4384
4407
  buildId,
4385
- config: config2,
4408
+ config,
4386
4409
  onProgress
4387
4410
  }) {
4388
4411
  var _a2;
@@ -4392,7 +4415,7 @@ async function uploadApplicationSource({
4392
4415
  appId,
4393
4416
  appPkgJson,
4394
4417
  buildId,
4395
- config: config2,
4418
+ config,
4396
4419
  onProgress
4397
4420
  }
4398
4421
  },
@@ -4403,9 +4426,9 @@ async function uploadApplicationSource({
4403
4426
  let workspaceEntries = [];
4404
4427
  try {
4405
4428
  const workspaceBundle = await prepareWorkspaceBundle({
4406
- appPath: config2.appPath,
4429
+ appPath: config.appPath,
4407
4430
  appPkgJson,
4408
- config: config2
4431
+ config
4409
4432
  });
4410
4433
  effectiveAppPkgJson = workspaceBundle.appPackageJson;
4411
4434
  workspaceEntries = workspaceBundle.entries;
@@ -4418,8 +4441,8 @@ async function uploadApplicationSource({
4418
4441
  App files (stored in app/ in the ZIP)
4419
4442
  */
4420
4443
  ...await getAppFiles(
4421
- config2.appFiles,
4422
- config2.appPath,
4444
+ config.appFiles,
4445
+ config.appPath,
4423
4446
  effectiveAppPkgJson
4424
4447
  ),
4425
4448
  /*
@@ -4429,7 +4452,7 @@ async function uploadApplicationSource({
4429
4452
  also any file paths in our todesktop.json that are outside of the
4430
4453
  project directory
4431
4454
  */
4432
- ...(config2.extraContentFiles || []).map(({ from, to = "." }) => {
4455
+ ...(config.extraContentFiles || []).map(({ from, to = "." }) => {
4433
4456
  return {
4434
4457
  from,
4435
4458
  to: path8.join("extraContentFiles", to, path8.basename(from))
@@ -4439,7 +4462,7 @@ async function uploadApplicationSource({
4439
4462
  Optional extra resources (stored in extraResources/ in the ZIP).
4440
4463
  Similar to extra content files above
4441
4464
  */
4442
- ...(config2.extraResources || []).map(({ from, to = "." }) => {
4465
+ ...(config.extraResources || []).map(({ from, to = "." }) => {
4443
4466
  return {
4444
4467
  from,
4445
4468
  to: path8.join("extraResources", to, path8.basename(from))
@@ -4449,24 +4472,24 @@ async function uploadApplicationSource({
4449
4472
  Icons (more may be added below)
4450
4473
  */
4451
4474
  {
4452
- from: config2.icon,
4453
- to: path8.join("icons", "appIcon" + path8.extname(config2.icon))
4475
+ from: config.icon,
4476
+ to: path8.join("icons", "appIcon" + path8.extname(config.icon))
4454
4477
  }
4455
4478
  ];
4456
- if (config2.linux) {
4457
- if (config2.linux.icon) {
4479
+ if (config.linux) {
4480
+ if (config.linux.icon) {
4458
4481
  files.push({
4459
- from: config2.linux.icon,
4482
+ from: config.linux.icon,
4460
4483
  to: path8.join(
4461
4484
  "icons",
4462
- "appIcon-linux" + path8.extname(config2.linux.icon)
4485
+ "appIcon-linux" + path8.extname(config.linux.icon)
4463
4486
  )
4464
4487
  });
4465
4488
  }
4466
4489
  }
4467
- if (Array.isArray(config2.fileAssociations)) {
4490
+ if (Array.isArray(config.fileAssociations)) {
4468
4491
  const possibleIcons = [];
4469
- for (const fa of config2.fileAssociations) {
4492
+ for (const fa of config.fileAssociations) {
4470
4493
  if (fa.icon) {
4471
4494
  const icon = path8.parse(fa.icon);
4472
4495
  possibleIcons.push(
@@ -4486,73 +4509,73 @@ async function uploadApplicationSource({
4486
4509
  })
4487
4510
  );
4488
4511
  }
4489
- if (config2.mac) {
4490
- if (config2.mac.entitlements) {
4512
+ if (config.mac) {
4513
+ if (config.mac.entitlements) {
4491
4514
  files.push({
4492
- from: config2.mac.entitlements,
4515
+ from: config.mac.entitlements,
4493
4516
  to: path8.join("other", "mac", "entitlements.mac.plist")
4494
4517
  });
4495
4518
  }
4496
- if (config2.mac.entitlementsInherit) {
4519
+ if (config.mac.entitlementsInherit) {
4497
4520
  files.push({
4498
- from: config2.mac.entitlementsInherit,
4521
+ from: config.mac.entitlementsInherit,
4499
4522
  to: path8.join("other", "mac", "entitlementsInherit.mac.plist")
4500
4523
  });
4501
4524
  }
4502
- if (config2.mac.icon) {
4525
+ if (config.mac.icon) {
4503
4526
  files.push({
4504
- from: config2.mac.icon,
4505
- to: path8.join("icons", "appIcon-mac" + path8.extname(config2.mac.icon))
4527
+ from: config.mac.icon,
4528
+ to: path8.join("icons", "appIcon-mac" + path8.extname(config.mac.icon))
4506
4529
  });
4507
4530
  }
4508
- if (config2.mac.requirements) {
4531
+ if (config.mac.requirements) {
4509
4532
  files.push({
4510
- from: config2.mac.requirements,
4533
+ from: config.mac.requirements,
4511
4534
  to: path8.join("other", "mac", "requirements.txt")
4512
4535
  });
4513
4536
  }
4514
4537
  }
4515
- if (config2.mas) {
4516
- if (config2.mas.entitlements) {
4538
+ if (config.mas) {
4539
+ if (config.mas.entitlements) {
4517
4540
  files.push({
4518
- from: config2.mas.entitlements,
4541
+ from: config.mas.entitlements,
4519
4542
  to: path8.join("other", "mac", "entitlements.mas.plist")
4520
4543
  });
4521
4544
  }
4522
- if (config2.mas.entitlementsInherit) {
4545
+ if (config.mas.entitlementsInherit) {
4523
4546
  files.push({
4524
- from: config2.mas.entitlementsInherit,
4547
+ from: config.mas.entitlementsInherit,
4525
4548
  to: path8.join("other", "mac", "entitlementsInherit.mas.plist")
4526
4549
  });
4527
4550
  }
4528
- if (config2.mas.provisioningProfile) {
4551
+ if (config.mas.provisioningProfile) {
4529
4552
  files.push({
4530
- from: config2.mas.provisioningProfile,
4553
+ from: config.mas.provisioningProfile,
4531
4554
  to: path8.join("other", "mac", "mas.provisionprofile")
4532
4555
  });
4533
4556
  }
4534
4557
  }
4535
- if (config2.dmg) {
4536
- if (config2.dmg.background) {
4558
+ if (config.dmg) {
4559
+ if (config.dmg.background) {
4537
4560
  files.push({
4538
- from: config2.dmg.background,
4561
+ from: config.dmg.background,
4539
4562
  to: path8.join("other", "mac", "dmg-background.tiff")
4540
4563
  });
4541
4564
  }
4542
4565
  }
4543
- if (config2.windows) {
4544
- if (config2.windows.icon) {
4566
+ if (config.windows) {
4567
+ if (config.windows.icon) {
4545
4568
  files.push({
4546
- from: config2.windows.icon,
4569
+ from: config.windows.icon,
4547
4570
  to: path8.join(
4548
4571
  "icons",
4549
- "appIcon-windows" + path8.extname(config2.windows.icon)
4572
+ "appIcon-windows" + path8.extname(config.windows.icon)
4550
4573
  )
4551
4574
  });
4552
4575
  }
4553
- if (config2.windows.nsisInclude) {
4576
+ if (config.windows.nsisInclude) {
4554
4577
  files.push({
4555
- from: config2.windows.nsisInclude,
4578
+ from: config.windows.nsisInclude,
4556
4579
  to: path8.join("other", "installer.nsh")
4557
4580
  });
4558
4581
  }
@@ -4561,15 +4584,15 @@ async function uploadApplicationSource({
4561
4584
  files.push(...workspaceEntries);
4562
4585
  }
4563
4586
  return uploadToS3_default({
4564
- bucket: config2.bucket || void 0,
4587
+ bucket: config.bucket || void 0,
4565
4588
  inputStream: await zip({
4566
4589
  files,
4567
- fileSizeLimit: config2.uploadSizeLimit,
4590
+ fileSizeLimit: config.uploadSizeLimit,
4568
4591
  onError: (e) => {
4569
4592
  throw e;
4570
4593
  },
4571
- onProgress({ fs: fs7 }) {
4572
- totalBytes = fs7.totalBytes;
4594
+ onProgress({ fs: fs6 }) {
4595
+ totalBytes = fs6.totalBytes;
4573
4596
  },
4574
4597
  appPkgJson: effectiveAppPkgJson
4575
4598
  }),
@@ -4585,7 +4608,7 @@ async function uploadApplicationSource({
4585
4608
  }
4586
4609
  async function exists(filePath) {
4587
4610
  try {
4588
- await fs6.promises.access(filePath);
4611
+ await fs5.promises.access(filePath);
4589
4612
  return true;
4590
4613
  } catch {
4591
4614
  return false;
@@ -4604,11 +4627,11 @@ async function runBuild({
4604
4627
  updateState({ breakpointPlan: flags.breakpointPlan });
4605
4628
  }
4606
4629
  const primaryUserId = (_a2 = currentUser()) == null ? void 0 : _a2.uid;
4607
- const { config: config2, unprocessedConfig } = getProjectConfig(configPath, {
4630
+ const { config, unprocessedConfig } = getProjectConfig(configPath, {
4608
4631
  build: flags
4609
4632
  });
4610
- const appId = config2.id;
4611
- const appPkgJson = getPackageJson_default({ config: config2 });
4633
+ const appId = config.id;
4634
+ const appPkgJson = getPackageJson_default({ config });
4612
4635
  const buildObserver = spyBuild();
4613
4636
  buildObserver.onUpdate(({ build: build2 }) => updateState({ build: build2 }));
4614
4637
  updateState({
@@ -4626,13 +4649,13 @@ async function runBuild({
4626
4649
  appPkgName: appPkgJson.name,
4627
4650
  appPkgProductName: appPkgJson.productName,
4628
4651
  appVersion: appPkgJson.version,
4629
- id: config2.id,
4652
+ id: config.id,
4630
4653
  onBuildFinishedWebhook: flags.onBuildFinishedWebhook,
4631
4654
  projectConfig: unprocessedConfig,
4632
4655
  shouldCodeSign: flags.shouldCodeSign !== false,
4633
4656
  shouldRelease: false,
4634
4657
  userId: primaryUserId,
4635
- versionControlInfo: await getVersionControlInfo_default(config2.appPath),
4658
+ versionControlInfo: await getVersionControlInfo_default(config.appPath),
4636
4659
  introspect: flags.introspect,
4637
4660
  breakpoints: (_b = flags.breakpointPlan) == null ? void 0 : _b.breakpoints,
4638
4661
  idToken: await ((_c = currentUser()) == null ? void 0 : _c.getIdToken())
@@ -4655,7 +4678,7 @@ async function runBuild({
4655
4678
  appId,
4656
4679
  appPkgJson,
4657
4680
  buildId,
4658
- config: config2,
4681
+ config,
4659
4682
  onProgress(progress, uploadedSize) {
4660
4683
  const preparationState = {
4661
4684
  preparationProgress: 0.05 + progress / 100 * 0.95,
@@ -4674,16 +4697,16 @@ async function runBuild({
4674
4697
  logForCI("Kicking off build...");
4675
4698
  try {
4676
4699
  await postToFirebaseFunction("kickOffBuild", {
4677
- appBuilderLibVersion: config2.appBuilderLibVersion,
4700
+ appBuilderLibVersion: config.appBuilderLibVersion,
4678
4701
  appId,
4679
4702
  appPkgName: appPkgJson.name,
4680
4703
  appVersion: appPkgJson.version,
4681
4704
  buildId,
4682
4705
  idToken: await ((_d = currentUser()) == null ? void 0 : _d.getIdToken()),
4683
- linuxImageVersion: (_e = config2.linux) == null ? void 0 : _e.imageVersion,
4684
- nodeVersion: config2.nodeVersion,
4685
- npmVersion: config2.npmVersion,
4686
- pnpmVersion: config2.pnpmVersion,
4706
+ linuxImageVersion: (_e = config.linux) == null ? void 0 : _e.imageVersion,
4707
+ nodeVersion: config.nodeVersion,
4708
+ npmVersion: config.npmVersion,
4709
+ pnpmVersion: config.pnpmVersion,
4687
4710
  sourceArchiveDetails,
4688
4711
  userId: primaryUserId
4689
4712
  });
@@ -5229,17 +5252,17 @@ var ViewBuild = ({ commandUsed, id, configPath }) => {
5229
5252
  (0, import_react14.useEffect)(() => {
5230
5253
  let firebaseUnsubscribe;
5231
5254
  async function viewBuild() {
5232
- let config2;
5255
+ let config;
5233
5256
  try {
5234
- config2 = getProjectConfig(configPath).config;
5257
+ config = getProjectConfig(configPath).config;
5235
5258
  } catch (e) {
5236
5259
  setState((previousState) => ({ ...previousState, error: e }));
5237
5260
  return;
5238
5261
  }
5239
- const { id: userId } = await findAppUserId_default(config2.id);
5262
+ const { id: userId } = await findAppUserId_default(config.id);
5240
5263
  const subscribe = (buildId) => {
5241
5264
  subscribeToBuild_default({
5242
- appId: config2.id,
5265
+ appId: config.id,
5243
5266
  buildId,
5244
5267
  onDataReceived: (data) => {
5245
5268
  if (!data) {
@@ -5251,7 +5274,7 @@ var ViewBuild = ({ commandUsed, id, configPath }) => {
5251
5274
  }
5252
5275
  setState((prevState) => ({
5253
5276
  ...prevState,
5254
- appId: config2.id,
5277
+ appId: config.id,
5255
5278
  build: data,
5256
5279
  isLoading: false
5257
5280
  }));
@@ -5264,7 +5287,7 @@ var ViewBuild = ({ commandUsed, id, configPath }) => {
5264
5287
  if (id) {
5265
5288
  subscribe(id);
5266
5289
  } else {
5267
- getLatestBuildId({ appId: config2.id, userId }).catch(onError).then((latestBuildId) => {
5290
+ getLatestBuildId({ appId: config.id, userId }).catch(onError).then((latestBuildId) => {
5268
5291
  if (!latestBuildId) {
5269
5292
  setState((previousState) => ({
5270
5293
  ...previousState,
@@ -5871,17 +5894,17 @@ var ViewBuilds = ({
5871
5894
  ...previousState,
5872
5895
  isLoading: true
5873
5896
  }));
5874
- let config2;
5897
+ let config;
5875
5898
  try {
5876
- config2 = projectConfig || getProjectConfig(configPath).config;
5899
+ config = projectConfig || getProjectConfig(configPath).config;
5877
5900
  } catch (e) {
5878
5901
  setState((previousState) => ({ ...previousState, error: e }));
5879
5902
  return;
5880
5903
  }
5881
5904
  const pageSize = count || 5;
5882
- const user2 = await findAppUserId_default(config2.id);
5905
+ const user2 = await findAppUserId_default(config.id);
5883
5906
  getBuilds({
5884
- appId: config2.id,
5907
+ appId: config.id,
5885
5908
  limit: pageSize + 1,
5886
5909
  startAfter,
5887
5910
  userId: user2.id
@@ -5892,7 +5915,7 @@ var ViewBuilds = ({
5892
5915
  hasMoreToLoad: buildsResult.length > pageSize,
5893
5916
  isInitialLoadComplete: true,
5894
5917
  isLoading: false,
5895
- projectConfig: config2,
5918
+ projectConfig: config,
5896
5919
  startAfter: null,
5897
5920
  user: user2
5898
5921
  };
@@ -8533,7 +8556,7 @@ var package_default = {
8533
8556
  access: "public"
8534
8557
  },
8535
8558
  name: "@todesktop/cli",
8536
- version: "1.19.0",
8559
+ version: "1.19.0-1",
8537
8560
  license: "MIT",
8538
8561
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
8539
8562
  homepage: "https://todesktop.com/cli",
@@ -8734,8 +8757,8 @@ async function continueBreakpoint({
8734
8757
  ignoreExtendsErrors
8735
8758
  }) {
8736
8759
  const projectConfigFlags = ignoreExtendsErrors === true ? { build: { ignoreExtendsErrors: true } } : void 0;
8737
- const { config: config2 } = getProjectConfig(configPath, projectConfigFlags);
8738
- const appId = config2.id;
8760
+ const { config } = getProjectConfig(configPath, projectConfigFlags);
8761
+ const appId = config.id;
8739
8762
  if (!buildId) {
8740
8763
  throw new Error("A build ID is required when using --continue");
8741
8764
  }
@@ -8778,7 +8801,21 @@ var configOption = new import_commander.Option(
8778
8801
  }
8779
8802
  return value;
8780
8803
  });
8781
- import_commander.program.name("todesktop").version(getCliVersion_default());
8804
+ import_commander.program.name("todesktop").version(getCliVersion_default()).option(
8805
+ "--config-dir <path>",
8806
+ "Custom directory for storing CLI configuration and credentials. Can also be set via TODESKTOP_CONFIG_DIR environment variable"
8807
+ ).option(
8808
+ "--ephemeral",
8809
+ "Do not persist any configuration or credentials to disk. Useful for CI environments where credentials are provided via environment variables"
8810
+ ).hook("preAction", (thisCommand) => {
8811
+ const opts = thisCommand.opts();
8812
+ if (opts.configDir) {
8813
+ setConfigDir(opts.configDir);
8814
+ }
8815
+ if (opts.ephemeral) {
8816
+ setEphemeralMode(true);
8817
+ }
8818
+ });
8782
8819
  import_commander.program.command("build").description(
8783
8820
  "Build an Electron app with native installers, code signing baked-in, etc. but without releasing it (existing users won't get an auto-update). For quicker builds, you can append `--code-sign=false` to disable code-signing and notarization."
8784
8821
  ).option(
@@ -8806,7 +8843,7 @@ import_commander.program.command("build").description(
8806
8843
  async ({
8807
8844
  async,
8808
8845
  codeSign,
8809
- config: config2,
8846
+ config,
8810
8847
  webhook,
8811
8848
  ignoreExtendsErrors,
8812
8849
  introspect,
@@ -8832,7 +8869,7 @@ import_commander.program.command("build").description(
8832
8869
  await continueBreakpoint({
8833
8870
  buildId: continueBuildId,
8834
8871
  platform: resolvedPlatform,
8835
- configPath: config2,
8872
+ configPath: config,
8836
8873
  ignoreExtendsErrors: ignoreExtendsErrors === true
8837
8874
  });
8838
8875
  } catch (err) {
@@ -8866,7 +8903,7 @@ import_commander.program.command("build").description(
8866
8903
  breakpointPlan = resolution;
8867
8904
  }
8868
8905
  runCommand(BuildCommand, {
8869
- configPath: config2,
8906
+ configPath: config,
8870
8907
  flags: {
8871
8908
  exitAfterUploading: async === true,
8872
8909
  shouldCodeSign: codeSign !== "false",
@@ -8883,9 +8920,9 @@ import_commander.program.command("builds").description("View your builds").argum
8883
8920
  ).option(
8884
8921
  "--exit",
8885
8922
  "Disable dynamic pagination and exit the process once the build data has been displayed"
8886
- ).action((id, { config: config2, count, exit, format, latest }) => {
8923
+ ).action((id, { config, count, exit, format, latest }) => {
8887
8924
  runCommand(BuildsCommand_default, {
8888
- configPath: config2,
8925
+ configPath: config,
8889
8926
  count,
8890
8927
  exit,
8891
8928
  format,
@@ -8896,16 +8933,16 @@ import_commander.program.command("builds").description("View your builds").argum
8896
8933
  import_commander.program.command("logout").description("Logs you out").action(() => {
8897
8934
  runCommand(LogoutCommand_default, null, { exitIfOutOfDate: false });
8898
8935
  });
8899
- import_commander.program.command("release").description("Release a build").argument("[id]", "A specific build ID to release").option("--force", "Skips interactive confirmation step").option("--latest", "Release the latest build").addOption(configOption).action((id, { config: config2, force, latest }) => {
8936
+ import_commander.program.command("release").description("Release a build").argument("[id]", "A specific build ID to release").option("--force", "Skips interactive confirmation step").option("--latest", "Release the latest build").addOption(configOption).action((id, { config, force, latest }) => {
8900
8937
  runCommand(ReleaseCommand, {
8901
- configPath: config2,
8938
+ configPath: config,
8902
8939
  shouldConfirm: !force,
8903
8940
  buildId: latest ? "latest" : id
8904
8941
  });
8905
8942
  });
8906
- import_commander.program.command("smoke-test").description("Check whether the build works and can be successfully updated").argument("[id]", "A specific build ID to test").option("--latest", "Release the latest build").addOption(configOption).action((id, { config: config2, latest }) => {
8943
+ import_commander.program.command("smoke-test").description("Check whether the build works and can be successfully updated").argument("[id]", "A specific build ID to test").option("--latest", "Release the latest build").addOption(configOption).action((id, { config, latest }) => {
8907
8944
  runCommand(SmokeTestCommand, {
8908
- configPath: config2,
8945
+ configPath: config,
8909
8946
  buildId: latest ? "latest" : id
8910
8947
  });
8911
8948
  });