@todesktop/cli 1.14.0 → 1.15.1
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 +48 -9
- package/dist/cli.js +159 -28
- package/dist/cli.js.map +4 -4
- package/dist/types.d.ts +503 -0
- package/package.json +6 -3
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 or todesktop.
|
|
13
|
+
- [Project configuration (todesktop.json, todesktop.js, or todesktop.ts)](#project-configuration-todesktopjson-todesktopjs-or-todesktops)
|
|
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,7 +42,7 @@ 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.
|
|
45
|
+
"$schema": "https://unpkg.com/@todesktop/cli@1.15.0/schemas/schema.json",
|
|
46
46
|
"schemaVersion": 1
|
|
47
47
|
"id": "your-todesktop-id",
|
|
48
48
|
"icon": "./desktop-icon.png",
|
|
@@ -62,7 +62,26 @@ module.exports = {
|
|
|
62
62
|
};
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
You can also create a `todesktop.ts` file for TypeScript projects with full type checking and IntelliSense:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import type { Schema } from "@todesktop/cli";
|
|
69
|
+
import path from "path";
|
|
70
|
+
|
|
71
|
+
const config: Schema = {
|
|
72
|
+
id: process.env.TODESKTOP_APP_ID || "your-default-todesktop-id",
|
|
73
|
+
icon: path.join(__dirname, "assets", "desktop-icon.png"),
|
|
74
|
+
schemaVersion: 1,
|
|
75
|
+
nodeVersion: "18.12.1",
|
|
76
|
+
mac: {
|
|
77
|
+
category: "public.app-category.productivity",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default config;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
See [Project configuration](#project-configuration-todesktopjson-todesktopjs-or-todesktops) for the full list of configuration options.
|
|
66
85
|
|
|
67
86
|
### Step 3: Add @todesktop/runtime as a dependency
|
|
68
87
|
|
|
@@ -220,17 +239,27 @@ The webhook receives a POST request with the following JSON body:
|
|
|
220
239
|
}
|
|
221
240
|
```
|
|
222
241
|
|
|
223
|
-
## Project configuration (todesktop.json or todesktop.
|
|
242
|
+
## Project configuration (todesktop.json, todesktop.js, or todesktop.ts)
|
|
243
|
+
|
|
244
|
+
This describes all of the possible configuration options in your `todesktop.json`, `todesktop.js`, or `todesktop.ts` file.
|
|
245
|
+
|
|
246
|
+
You can use:
|
|
247
|
+
|
|
248
|
+
- A standard JSON file (`todesktop.json`) for static configuration
|
|
249
|
+
- A JavaScript file (`todesktop.js`) that exports a configuration object for dynamic configuration
|
|
250
|
+
- A TypeScript file (`todesktop.ts`) that exports a configuration object with full type checking and IntelliSense
|
|
224
251
|
|
|
225
|
-
|
|
252
|
+
Using `.js` or `.ts` files allows for dynamic configuration, such as setting values based on environment variables or computing paths.
|
|
226
253
|
|
|
227
|
-
|
|
254
|
+
**Note:**
|
|
228
255
|
|
|
229
|
-
|
|
256
|
+
- Schema validation and IntelliSense for `.json` files are available through the JSON schema (described under [Installation](#installation))
|
|
257
|
+
- TypeScript files (`.ts`) provide full type checking and IntelliSense when using the exported `Schema` type from `@todesktop/cli`
|
|
258
|
+
- TypeScript compilation requires a local installation of TypeScript in your project
|
|
230
259
|
|
|
231
260
|
To avoid confusion, the following terms will be used throughout this file:
|
|
232
261
|
|
|
233
|
-
- "Project root": this is the parent directory of your `todesktop.json` or `todesktop.
|
|
262
|
+
- "Project root": this is the parent directory of your `todesktop.json`, `todesktop.js`, or `todesktop.ts`.
|
|
234
263
|
|
|
235
264
|
### `$schema` - (optional) string
|
|
236
265
|
|
|
@@ -243,7 +272,7 @@ To enable JSON validation and IntelliSense for your `todesktop.json` file in com
|
|
|
243
272
|
- For example, if using a hosted version of the schema:
|
|
244
273
|
```json
|
|
245
274
|
{
|
|
246
|
-
"$schema": "https://unpkg.com/@todesktop/cli@1.
|
|
275
|
+
"$schema": "https://unpkg.com/@todesktop/cli@1.15.0/schemas/schema.json",
|
|
247
276
|
"id": "your-todesktop-id"
|
|
248
277
|
}
|
|
249
278
|
```
|
|
@@ -1305,6 +1334,16 @@ Now, when we build your app on ToDesktop servers, it will also run your custom `
|
|
|
1305
1334
|
|
|
1306
1335
|
## Changelog
|
|
1307
1336
|
|
|
1337
|
+
### v1.15.1
|
|
1338
|
+
|
|
1339
|
+
- Update dependencies to latest non-breaking versions.
|
|
1340
|
+
|
|
1341
|
+
### v1.15.0
|
|
1342
|
+
|
|
1343
|
+
- Add support for `todesktop.ts` configuration file with full TypeScript type checking and IntelliSense.
|
|
1344
|
+
- Export `Schema` type from `@todesktop/cli` for TypeScript configuration files.
|
|
1345
|
+
- TypeScript compilation uses user's local TypeScript installation (no production dependencies added).
|
|
1346
|
+
|
|
1308
1347
|
### v1.14.0
|
|
1309
1348
|
|
|
1310
1349
|
- Add support for `todesktop.js` configuration file for dynamic configurations.
|
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
|
));
|
|
@@ -73,7 +77,10 @@ function sanitizeFields(obj) {
|
|
|
73
77
|
const lowerKey = key.toLowerCase();
|
|
74
78
|
const value = copy[key];
|
|
75
79
|
if (SENSITIVE_FIELD_KEY_SUBSTRINGS.some(
|
|
76
|
-
(substring) =>
|
|
80
|
+
(substring) => (
|
|
81
|
+
// Fields that start with `$` are references to secrets (and not secrets themselves) so keep them in logs because they are useful.
|
|
82
|
+
lowerKey.includes(substring) && !lowerKey.startsWith("$")
|
|
83
|
+
)
|
|
77
84
|
)) {
|
|
78
85
|
copy[key] = "[REDACTED]";
|
|
79
86
|
} else if (typeof value === "string" && isJWT(value)) {
|
|
@@ -344,9 +351,11 @@ var useExit_default = () => {
|
|
|
344
351
|
logger_default.debug({ error }, "Exit called");
|
|
345
352
|
let timeoutId;
|
|
346
353
|
Promise.race([
|
|
347
|
-
|
|
354
|
+
// flush the analytics to make sure all outstanding events are pushed to segment
|
|
355
|
+
new Promise((resolve5) => flush(() => resolve5())),
|
|
356
|
+
// If it takes longer than 1 second, resolve early to proceed with program exit
|
|
348
357
|
new Promise(
|
|
349
|
-
(
|
|
358
|
+
(resolve5) => timeoutId = setTimeout(() => resolve5(), 1e3)
|
|
350
359
|
)
|
|
351
360
|
]).catch(() => {
|
|
352
361
|
}).finally(() => {
|
|
@@ -491,7 +500,8 @@ var isPlatformBuildRunning = (platformBuild) => {
|
|
|
491
500
|
if (!platformBuild) {
|
|
492
501
|
return false;
|
|
493
502
|
}
|
|
494
|
-
return !platformBuild.shouldSkip &&
|
|
503
|
+
return !platformBuild.shouldSkip && // <-- Noteworthy
|
|
504
|
+
!["cancelled", "succeeded"].includes(platformBuild.status) && ("failed" !== platformBuild.status || platformBuild.numberOfAttemptedBuilds < 2);
|
|
495
505
|
};
|
|
496
506
|
|
|
497
507
|
// src/components/BuildProgress.tsx
|
|
@@ -967,6 +977,7 @@ var ProgressBar = ({ left, right, percent }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
967
977
|
ProgressBar.propTypes = {
|
|
968
978
|
left: import_prop_types6.default.number,
|
|
969
979
|
right: import_prop_types6.default.number,
|
|
980
|
+
// 0 -> 1
|
|
970
981
|
percent: import_prop_types6.default.number.isRequired
|
|
971
982
|
};
|
|
972
983
|
var ProgressBar_default = ProgressBar;
|
|
@@ -1025,10 +1036,101 @@ async function postToFirebaseFunction_default(functionName, body = {}, config2 =
|
|
|
1025
1036
|
// src/utilities/projectConfig/getProjectConfig.ts
|
|
1026
1037
|
var import_find_up = __toESM(require("find-up"));
|
|
1027
1038
|
var import_fs = require("fs");
|
|
1039
|
+
var import_path5 = require("path");
|
|
1040
|
+
|
|
1041
|
+
// src/utilities/projectConfig/loadConfig.ts
|
|
1028
1042
|
var import_path3 = require("path");
|
|
1029
1043
|
|
|
1044
|
+
// src/utilities/projectConfig/loadTypeScriptConfig.ts
|
|
1045
|
+
var import_path2 = require("path");
|
|
1046
|
+
function loadTypeScriptConfig(configPath) {
|
|
1047
|
+
const projectRoot = process.cwd();
|
|
1048
|
+
try {
|
|
1049
|
+
logger_default.debug(`Attempting to load TypeScript config from: ${configPath}`);
|
|
1050
|
+
let typescript;
|
|
1051
|
+
try {
|
|
1052
|
+
const tsPath = (0, import_path2.resolve)(projectRoot, "node_modules", "typescript");
|
|
1053
|
+
typescript = require(tsPath);
|
|
1054
|
+
logger_default.debug(`Found TypeScript in user's project at: ${tsPath}`);
|
|
1055
|
+
} catch (error) {
|
|
1056
|
+
try {
|
|
1057
|
+
typescript = require("typescript");
|
|
1058
|
+
logger_default.debug("Using globally available TypeScript installation");
|
|
1059
|
+
} catch (globalError) {
|
|
1060
|
+
throw new Error(
|
|
1061
|
+
`TypeScript is required to load .ts configuration files but was not found. Please install TypeScript in your project: npm install --save-dev typescript`
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
const fs6 = require("fs");
|
|
1066
|
+
const sourceCode = fs6.readFileSync(configPath, "utf8");
|
|
1067
|
+
const result = typescript.transpile(sourceCode, {
|
|
1068
|
+
target: typescript.ScriptTarget.ES2018,
|
|
1069
|
+
module: typescript.ModuleKind.CommonJS,
|
|
1070
|
+
moduleResolution: typescript.ModuleResolutionKind.NodeJs,
|
|
1071
|
+
esModuleInterop: true,
|
|
1072
|
+
allowSyntheticDefaultImports: true,
|
|
1073
|
+
resolveJsonModule: true,
|
|
1074
|
+
declaration: false,
|
|
1075
|
+
sourceMap: false
|
|
1076
|
+
});
|
|
1077
|
+
const module2 = { exports: {} };
|
|
1078
|
+
const moduleWrapper = new Function(
|
|
1079
|
+
"module",
|
|
1080
|
+
"exports",
|
|
1081
|
+
"require",
|
|
1082
|
+
"__filename",
|
|
1083
|
+
"__dirname",
|
|
1084
|
+
result
|
|
1085
|
+
);
|
|
1086
|
+
moduleWrapper(
|
|
1087
|
+
module2,
|
|
1088
|
+
module2.exports,
|
|
1089
|
+
(id) => {
|
|
1090
|
+
if (id.startsWith(".")) {
|
|
1091
|
+
return require((0, import_path2.resolve)(configPath, "..", id));
|
|
1092
|
+
}
|
|
1093
|
+
return require(id);
|
|
1094
|
+
},
|
|
1095
|
+
configPath,
|
|
1096
|
+
(0, import_path2.resolve)(configPath, "..")
|
|
1097
|
+
);
|
|
1098
|
+
const config2 = module2.exports.default || module2.exports;
|
|
1099
|
+
if (!config2 || typeof config2 !== "object") {
|
|
1100
|
+
throw new Error(
|
|
1101
|
+
`TypeScript configuration file must export a configuration object. Received: ${typeof config2}`
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
logger_default.debug("Successfully loaded and compiled TypeScript configuration");
|
|
1105
|
+
return config2;
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
logger_default.error(
|
|
1108
|
+
`Failed to load TypeScript configuration from ${configPath}:`,
|
|
1109
|
+
error
|
|
1110
|
+
);
|
|
1111
|
+
if (error instanceof Error) {
|
|
1112
|
+
if (error.message.includes("Cannot find module")) {
|
|
1113
|
+
throw new Error(
|
|
1114
|
+
`Failed to load TypeScript configuration: ${error.message}. Make sure all imported modules are installed.`
|
|
1115
|
+
);
|
|
1116
|
+
} else if (error.message.includes("TypeScript is required")) {
|
|
1117
|
+
throw error;
|
|
1118
|
+
} else {
|
|
1119
|
+
throw new Error(
|
|
1120
|
+
`Failed to compile TypeScript configuration: ${error.message}. Please check your todesktop.ts file for syntax errors.`
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
throw error;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1030
1128
|
// src/utilities/projectConfig/loadConfig.ts
|
|
1031
1129
|
function loadConfig(configPath) {
|
|
1130
|
+
const extension = (0, import_path3.extname)(configPath);
|
|
1131
|
+
if (extension === ".ts") {
|
|
1132
|
+
return loadTypeScriptConfig(configPath);
|
|
1133
|
+
}
|
|
1032
1134
|
return require(configPath);
|
|
1033
1135
|
}
|
|
1034
1136
|
|
|
@@ -1154,6 +1256,7 @@ var packageJSON_default = (context) => {
|
|
|
1154
1256
|
dependencies: {
|
|
1155
1257
|
type: "object",
|
|
1156
1258
|
required: ["@todesktop/runtime"],
|
|
1259
|
+
// custom keyword that checks package names aren't included in dependencies
|
|
1157
1260
|
excludedDependencies: {
|
|
1158
1261
|
dependencyKey: "dependencies",
|
|
1159
1262
|
blacklist: ["@todesktop/cli"]
|
|
@@ -2469,14 +2572,14 @@ ${output}`
|
|
|
2469
2572
|
|
|
2470
2573
|
// src/utilities/projectConfig/computeFullProjectConfig.ts
|
|
2471
2574
|
var import_lodash2 = __toESM(require("lodash.merge"));
|
|
2472
|
-
var
|
|
2575
|
+
var import_path4 = require("path");
|
|
2473
2576
|
function computeFullProjectConfig(partialConfig, projectRoot, flags) {
|
|
2474
2577
|
if (!partialConfig.extends) {
|
|
2475
2578
|
logger_default.debug("No extends field, returning partial config");
|
|
2476
2579
|
return partialConfig;
|
|
2477
2580
|
} else {
|
|
2478
2581
|
logger_default.debug("Extends field found, resolving");
|
|
2479
|
-
const parentConfigPath = (0,
|
|
2582
|
+
const parentConfigPath = (0, import_path4.resolve)(projectRoot, partialConfig.extends);
|
|
2480
2583
|
const parentConfig = loadConfig(parentConfigPath);
|
|
2481
2584
|
parentConfig.appPath = parentConfig.appPath || ".";
|
|
2482
2585
|
const parentFullConfig = computeFullProjectConfig(
|
|
@@ -2510,20 +2613,24 @@ You can disable this error by running todesktop build with the --ignore-extends-
|
|
|
2510
2613
|
function getProjectConfig(configPath, flags) {
|
|
2511
2614
|
if (!configPath) {
|
|
2512
2615
|
logger_default.debug("No config path provided, searching for one");
|
|
2513
|
-
configPath = import_find_up.default.sync([
|
|
2616
|
+
configPath = import_find_up.default.sync([
|
|
2617
|
+
"todesktop.json",
|
|
2618
|
+
"todesktop.js",
|
|
2619
|
+
"todesktop.ts"
|
|
2620
|
+
]);
|
|
2514
2621
|
if (!configPath) {
|
|
2515
2622
|
throw new Error(
|
|
2516
|
-
"Can not find todesktop.json or todesktop.
|
|
2623
|
+
"Can not find todesktop.json, todesktop.js, or todesktop.ts in this folder or any parent folders"
|
|
2517
2624
|
);
|
|
2518
2625
|
}
|
|
2519
2626
|
} else {
|
|
2520
|
-
configPath = (0,
|
|
2627
|
+
configPath = (0, import_path5.resolve)(process.cwd(), configPath);
|
|
2521
2628
|
if (!(0, import_fs.existsSync)(configPath)) {
|
|
2522
2629
|
logger_default.error("Provided config path does not exist");
|
|
2523
2630
|
throw new Error(`Config file not found at ${configPath}`);
|
|
2524
2631
|
}
|
|
2525
2632
|
}
|
|
2526
|
-
const projectRoot = (0,
|
|
2633
|
+
const projectRoot = (0, import_path5.dirname)(configPath);
|
|
2527
2634
|
const partialConfig = loadConfig(configPath);
|
|
2528
2635
|
const config2 = computeFullProjectConfig(partialConfig, projectRoot, flags);
|
|
2529
2636
|
validateConfig({ config: config2, projectRoot });
|
|
@@ -2544,7 +2651,7 @@ var shouldExitOnBuildFailure_default = (build) => {
|
|
|
2544
2651
|
|
|
2545
2652
|
// src/commands/build/utilities/getPackageJson.ts
|
|
2546
2653
|
var import_lodash3 = __toESM(require("lodash.merge"));
|
|
2547
|
-
var
|
|
2654
|
+
var import_path6 = __toESM(require("path"));
|
|
2548
2655
|
function deleteNullDeps(dep) {
|
|
2549
2656
|
Object.keys(dep).forEach((key) => {
|
|
2550
2657
|
if (dep[key] === null) {
|
|
@@ -2566,7 +2673,7 @@ function removeNullDependencies(pkgJson) {
|
|
|
2566
2673
|
function getAppPkgJson({ config: config2 }) {
|
|
2567
2674
|
const packageJsonFromConfig = config2.packageJson || {};
|
|
2568
2675
|
const extendsFrom = packageJsonFromConfig.extends || "package.json";
|
|
2569
|
-
const packageJsonFromFile = readJson(
|
|
2676
|
+
const packageJsonFromFile = readJson(import_path6.default.join(config2.appPath, extendsFrom));
|
|
2570
2677
|
return removeNullDependencies(
|
|
2571
2678
|
(0, import_lodash3.default)({}, packageJsonFromFile, packageJsonFromConfig)
|
|
2572
2679
|
);
|
|
@@ -2606,10 +2713,10 @@ function spyBuild() {
|
|
|
2606
2713
|
if (latestBuildDoc && predicate(latestBuildDoc)) {
|
|
2607
2714
|
return Promise.resolve(latestBuildDoc);
|
|
2608
2715
|
}
|
|
2609
|
-
return new Promise((
|
|
2716
|
+
return new Promise((resolve5, reject) => {
|
|
2610
2717
|
emitter.on("update", ({ build }) => {
|
|
2611
2718
|
if (predicate(build)) {
|
|
2612
|
-
|
|
2719
|
+
resolve5(build);
|
|
2613
2720
|
}
|
|
2614
2721
|
}).once("error", (e) => reject(e));
|
|
2615
2722
|
});
|
|
@@ -2645,8 +2752,8 @@ function spyBuild() {
|
|
|
2645
2752
|
if (latestBuildDoc) {
|
|
2646
2753
|
return Promise.resolve(latestBuildDoc);
|
|
2647
2754
|
}
|
|
2648
|
-
return new Promise((
|
|
2649
|
-
emitter.once("update", (data) =>
|
|
2755
|
+
return new Promise((resolve5, reject) => {
|
|
2756
|
+
emitter.once("update", (data) => resolve5(data)).once("error", (e) => reject(e));
|
|
2650
2757
|
});
|
|
2651
2758
|
},
|
|
2652
2759
|
async whenSettled() {
|
|
@@ -2677,7 +2784,7 @@ var import_stream_to_array = __toESM(require("stream-to-array"));
|
|
|
2677
2784
|
var { TODESKTOP_CLI_S3_BUCKET } = getEnvironmentVariables_default();
|
|
2678
2785
|
var MAX_RETRIES = 3;
|
|
2679
2786
|
var RETRY_DELAY = 2e3;
|
|
2680
|
-
var delay = (ms) => new Promise((
|
|
2787
|
+
var delay = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
2681
2788
|
var uploadToS3WithRetry = async (input, retries = MAX_RETRIES) => {
|
|
2682
2789
|
try {
|
|
2683
2790
|
return await uploadToS3(input);
|
|
@@ -2711,14 +2818,14 @@ var uploadToS3 = async ({
|
|
|
2711
2818
|
(part) => Buffer.isBuffer(part) ? part : Buffer.from(part)
|
|
2712
2819
|
);
|
|
2713
2820
|
const body = Buffer.concat(buffers);
|
|
2714
|
-
return new Promise((
|
|
2821
|
+
return new Promise((resolve5, reject) => {
|
|
2715
2822
|
import_superagent.default.put(data.signedURL).send(body).set("content-type", "application/zip").on("progress", onProgress).end((err) => {
|
|
2716
2823
|
logger_default.debug({ bucket, key, url: data.uploadURL }, "uploadToS3");
|
|
2717
2824
|
if (err) {
|
|
2718
2825
|
logger_default.error({ err }, "uploadToS3");
|
|
2719
2826
|
return reject(err);
|
|
2720
2827
|
}
|
|
2721
|
-
return
|
|
2828
|
+
return resolve5({ bucket, key, url: data.uploadURL });
|
|
2722
2829
|
});
|
|
2723
2830
|
});
|
|
2724
2831
|
};
|
|
@@ -2729,7 +2836,7 @@ var import_archiver = __toESM(require("archiver"));
|
|
|
2729
2836
|
var import_du = __toESM(require("du"));
|
|
2730
2837
|
var import_fs2 = __toESM(require("fs"));
|
|
2731
2838
|
var import_chalk = __toESM(require("chalk"));
|
|
2732
|
-
var
|
|
2839
|
+
var import_path7 = __toESM(require("path"));
|
|
2733
2840
|
async function zip_default({
|
|
2734
2841
|
files,
|
|
2735
2842
|
fileSizeLimit = 20,
|
|
@@ -2784,7 +2891,7 @@ Your app is larger than ${fileSizeLimit}MB. Your app is ${import_chalk.default.b
|
|
|
2784
2891
|
processedFiles.forEach(({ from, isDirectory, stats, to }) => {
|
|
2785
2892
|
if (isDirectory) {
|
|
2786
2893
|
stream.directory(from, to);
|
|
2787
|
-
} else if (appPkgJson && to ===
|
|
2894
|
+
} else if (appPkgJson && to === import_path7.default.join("app", "package.json")) {
|
|
2788
2895
|
stream.append(JSON.stringify(appPkgJson), {
|
|
2789
2896
|
name: to
|
|
2790
2897
|
});
|
|
@@ -2904,19 +3011,36 @@ async function uploadApplicationSource({
|
|
|
2904
3011
|
);
|
|
2905
3012
|
let totalBytes = 0;
|
|
2906
3013
|
const files = [
|
|
3014
|
+
/*
|
|
3015
|
+
App files (stored in app/ in the ZIP)
|
|
3016
|
+
*/
|
|
2907
3017
|
...await getAppFiles(config2.appFiles, config2.appPath, appPkgJson),
|
|
3018
|
+
/*
|
|
3019
|
+
Optional extra content files (stored in extraContentFiles/ in the ZIP). Their
|
|
3020
|
+
paths within is the their relative path from the project root so
|
|
3021
|
+
there will be no issues with clashing filenames. We also don't
|
|
3022
|
+
also any file paths in our todesktop.json that are outside of the
|
|
3023
|
+
project directory
|
|
3024
|
+
*/
|
|
2908
3025
|
...(config2.extraContentFiles || []).map(({ from, to = "." }) => {
|
|
2909
3026
|
return {
|
|
2910
3027
|
from,
|
|
2911
3028
|
to: path7.join("extraContentFiles", to, path7.basename(from))
|
|
2912
3029
|
};
|
|
2913
3030
|
}),
|
|
3031
|
+
/*
|
|
3032
|
+
Optional extra resources (stored in extraResources/ in the ZIP).
|
|
3033
|
+
Similar to extra content files above
|
|
3034
|
+
*/
|
|
2914
3035
|
...(config2.extraResources || []).map(({ from, to = "." }) => {
|
|
2915
3036
|
return {
|
|
2916
3037
|
from,
|
|
2917
3038
|
to: path7.join("extraResources", to, path7.basename(from))
|
|
2918
3039
|
};
|
|
2919
3040
|
}),
|
|
3041
|
+
/*
|
|
3042
|
+
Icons (more may be added below)
|
|
3043
|
+
*/
|
|
2920
3044
|
{
|
|
2921
3045
|
from: config2.icon,
|
|
2922
3046
|
to: path7.join("icons", "appIcon" + path7.extname(config2.icon))
|
|
@@ -3583,7 +3707,7 @@ async function getLatestBuildId({
|
|
|
3583
3707
|
// src/utilities/subscribeToFirebaseDoc.ts
|
|
3584
3708
|
var import_firestore10 = require("firebase/firestore");
|
|
3585
3709
|
async function subscribeToFirebaseDoc(key, receiver) {
|
|
3586
|
-
return new Promise((
|
|
3710
|
+
return new Promise((resolve5, reject) => {
|
|
3587
3711
|
logger_default.debug({ key }, "subscribeToFirebaseDoc");
|
|
3588
3712
|
const unsubscribe = (0, import_firestore10.onSnapshot)(
|
|
3589
3713
|
(0, import_firestore10.doc)(firestore_default, key),
|
|
@@ -3592,7 +3716,7 @@ async function subscribeToFirebaseDoc(key, receiver) {
|
|
|
3592
3716
|
snapshot,
|
|
3593
3717
|
data: snapshot.exists() ? snapshot.data() : void 0
|
|
3594
3718
|
});
|
|
3595
|
-
|
|
3719
|
+
resolve5(unsubscribe);
|
|
3596
3720
|
},
|
|
3597
3721
|
(err) => {
|
|
3598
3722
|
reject(err);
|
|
@@ -4570,7 +4694,9 @@ var SelectTable = ({ data, onSelect }) => {
|
|
|
4570
4694
|
});
|
|
4571
4695
|
};
|
|
4572
4696
|
const ItemComponent = ({
|
|
4697
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4573
4698
|
label,
|
|
4699
|
+
// Make it compatible to SelectInput type, not used actually
|
|
4574
4700
|
index,
|
|
4575
4701
|
isSelected
|
|
4576
4702
|
}) => {
|
|
@@ -5567,6 +5693,7 @@ function OsProgress({
|
|
|
5567
5693
|
error: "red",
|
|
5568
5694
|
done: "green",
|
|
5569
5695
|
skipped: "yellow"
|
|
5696
|
+
// Not used actually, just for type matching
|
|
5570
5697
|
};
|
|
5571
5698
|
const text = progress.message + (progress.state === "progress" ? "..." : "");
|
|
5572
5699
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
@@ -5689,7 +5816,7 @@ async function waitUntilFinished({
|
|
|
5689
5816
|
userId
|
|
5690
5817
|
}) {
|
|
5691
5818
|
const docPath = `users/${userId}/applications/${appId}/builds/${buildId}`;
|
|
5692
|
-
return new Promise((
|
|
5819
|
+
return new Promise((resolve5, reject) => {
|
|
5693
5820
|
const unsubscribe = (0, import_firestore27.onSnapshot)(
|
|
5694
5821
|
(0, import_firestore27.doc)(firestore_default, docPath),
|
|
5695
5822
|
(snapshot) => {
|
|
@@ -5698,7 +5825,7 @@ async function waitUntilFinished({
|
|
|
5698
5825
|
onProgress(progress);
|
|
5699
5826
|
if (progress.isFinished) {
|
|
5700
5827
|
unsubscribe();
|
|
5701
|
-
|
|
5828
|
+
resolve5(progress);
|
|
5702
5829
|
}
|
|
5703
5830
|
},
|
|
5704
5831
|
(err) => {
|
|
@@ -5817,6 +5944,7 @@ async function smokeTestWorkflow({
|
|
|
5817
5944
|
const stateMap = {
|
|
5818
5945
|
done: "complete",
|
|
5819
5946
|
progress: "complete",
|
|
5947
|
+
// Not actually used, just for TS
|
|
5820
5948
|
error: "progress-error",
|
|
5821
5949
|
canceled: "canceled"
|
|
5822
5950
|
};
|
|
@@ -5897,7 +6025,7 @@ var package_default = {
|
|
|
5897
6025
|
access: "public"
|
|
5898
6026
|
},
|
|
5899
6027
|
name: "@todesktop/cli",
|
|
5900
|
-
version: "1.
|
|
6028
|
+
version: "1.15.0",
|
|
5901
6029
|
license: "MIT",
|
|
5902
6030
|
author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
|
|
5903
6031
|
homepage: "https://todesktop.com/cli",
|
|
@@ -5907,6 +6035,7 @@ var package_default = {
|
|
|
5907
6035
|
bin: {
|
|
5908
6036
|
todesktop: "./dist/cli.js"
|
|
5909
6037
|
},
|
|
6038
|
+
types: "./dist/types.d.ts",
|
|
5910
6039
|
engines: {
|
|
5911
6040
|
node: ">=16"
|
|
5912
6041
|
},
|
|
@@ -5914,14 +6043,15 @@ var package_default = {
|
|
|
5914
6043
|
dev: "cp-cli dev.env .env && npm run build:dev && npm link",
|
|
5915
6044
|
"dev:prod": "cp-cli prod.env .env && npm run build && npm link",
|
|
5916
6045
|
"dev:local:prod": "cp-cli prod-local.env .env && npm run build && npm link && cp-cli prod-local.env .env",
|
|
5917
|
-
build: "esbuild src/index.ts --packages=external --bundle --sourcemap --platform=node --outfile=dist/cli.js && cp-cli prod.env .env",
|
|
5918
|
-
"build:dev": "esbuild src/index.ts --packages=external --bundle --sourcemap --platform=node --outfile=dist/cli.js && cp-cli dev.env .env",
|
|
6046
|
+
build: "npm run types:generate && esbuild src/index.ts --packages=external --bundle --sourcemap --platform=node --outfile=dist/cli.js && cp-cli prod.env .env",
|
|
6047
|
+
"build:dev": "npm run types:generate && esbuild src/index.ts --packages=external --bundle --sourcemap --platform=node --outfile=dist/cli.js && cp-cli dev.env .env",
|
|
5919
6048
|
lint: "npm run lint:types && npm run lint:styles",
|
|
5920
6049
|
"lint:styles": "eslint src test .eslintrc.js && prettier --check .",
|
|
5921
6050
|
format: "prettier --write .",
|
|
5922
6051
|
"lint:types": "tsc && tsc-strict",
|
|
5923
6052
|
"lint--fix": "eslint src test --fix",
|
|
5924
6053
|
"docs:generate": "node scripts/generate-readme.js",
|
|
6054
|
+
"types:generate": "node scripts/generate-types.js",
|
|
5925
6055
|
release: "npm run docs:generate && npm run build && npx np --tag=latest",
|
|
5926
6056
|
"release-beta": "npm run docs:generate && npm run build && npx np --any-branch --no-tests --tag=beta",
|
|
5927
6057
|
test: "ava",
|
|
@@ -6005,6 +6135,7 @@ var package_default = {
|
|
|
6005
6135
|
"fs-extra": "^9.0.1",
|
|
6006
6136
|
husky: "^4.3.0",
|
|
6007
6137
|
"ink-testing-library": "^2.1.0",
|
|
6138
|
+
"json-schema-to-typescript": "^15.0.4",
|
|
6008
6139
|
"lint-staged": "^10.2.11",
|
|
6009
6140
|
"package-json-type": "^1.0.3",
|
|
6010
6141
|
prettier: "^2.8.1",
|