@todesktop/cli 1.13.0 → 1.14.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
@@ -10,7 +10,7 @@ For more information, visit the project [landing page](https://www.todesktop.com
10
10
  - [Get started](#get-started)
11
11
  - [CLI commands](#cli-commands)
12
12
  - [Automating your builds (CI)](#automating-your-builds-ci)
13
- - [Project configuration (todesktop.json)](#project-configuration-todesktopjson)
13
+ - [Project configuration (todesktop.json or todesktop.js)](#project-configuration-todesktopjson-or-todesktopjs)
14
14
  - [Build lifecycle hooks (package.json scripts)](#build-lifecycle-hooks-packagejson-scripts)
15
15
  - [App package.json requirements](#app-packagejson-requirements)
16
16
  - [FAQs](#faqs)
@@ -42,14 +42,27 @@ 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.13.0-0/schemas/schema.json",
45
+ "$schema": "https://unpkg.com/@todesktop/cli@1.13.0/schemas/schema.json",
46
46
  "schemaVersion": 1
47
47
  "id": "your-todesktop-id",
48
48
  "icon": "./desktop-icon.png",
49
+ "schemaVersion": 1
49
50
  }
50
51
  ```
51
52
 
52
- See [Project configuration](#project-configuration-todesktopjson) for the full list of configuration options.
53
+ Alternatively, you can create a `todesktop.js` file. This allows you to use JavaScript to dynamically generate your configuration. For example:
54
+
55
+ ```javascript
56
+ const path = require("path");
57
+
58
+ module.exports = {
59
+ id: process.env.TODESKTOP_APP_ID || "your-default-todesktop-id",
60
+ icon: path.join(__dirname, "assets", "desktop-icon.png"),
61
+ schemaVersion: 1,
62
+ };
63
+ ```
64
+
65
+ See [Project configuration](#project-configuration-todesktopjson-or-todesktopjs) for the full list of configuration options.
53
66
 
54
67
  ### Step 3: Add @todesktop/runtime as a dependency
55
68
 
@@ -135,27 +148,27 @@ This builds your Electron app with native installers, code signing, and so on ba
135
148
  We also support:
136
149
 
137
150
  - `todesktop build --code-sign=false`. Run a build with code-signing and notarization disabled. This is handy for testing builds quickly.
138
- - `todesktop build --config=<path.to.another.todesktop.json>`. Run a build with a different configuration file.
151
+ - `todesktop build --config=<path.to.config.file>`. Run a build with a different configuration file (e.g., `todesktop.staging.json` or `todesktop.prod.js`).
139
152
  - `todesktop build --async`. Run a build in the background. This is handy for CI environments.
140
153
  - `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.
141
- - `todesktop build --ignore-extends-errors`. Ignore `id` and `appId` validation errors when extending another todesktop.json file.
154
+ - `todesktop build --ignore-extends-errors`. Ignore `id` and `appId` validation errors when extending another configuration file (`.json` or `.js`).
142
155
  - `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.
143
156
  - Use `todesktop release <id>` to release a specific build by ID.
144
157
  - `todesktop release --latest` will release the latest build.
145
158
  - Append `--force` to skip the interactive confirmation step.
146
- - Append `--config=<path.to.another.todesktop.json>` to use a different configuration file.
159
+ - Append `--config=<path.to.config.file>` to use a different configuration file.
147
160
  - `todesktop builds`. View your recent builds.
148
161
  - Use `todesktop builds <id>` to view a specific build and its progress.
149
162
  - `todesktop builds --latest` will show the latest build and it's progress.
150
163
  - `todesktop builds --count=<number>` will show the last `<number>` builds.
151
164
  - `todesktop builds --format=json` will output build data in JSON format.
152
- - Append `--config=<path.to.another.todesktop.json>` to use a different configuration file.
165
+ - Append `--config=<path.to.config.file>` to use a different configuration file.
153
166
  - Append `--exit` to disable dynamic pagination and exit the process once the build data has been displayed.
154
167
  - `todesktop logout`. Logs you out.
155
168
  - `todesktop smoke-test` Check whether the build works and can be successfully updated.
156
169
  - Use `todesktop smoke-test <id>` to test a specific build by ID.
157
170
  - `todesktop smoke-test --latest` will test the latest build.
158
- - Append `--config=<path.to.another.todesktop.json>` to use a different configuration file.
171
+ - Append `--config=<path.to.config.file>` to use a different configuration file.
159
172
  - `todesktop whoami`. Prints the email of the account you're signed into.
160
173
  - `todesktop --help`. Shows the help documentation.
161
174
  - `todesktop --version`. Shows the current version of the CLI.
@@ -207,13 +220,17 @@ The webhook receives a POST request with the following JSON body:
207
220
  }
208
221
  ```
209
222
 
210
- ## Project configuration (todesktop.json)
223
+ ## Project configuration (todesktop.json or todesktop.js)
224
+
225
+ This describes all of the possible configuration options in your `todesktop.json` or `todesktop.js` file.
226
+
227
+ You can use a standard JSON file (`todesktop.json`) for static configuration, or a JavaScript file (`todesktop.js`) that exports a configuration object. Using a `.js` file allows for dynamic configuration, such as setting values based on environment variables or computing paths.
211
228
 
212
- This describes all of the possible configuration options ín your `todesktop.json`.
229
+ **Note:** Schema validation and IntelliSense (described under [Installation](#installation)) currently only work for `.json` files.
213
230
 
214
231
  To avoid confusion, the following terms will be used throughout this file:
215
232
 
216
- - "Project root": this is the parent directory of your `todesktop.json`.
233
+ - "Project root": this is the parent directory of your `todesktop.json` or `todesktop.js`.
217
234
 
218
235
  ### `$schema` - (optional) string
219
236
 
@@ -226,7 +243,7 @@ To enable JSON validation and IntelliSense for your `todesktop.json` file in com
226
243
  - For example, if using a hosted version of the schema:
227
244
  ```json
228
245
  {
229
- "$schema": "https://unpkg.com/@todesktop/cli@1.13.0-0/schemas/schema.json",
246
+ "$schema": "https://unpkg.com/@todesktop/cli@1.13.0/schemas/schema.json",
230
247
  "id": "your-todesktop-id"
231
248
  }
232
249
  ```
@@ -418,9 +435,11 @@ The DMG windows position and size. In most cases, you will only want to specify
418
435
 
419
436
  ### `extends` - (optional) string
420
437
 
421
- Example: `./todesktop.staging.json`
438
+ Default: `null`.
422
439
 
423
- This is the path to a base configuration file. This is especially useful for configuration sharing between staging and production builds. The base configuration file can be a relative path from the project root or an absolute path.
440
+ Example: `./todesktop.base.json` or `./todesktop.base.js`.
441
+
442
+ This is the path to a base configuration file (`.json` or `.js`). This is especially useful for configuration sharing between different environments (e.g., staging and production). The base configuration file can be a relative path from the project root or an absolute path.
424
443
 
425
444
  For more information about how to create a staging version of your app see: [How do I create a staging version of my app?](#how-do-i-create-a-staging-version-of-my-app).
426
445
 
@@ -1202,9 +1221,9 @@ ToDesktop CLI supports the concept of a staging version of your app. This is use
1202
1221
 
1203
1222
  1. Create a new app in ToDesktop's web UI.
1204
1223
 
1205
- 2. Create a new todesktop configuration file named `todesktop.staging.json`
1224
+ 2. Create a new configuration file, for example `todesktop.staging.json` or `todesktop.staging.js`.
1206
1225
 
1207
- 3. Add the following to your `todesktop.staging.json` file:
1226
+ 3. Add the following to your staging configuration file (e.g., `todesktop.staging.json`):
1208
1227
 
1209
1228
  ```json
1210
1229
  {
@@ -1286,6 +1305,12 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1286
1305
 
1287
1306
  ## Changelog
1288
1307
 
1308
+ ### v1.14.0
1309
+
1310
+ - Add support for `todesktop.js` configuration file for dynamic configurations.
1311
+ - Upgrade to Firebase v11.
1312
+ - Update Node.js engine requirement from >=12 to >=16.
1313
+
1289
1314
  ### v1.13.0
1290
1315
 
1291
1316
  - Add support for `platformOverrides` in config to specify platform-specific overrides for app configuration
@@ -1398,7 +1423,7 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1398
1423
 
1399
1424
  ### v1.9.0
1400
1425
 
1401
- - You can now specify `@electron/rebuild` as a custom `rebuildLibrary` in your `todesktop.json` file.
1426
+ - You can now specify `@electron/rebuild` as a custom `rebuildLibrary` in your configuration file.
1402
1427
 
1403
1428
  ### v1.8.1
1404
1429
 
@@ -1408,8 +1433,8 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1408
1433
 
1409
1434
  - Add support for `--webhook` flag for `todesktop build` command
1410
1435
  - Add support for `--async` flag to run a build in the in the background
1411
- - Add support for specifying custom `yarnVersion` in config
1412
- - Add support for specifying custom `pnpmVersion` in config
1436
+ - Add support for specifying custom `yarnVersion` in the configuration file
1437
+ - Add support for specifying custom `pnpmVersion` in the configuration file
1413
1438
 
1414
1439
  ### v1.7.7
1415
1440
 
@@ -1421,8 +1446,8 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1421
1446
 
1422
1447
  ### v1.7.5
1423
1448
 
1424
- - Add support for specifying custom `npmVersion` in config
1425
- - Add support for bundling a requirements file for Mac
1449
+ - Add support for specifying custom `npmVersion` in the configuration file
1450
+ - Add support for bundling a requirements file for Mac (`mac.requirements`)
1426
1451
 
1427
1452
  ### v1.7.4
1428
1453
 
@@ -1434,7 +1459,7 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1434
1459
 
1435
1460
  ### v1.7.1
1436
1461
 
1437
- - Add support for specifying custom `appBuilderLibVersion` in config
1462
+ - Add support for specifying custom `appBuilderLibVersion` in the configuration file
1438
1463
  - Show suggestion to run a Smoke Test when releasing an untested build
1439
1464
 
1440
1465
  ### v1.7.0
@@ -1443,15 +1468,15 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1443
1468
 
1444
1469
  ### v1.6.3
1445
1470
 
1446
- - Add support for specifying custom `windows.nsisCustomBinary` in config
1471
+ - Add support for specifying custom `windows.nsisCustomBinary` in the configuration file
1447
1472
 
1448
1473
  ### v1.6.2
1449
1474
 
1450
- - Add support for specifying custom `nodeVersion` in config
1475
+ - Add support for specifying custom `nodeVersion` in the configuration file
1451
1476
 
1452
1477
  ### v1.6.1
1453
1478
 
1454
- - Add support for specifying `windows.nsisInclude` in config
1479
+ - Add support for specifying `windows.nsisInclude` in the configuration file
1455
1480
 
1456
1481
  ### v1.6.0
1457
1482
 
@@ -1480,7 +1505,7 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
1480
1505
 
1481
1506
  ### v1.4.0
1482
1507
 
1483
- - Adds `extends` and `packageJson` field to `todesktop.json` file.
1508
+ - Adds `extends` and `packageJson` fields to the configuration file.
1484
1509
  - Added `--config` option to pass a different configuration file.
1485
1510
 
1486
1511
  ### v1.3.0
package/dist/cli.js CHANGED
@@ -158,8 +158,9 @@ var init = () => {
158
158
  if (hasInitialized) {
159
159
  return;
160
160
  }
161
+ const envFile = process.env.NODE_ENV === "test" ? "../.env.test" : "../.env";
161
162
  import_dotenv.default.config({
162
- path: import_path.default.resolve(__dirname, "../.env")
163
+ path: import_path.default.resolve(__dirname, envFile)
163
164
  });
164
165
  hasInitialized = true;
165
166
  };
@@ -169,11 +170,11 @@ var getEnvironmentVariables_default = () => {
169
170
  };
170
171
 
171
172
  // src/utilities/firestore.ts
172
- var import_app = __toESM(require("firebase/app"));
173
+ var import_app = require("firebase/app");
173
174
  var import_firestore = require("firebase/firestore");
174
175
  var import_auth = require("firebase/auth");
175
176
  var environmentVariables = getEnvironmentVariables_default();
176
- var firebaseDB = import_app.default.initializeApp({
177
+ var firebaseApp = (0, import_app.initializeApp)({
177
178
  apiKey: environmentVariables.TODESKTOP_CLI_FIREBASE_API_KEY,
178
179
  authDomain: environmentVariables.TODESKTOP_CLI_FIREBASE_AUTH_DOMAIN,
179
180
  databaseURL: environmentVariables.TODESKTOP_CLI_FIREBASE_DATABASE_URL,
@@ -182,14 +183,16 @@ var firebaseDB = import_app.default.initializeApp({
182
183
  messagingSenderId: environmentVariables.TODESKTOP_CLI_FIREBASE_MESSAGING_SENDER_ID,
183
184
  appId: environmentVariables.TODESKTOP_CLI_FIREBASE_ID
184
185
  });
185
- var currentUser = () => import_app.default.auth().currentUser;
186
+ var auth = (0, import_auth.getAuth)(firebaseApp);
187
+ var db = (0, import_firestore.getFirestore)(firebaseApp);
188
+ var currentUser = () => auth.currentUser;
186
189
  var signInWithCustomToken = async (token) => {
187
- return import_app.default.auth().signInWithCustomToken(token);
190
+ return (0, import_auth.signInWithCustomToken)(auth, token);
188
191
  };
189
- var onUserAuth = (handler) => import_app.default.auth().onAuthStateChanged((user) => {
192
+ var onUserAuth = (handler) => (0, import_auth.onAuthStateChanged)(auth, (user) => {
190
193
  handler(user || {});
191
194
  });
192
- var firestore_default = firebaseDB.firestore();
195
+ var firestore_default = db;
193
196
 
194
197
  // src/utilities/configStore.ts
195
198
  var fs2 = __toESM(require("fs"));
@@ -339,9 +342,6 @@ var useExit_default = () => {
339
342
  const { exit } = (0, import_ink.useApp)();
340
343
  return (error) => {
341
344
  logger_default.debug({ error }, "Exit called");
342
- firestore_default.terminate().catch(
343
- (e) => logger_default.error(e)
344
- );
345
345
  let timeoutId;
346
346
  Promise.race([
347
347
  new Promise((resolve4) => flush(() => resolve4())),
@@ -624,14 +624,28 @@ var import_ink6 = require("ink");
624
624
  var import_react4 = require("react");
625
625
 
626
626
  // src/utilities/getCallableFirebaseFunction.ts
627
- var import_firebase = __toESM(require("firebase"));
628
627
  var import_functions = require("firebase/functions");
628
+ var import_app2 = require("firebase/app");
629
629
  var env = getEnvironmentVariables_default();
630
+ var app = (0, import_app2.initializeApp)({
631
+ apiKey: env.TODESKTOP_CLI_FIREBASE_API_KEY,
632
+ authDomain: env.TODESKTOP_CLI_FIREBASE_AUTH_DOMAIN,
633
+ databaseURL: env.TODESKTOP_CLI_FIREBASE_DATABASE_URL,
634
+ projectId: env.TODESKTOP_CLI_FIREBASE_PROJECT_ID,
635
+ storageBucket: env.TODESKTOP_CLI_FIREBASE_STORAGE_BUCKET,
636
+ messagingSenderId: env.TODESKTOP_CLI_FIREBASE_MESSAGING_SENDER_ID,
637
+ appId: env.TODESKTOP_CLI_FIREBASE_ID
638
+ });
639
+ var functions = (0, import_functions.getFunctions)(app);
630
640
  if (env.TODESKTOP_CLI_ENV === "development") {
631
641
  const firebaseUrl = new URL(env.TODESKTOP_CLI_FIREBASE_FUNCTIONS_BASE);
632
- import_firebase.default.functions().useFunctionsEmulator(firebaseUrl.origin);
642
+ (0, import_functions.connectFunctionsEmulator)(
643
+ functions,
644
+ firebaseUrl.hostname,
645
+ parseInt(firebaseUrl.port)
646
+ );
633
647
  }
634
- var getCallableFirebaseFunction_default = (functionName) => import_firebase.default.functions().httpsCallable(functionName);
648
+ var getCallableFirebaseFunction_default = (functionName) => (0, import_functions.httpsCallable)(functions, functionName);
635
649
 
636
650
  // src/components/CancelBuild.tsx
637
651
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -1535,8 +1549,8 @@ var schema_default = {
1535
1549
  extends: {
1536
1550
  type: "string",
1537
1551
  minLength: 1,
1538
- description: "This is the path to a base configuration file. This is especially useful for configuration sharing between staging and production builds. The base configuration file can be a relative path from the project root or an absolute path.",
1539
- examples: ["./todesktop.staging.json"],
1552
+ description: "This is the path to a base configuration file (`.json` or `.js`). This is especially useful for configuration sharing between different environments (e.g., staging and production). The base configuration file can be a relative path from the project root or an absolute path.",
1553
+ examples: ["./todesktop.base.json", "./todesktop.base.js"],
1540
1554
  default: null
1541
1555
  },
1542
1556
  extraContentFiles: { $ref: "#/definitions/extraContentFilesProperty" },
@@ -2496,10 +2510,10 @@ You can disable this error by running todesktop build with the --ignore-extends-
2496
2510
  function getProjectConfig(configPath, flags) {
2497
2511
  if (!configPath) {
2498
2512
  logger_default.debug("No config path provided, searching for one");
2499
- configPath = import_find_up.default.sync("todesktop.json");
2513
+ configPath = import_find_up.default.sync(["todesktop.json", "todesktop.js"]);
2500
2514
  if (!configPath) {
2501
2515
  throw new Error(
2502
- "Can not find todesktop.json in this folder or any parent folders"
2516
+ "Can not find todesktop.json or todesktop.js in this folder or any parent folders"
2503
2517
  );
2504
2518
  }
2505
2519
  } else {
@@ -2583,6 +2597,7 @@ var getVersionControlInfo_default = async (directory) => {
2583
2597
 
2584
2598
  // src/commands/build/utilities/spyBuild.ts
2585
2599
  var import_events = __toESM(require("events"));
2600
+ var import_firestore3 = require("firebase/firestore");
2586
2601
  function spyBuild() {
2587
2602
  const emitter = new import_events.default();
2588
2603
  let unsubscribeSnapshot;
@@ -2609,9 +2624,10 @@ function spyBuild() {
2609
2624
  userId
2610
2625
  }) {
2611
2626
  const buildPath = `users/${userId}/applications/${appId}/builds/${buildId}`;
2612
- unsubscribeSnapshot = firestore_default.doc(buildPath).onSnapshot(
2627
+ unsubscribeSnapshot = (0, import_firestore3.onSnapshot)(
2628
+ (0, import_firestore3.doc)(firestore_default, buildPath),
2613
2629
  (snapshot) => {
2614
- latestBuildDoc = snapshot.exists ? snapshot.data() : void 0;
2630
+ latestBuildDoc = snapshot.exists() ? snapshot.data() : void 0;
2615
2631
  emitter.emit("update", {
2616
2632
  build: latestBuildDoc,
2617
2633
  snapshot
@@ -2686,9 +2702,10 @@ var uploadToS3 = async ({
2686
2702
  }
2687
2703
  }) => {
2688
2704
  const getSignedURL = getCallableFirebaseFunction_default("getSignedURL");
2689
- const { data } = await getSignedURL({
2705
+ const result = await getSignedURL({
2690
2706
  key
2691
2707
  });
2708
+ const data = result.data;
2692
2709
  const parts = await (0, import_stream_to_array.default)(inputStream);
2693
2710
  const buffers = parts.map(
2694
2711
  (part) => Buffer.isBuffer(part) ? part : Buffer.from(part)
@@ -3543,29 +3560,37 @@ var import_prop_types10 = __toESM(require("prop-types"));
3543
3560
  var import_react11 = require("react");
3544
3561
 
3545
3562
  // src/utilities/getLatestBuildId.ts
3563
+ var import_firestore8 = require("firebase/firestore");
3546
3564
  async function getLatestBuildId({
3547
3565
  appId,
3548
3566
  userId
3549
3567
  }) {
3550
3568
  logger_default.debug({ appId }, "getLatestBuildId");
3551
- const appRef = firestore_default.doc(`users/${userId}/applications/${appId}`);
3552
- const appSnapshot = await appRef.get();
3553
- if (!appSnapshot.exists) {
3569
+ const appRef = (0, import_firestore8.doc)(firestore_default, `users/${userId}/applications/${appId}`);
3570
+ const appSnapshot = await (0, import_firestore8.getDoc)(appRef);
3571
+ if (!appSnapshot.exists()) {
3554
3572
  throw new Error(`Application with ID of ${appId} doesn't exist.`);
3555
3573
  }
3556
- const buildsResult = await appRef.collection("builds").orderBy("createdAt", "desc").limit(1).get();
3574
+ const buildsQuery = (0, import_firestore8.query)(
3575
+ (0, import_firestore8.collection)(firestore_default, `users/${userId}/applications/${appId}/builds`),
3576
+ (0, import_firestore8.orderBy)("createdAt", "desc"),
3577
+ (0, import_firestore8.limit)(1)
3578
+ );
3579
+ const buildsResult = await (0, import_firestore8.getDocs)(buildsQuery);
3557
3580
  return buildsResult.empty ? void 0 : buildsResult.docs[0].id;
3558
3581
  }
3559
3582
 
3560
3583
  // src/utilities/subscribeToFirebaseDoc.ts
3584
+ var import_firestore10 = require("firebase/firestore");
3561
3585
  async function subscribeToFirebaseDoc(key, receiver) {
3562
3586
  return new Promise((resolve4, reject) => {
3563
3587
  logger_default.debug({ key }, "subscribeToFirebaseDoc");
3564
- const unsubscribe = firestore_default.doc(key).onSnapshot(
3588
+ const unsubscribe = (0, import_firestore10.onSnapshot)(
3589
+ (0, import_firestore10.doc)(firestore_default, key),
3565
3590
  (snapshot) => {
3566
3591
  receiver({
3567
3592
  snapshot,
3568
- data: snapshot.exists ? snapshot.data() : void 0
3593
+ data: snapshot.exists() ? snapshot.data() : void 0
3569
3594
  });
3570
3595
  resolve4(unsubscribe);
3571
3596
  },
@@ -3592,14 +3617,14 @@ var subscribeToBuild_default = async ({ appId, buildId, onDataReceived, userId }
3592
3617
  };
3593
3618
 
3594
3619
  // src/utilities/findAppUserId.ts
3595
- var getCollection = (collectionRef) => {
3596
- return collectionRef.get().then((resp) => {
3597
- const result = [];
3598
- resp.forEach((doc) => result.push(doc.data()));
3599
- return result;
3600
- });
3620
+ var import_firestore12 = require("firebase/firestore");
3621
+ var getCollection = async (collectionRef) => {
3622
+ const resp = await (0, import_firestore12.getDocs)(collectionRef);
3623
+ const result = [];
3624
+ resp.forEach((doc9) => result.push(doc9.data()));
3625
+ return result;
3601
3626
  };
3602
- var acceptedUsersCollection = (id) => firestore_default.collection(`users/${id}/acceptedUsers`);
3627
+ var acceptedUsersCollection = (id) => (0, import_firestore12.collection)(firestore_default, `users/${id}/acceptedUsers`);
3603
3628
  var findAppUserId = async (appId) => {
3604
3629
  const { uid, email } = currentUser();
3605
3630
  const acceptedUsers = await getCollection(acceptedUsersCollection(uid));
@@ -3610,8 +3635,9 @@ var findAppUserId = async (appId) => {
3610
3635
  ];
3611
3636
  for (const user of users) {
3612
3637
  try {
3613
- const doc = await firestore_default.doc(`users/${user.id}/applications/${appId}`).get();
3614
- if (doc.exists)
3638
+ const docRef = (0, import_firestore12.doc)(firestore_default, `users/${user.id}/applications/${appId}`);
3639
+ const docSnap = await (0, import_firestore12.getDoc)(docRef);
3640
+ if (docSnap.exists())
3615
3641
  return user;
3616
3642
  } catch (err) {
3617
3643
  console.error(err);
@@ -3782,6 +3808,7 @@ ViewBuild.propTypes = {
3782
3808
  var ViewBuild_default = ViewBuild;
3783
3809
 
3784
3810
  // src/commands/build/components/OngoingBuildGuard.tsx
3811
+ var import_firestore14 = require("firebase/firestore");
3785
3812
  var import_is_ci5 = __toESM(require("is-ci"));
3786
3813
  var import_jsx_runtime20 = require("react/jsx-runtime");
3787
3814
  var OngoingBuildGuard = ({
@@ -3811,7 +3838,16 @@ var OngoingBuildGuard = ({
3811
3838
  const twentyFourHoursAgo = new Date(
3812
3839
  now.getTime() - 24 * 60 * 60 * 1e3
3813
3840
  );
3814
- const buildsResult = await firestore_default.doc(`users/${id}/applications/${applicationId}`).collection("builds").where("createdAt", ">=", twentyFourHoursAgo).orderBy("createdAt", "desc").limit(10).get();
3841
+ const buildsQuery = (0, import_firestore14.query)(
3842
+ (0, import_firestore14.collection)(
3843
+ firestore_default,
3844
+ `users/${id}/applications/${applicationId}/builds`
3845
+ ),
3846
+ (0, import_firestore14.where)("createdAt", ">=", twentyFourHoursAgo),
3847
+ (0, import_firestore14.orderBy)("createdAt", "desc"),
3848
+ (0, import_firestore14.limit)(10)
3849
+ );
3850
+ const buildsResult = await (0, import_firestore14.getDocs)(buildsQuery);
3815
3851
  const stateUpdates = {
3816
3852
  appId: applicationId,
3817
3853
  isLoading: false,
@@ -3824,7 +3860,7 @@ var OngoingBuildGuard = ({
3824
3860
  { isRunning },
3825
3861
  "OngoingBuildGuard component: got latest build"
3826
3862
  );
3827
- stateUpdates.builds = buildsResult.docs.map((doc) => doc.data()).filter((build) => {
3863
+ stateUpdates.builds = buildsResult.docs.map((doc9) => doc9.data()).filter((build) => {
3828
3864
  if (isBuildRunning(build) && build.status !== "preparation") {
3829
3865
  return true;
3830
3866
  }
@@ -4184,31 +4220,35 @@ var capitalize_default = (input) => {
4184
4220
  };
4185
4221
 
4186
4222
  // src/utilities/getBuilds.ts
4223
+ var import_firestore17 = require("firebase/firestore");
4187
4224
  async function getBuilds({
4188
- addWhereClauses = (collection) => collection,
4225
+ addWhereClauses = () => [],
4189
4226
  userId,
4190
4227
  appId,
4191
- limit = 5,
4228
+ limit: limit4 = 5,
4192
4229
  startAfter = null
4193
4230
  }) {
4194
- logger_default.debug({ appId, limit, startAfter }, "getBuilds");
4195
- const appRef = firestore_default.doc(`users/${userId}/applications/${appId}`);
4196
- const appSnapshot = await appRef.get();
4197
- if (!appSnapshot.exists) {
4231
+ logger_default.debug({ appId, limit: limit4, startAfter }, "getBuilds");
4232
+ const appRef = (0, import_firestore17.doc)(firestore_default, `users/${userId}/applications/${appId}`);
4233
+ const appSnapshot = await (0, import_firestore17.getDoc)(appRef);
4234
+ if (!appSnapshot.exists()) {
4198
4235
  throw new Error(`Application with ID of ${appId} doesn't exist.`);
4199
4236
  }
4200
- let query = addWhereClauses(appRef.collection("builds")).orderBy(
4201
- "createdAt",
4202
- "desc"
4237
+ const buildsCollection = (0, import_firestore17.collection)(
4238
+ firestore_default,
4239
+ `users/${userId}/applications/${appId}/builds`
4203
4240
  );
4241
+ const constraints = [...addWhereClauses(), (0, import_firestore17.orderBy)("createdAt", "desc")];
4204
4242
  if (startAfter) {
4205
- query = query.startAfter(startAfter);
4243
+ constraints.push((0, import_firestore17.startAfter)(startAfter));
4206
4244
  }
4207
- const buildsResult = await query.limit(limit).get();
4245
+ constraints.push((0, import_firestore17.limit)(limit4));
4246
+ const query4 = (0, import_firestore17.query)(buildsCollection, ...constraints);
4247
+ const buildsResult = await (0, import_firestore17.getDocs)(query4);
4208
4248
  if (buildsResult.empty) {
4209
4249
  return [];
4210
4250
  }
4211
- return buildsResult.docs.map((doc) => doc.data());
4251
+ return buildsResult.docs.map((doc9) => doc9.data());
4212
4252
  }
4213
4253
 
4214
4254
  // src/utilities/getRelativeDateFromDateString.ts
@@ -4510,6 +4550,7 @@ var LogoutCommand_default = LogoutWrapper;
4510
4550
  // src/components/BuildPicker.tsx
4511
4551
  var import_ink29 = require("ink");
4512
4552
  var import_react17 = require("react");
4553
+ var import_firestore23 = require("firebase/firestore");
4513
4554
 
4514
4555
  // src/components/SelectTable.tsx
4515
4556
  var import_ink28 = require("ink");
@@ -4575,15 +4616,21 @@ SelectTable.propTypes = {
4575
4616
  };
4576
4617
  var SelectTable_default = SelectTable;
4577
4618
 
4619
+ // src/utilities/getLatestReleasedBuild.ts
4620
+ var import_firestore21 = require("firebase/firestore");
4621
+
4578
4622
  // src/utilities/getBuildById.ts
4623
+ var import_firestore19 = require("firebase/firestore");
4579
4624
  async function getBuildById({
4580
4625
  appId,
4581
4626
  buildId,
4582
4627
  userId
4583
4628
  }) {
4584
4629
  logger_default.debug({ appId, buildId }, "getBuildById");
4585
- const snapshot = await firestore_default.doc(`users/${userId}/applications/${appId}/builds/${buildId}`).get();
4586
- if (!snapshot.exists) {
4630
+ const snapshot = await (0, import_firestore19.getDoc)(
4631
+ (0, import_firestore19.doc)(firestore_default, `users/${userId}/applications/${appId}/builds/${buildId}`)
4632
+ );
4633
+ if (!snapshot.exists()) {
4587
4634
  return null;
4588
4635
  }
4589
4636
  return snapshot.data();
@@ -4595,21 +4642,26 @@ async function getLatestReleasedBuild({
4595
4642
  userId
4596
4643
  }) {
4597
4644
  var _a, _b;
4598
- const appRef = firestore_default.doc(`users/${userId}/applications/${appId}`);
4599
- const appSnapshot = await appRef.get();
4600
- const app = appSnapshot.exists ? appSnapshot.data() : void 0;
4601
- if (!app) {
4645
+ const appRef = (0, import_firestore21.doc)(firestore_default, `users/${userId}/applications/${appId}`);
4646
+ const appSnapshot = await (0, import_firestore21.getDoc)(appRef);
4647
+ const app2 = appSnapshot.exists() ? appSnapshot.data() : void 0;
4648
+ if (!app2) {
4602
4649
  throw new Error(`Application with ID of ${appId} doesn't exist.`);
4603
4650
  }
4604
- if ((_a = app.meta) == null ? void 0 : _a.latestReleaseBuildId) {
4651
+ if ((_a = app2.meta) == null ? void 0 : _a.latestReleaseBuildId) {
4605
4652
  return await getBuildById({
4606
- buildId: (_b = app.meta) == null ? void 0 : _b.latestReleaseBuildId,
4653
+ buildId: (_b = app2.meta) == null ? void 0 : _b.latestReleaseBuildId,
4607
4654
  appId,
4608
4655
  userId
4609
4656
  }) || void 0;
4610
4657
  }
4611
- const buildsResult = await appRef.collection("builds").orderBy("releasedAt", "desc").limit(1).get();
4612
- return buildsResult.empty ? void 0 : buildsResult.docs[0];
4658
+ const buildsQuery = (0, import_firestore21.query)(
4659
+ (0, import_firestore21.collection)(firestore_default, `users/${userId}/applications/${appId}/builds`),
4660
+ (0, import_firestore21.orderBy)("releasedAt", "desc"),
4661
+ (0, import_firestore21.limit)(1)
4662
+ );
4663
+ const buildsResult = await (0, import_firestore21.getDocs)(buildsQuery);
4664
+ return buildsResult.empty ? void 0 : buildsResult.docs[0].data();
4613
4665
  }
4614
4666
 
4615
4667
  // src/components/BuildPicker.tsx
@@ -4732,7 +4784,7 @@ async function getBuildItems({
4732
4784
  const { id: userId, label: userName } = await findAppUserId_default(appId);
4733
4785
  const latestReleasedBuild = await getLatestReleasedBuild({ appId, userId });
4734
4786
  const rawBuilds = await getBuilds({
4735
- addWhereClauses: (query) => query.where("status", "==", "succeeded"),
4787
+ addWhereClauses: () => [(0, import_firestore23.where)("status", "==", "succeeded")],
4736
4788
  appId,
4737
4789
  limit: 50,
4738
4790
  userId
@@ -4802,7 +4854,7 @@ async function releaseBuild({
4802
4854
  }
4803
4855
  function isFirebaseFunctionError(error) {
4804
4856
  return Boolean(
4805
- typeof error === "object" && error && "code" in error && error.code === "string"
4857
+ typeof error === "object" && error && "code" in error && typeof error.code === "string"
4806
4858
  );
4807
4859
  }
4808
4860
 
@@ -5629,6 +5681,7 @@ async function queueSmokeTest({
5629
5681
  }
5630
5682
 
5631
5683
  // src/commands/smoke-test/utilities/waitUntilFinished.ts
5684
+ var import_firestore27 = require("firebase/firestore");
5632
5685
  async function waitUntilFinished({
5633
5686
  appId,
5634
5687
  buildId,
@@ -5637,9 +5690,10 @@ async function waitUntilFinished({
5637
5690
  }) {
5638
5691
  const docPath = `users/${userId}/applications/${appId}/builds/${buildId}`;
5639
5692
  return new Promise((resolve4, reject) => {
5640
- const unsubscribe = firestore_default.doc(docPath).onSnapshot(
5693
+ const unsubscribe = (0, import_firestore27.onSnapshot)(
5694
+ (0, import_firestore27.doc)(firestore_default, docPath),
5641
5695
  (snapshot) => {
5642
- const data = snapshot.exists ? snapshot.data() : void 0;
5696
+ const data = snapshot.exists() ? snapshot.data() : void 0;
5643
5697
  const progress = makeProgress(data);
5644
5698
  onProgress(progress);
5645
5699
  if (progress.isFinished) {
@@ -5790,17 +5844,17 @@ var import_ink38 = require("ink");
5790
5844
  var import_jsx_runtime45 = require("react/jsx-runtime");
5791
5845
  var WhoAmI = () => {
5792
5846
  const exit = useExit_default();
5793
- const auth = getAuthConfig();
5847
+ const auth2 = getAuthConfig();
5794
5848
  const { hasAttemptedTracking } = useAnalyticsCommand("whoami", {}, {});
5795
5849
  (0, import_react23.useEffect)(() => {
5796
5850
  if (hasAttemptedTracking) {
5797
5851
  exit();
5798
5852
  }
5799
5853
  }, [exit, hasAttemptedTracking]);
5800
- if (!auth || !auth.email) {
5854
+ if (!auth2 || !auth2.email) {
5801
5855
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_ink38.Text, { children: "You're not signed in" });
5802
5856
  }
5803
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_ink38.Text, { children: auth.email });
5857
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_ink38.Text, { children: auth2.email });
5804
5858
  };
5805
5859
  var WhoAmIWrapper = () => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ErrorBoundary_default, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(LoginHOC_default, { isInteractive: false, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(WhoAmI, {}) }) });
5806
5860
  var WhoamiCommand_default = WhoAmIWrapper;
@@ -5843,7 +5897,7 @@ var package_default = {
5843
5897
  access: "public"
5844
5898
  },
5845
5899
  name: "@todesktop/cli",
5846
- version: "1.13.0-0",
5900
+ version: "1.13.0",
5847
5901
  license: "MIT",
5848
5902
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
5849
5903
  homepage: "https://todesktop.com/cli",
@@ -5854,7 +5908,7 @@ var package_default = {
5854
5908
  todesktop: "./dist/cli.js"
5855
5909
  },
5856
5910
  engines: {
5857
- node: ">=12"
5911
+ node: ">=16"
5858
5912
  },
5859
5913
  scripts: {
5860
5914
  dev: "cp-cli dev.env .env && npm run build:dev && npm link",
@@ -5900,7 +5954,7 @@ var package_default = {
5900
5954
  "fast-glob": "^3.2.4",
5901
5955
  "final-form": "^4.20.1",
5902
5956
  "find-up": "^5.0.0",
5903
- firebase: "^7.24.0",
5957
+ firebase: "^11.9.1",
5904
5958
  "git-rev-sync": "^3.0.2",
5905
5959
  ink: "^3.2.0",
5906
5960
  "ink-gradient": "^2.0.0",