Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Preempt

Manav Rathi51ffaa4a9045
diff --git a/desktop/docs/dependencies.md b/desktop/docs/dependencies.md
index 5c6b222b08..6052357033 100644
--- a/desktop/docs/dependencies.md
+++ b/desktop/docs/dependencies.md
@@ -90,6 +90,9 @@ Some extra ones specific to the code here are:
Unix commands in our `package.json` scripts. This allows us to use the same
commands (like `ln`) across different platforms like Linux and Windows.
+- [@tsconfig/recommended](https://github.com/tsconfig/bases) gives us a base
+ tsconfig for the Node.js version that our current Electron version uses.
+
## Functionality
### Format conversion
diff --git a/desktop/package.json b/desktop/package.json
index 69d54f75be..509ee85838 100644
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -34,6 +34,7 @@
"onnxruntime-node": "^1.17"
},
"devDependencies": {
+ "@tsconfig/node20": "^20.1.4",
"@types/auto-launch": "^5.0",
"@types/ffmpeg-static": "^3.0",
"@typescript-eslint/eslint-plugin": "^7",
diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.ts
index 7b773baed3..15715c5500 100644
--- a/desktop/src/main/stream.ts
+++ b/desktop/src/main/stream.ts
@@ -6,6 +6,7 @@ import StreamZip from "node-stream-zip";
import { createWriteStream, existsSync } from "node:fs";
import fs from "node:fs/promises";
import { Readable } from "node:stream";
+import { ReadableStream } from "node:stream/web";
import { pathToFileURL } from "node:url";
import log from "./log";
import { ensure } from "./utils/common";
diff --git a/desktop/tsconfig.json b/desktop/tsconfig.json
index 654158a50d..7806cd93a7 100644
--- a/desktop/tsconfig.json
+++ b/desktop/tsconfig.json
@@ -3,52 +3,20 @@
into JavaScript that'll then be loaded and run by the main (node) process
of our Electron app. */
- /* TSConfig docs: https://aka.ms/tsconfig.json */
+ /*
+ * Recommended target, lib and other settings for code running in the
+ * version of Node.js bundled with Electron.
+ *
+ * Currently, with Electron 30, this is Node.js 20.11.1.
+ * https://www.electronjs.org/blog/electron-30-0
+ */
+ "extends": "@tsconfig/node20/tsconfig.json",
+ /* TSConfig docs: https://aka.ms/tsconfig.json */
"compilerOptions": {
- /* Recommended target, lib and other settings for code running in the
- version of Node.js bundled with Electron.
-
- Currently, with Electron 29, this is Node.js 20.9
- https://www.electronjs.org/blog/electron-29-0
-
- Note that we cannot do
-
- "extends": "@tsconfig/node20/tsconfig.json",
-
- because that sets "lib": ["es2023"]. However (and I don't fully
- understand what's going on here), that breaks our compilation since
- tsc can then not find type definitions of things like ReadableStream.
-
- Adding "dom" to "lib" (e.g. `"lib": ["es2023", "dom"]`) fixes the
- issue, but that doesn't sound correct - the main Electron process
- isn't running in a browser context.
-
- It is possible that we're using some of the types incorrectly. For
- now, we just omit the "lib" definition and rely on the defaults for
- the "target" we've chosen. This is also what the current
- electron-forge starter does:
-
- yarn create electron-app electron-forge-starter -- --template=webpack-typescript
-
- Enhancement: Can revisit this later.
-
- Refs:
- - https://github.com/electron/electron/issues/27092
- - https://github.com/electron/electron/issues/16146
- */
-
- "target": "es2022",
- "module": "node16",
-
/* Emit the generated JS into `app/` */
"outDir": "app",
- /* Enable various workarounds to play better with CJS libraries */
- "esModuleInterop": true,
- /* Speed things up by not type checking `node_modules` */
- "skipLibCheck": true,
-
/* Require the `type` modifier when importing types */
/* We want this, but it causes "ESM syntax is not allowed in a CommonJS
module when 'verbatimModuleSyntax' is enabled" currently */
diff --git a/desktop/yarn.lock b/desktop/yarn.lock
index a5b86f1eb3..bf9057d472 100644
--- a/desktop/yarn.lock
+++ b/desktop/yarn.lock
@@ -246,6 +246,11 @@
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==
+"@tsconfig/node20@^20.1.4":
+ version "20.1.4"
+ resolved "https://registry.yarnpkg.com/@tsconfig/node20/-/node20-20.1.4.tgz#3457d42eddf12d3bde3976186ab0cd22b85df928"
+ integrity sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==
+
"@types/auto-launch@^5.0":
version "5.0.5"
resolved "https://registry.yarnpkg.com/@types/auto-launch/-/auto-launch-5.0.5.tgz#439ed36aaaea501e2e2cfbddd8a20c366c34863b"