Skip to content

Commit

Permalink
Upgrade deps (#1213)
Browse files Browse the repository at this point in the history
* refactor dependencies

* upgrade forge

* refresh yarn.lock

* fix test
  • Loading branch information
an-lee authored Nov 28, 2024
1 parent f0e7fd7 commit 5ab0ecf
Show file tree
Hide file tree
Showing 10 changed files with 607 additions and 649 deletions.
2 changes: 1 addition & 1 deletion 1000-hours/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"markdown-it-mathjax3": "^4.3.2",
"markdown-it-sub": "^2.0.0",
"markdown-it-sup": "^2.0.0",
"mermaid": "^11.4.0",
"mermaid": "^11.4.1",
"sass": "^1.81.0",
"vitepress": "^1.5.0",
"vitepress-plugin-mermaid": "^2.0.17",
Expand Down
37 changes: 23 additions & 14 deletions enjoy/forge.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { VitePlugin } from "@electron-forge/plugin-vite";
import os from "os";
// import { FusesPlugin } from "@electron-forge/plugin-fuses";
// import { FuseV1Options, FuseVersion } from "@electron/fuses";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { FuseV1Options, FuseVersion } from "@electron/fuses";
import { DependenciesPlugin } from "electron-forge-plugin-dependencies";
import pkg from "./package.json" assert { type: "json" };

const config = {
packagerConfig: {
asar: {
// Binary files won't work in asar, so we need to unpack them
unpackDir:
"{.vite/build/lib,.vite/build/samples,node_modules/ffmpeg-static,node_modules/@andrkrn/ffprobe-static,node_modules/onnxruntime-node/bin,lib/dictionaries}",
unpackDir: `{.vite/build/lib,.vite/build/samples,node_modules/ffmpeg-static,node_modules/@andrkrn/ffprobe-static,node_modules/onnxruntime-node/bin/napi-v3/${os.platform()}/${os.arch()},lib/dictionaries}`,
},
icon: "./assets/icon",
name: "Enjoy",
Expand All @@ -30,7 +31,7 @@ const config = {
},
{
name: "@electron-forge/maker-zip",
platforms: ["darwin"],
platforms: ["darwin", "linux"],
config: (arch) => ({
macUpdateManifestBaseUrl: `https://dl.enjoy.bot/app/darwin/${arch}`,
}),
Expand Down Expand Up @@ -71,10 +72,12 @@ const config = {
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
entry: "src/main.ts",
config: "vite.main.config.ts",
target: "main",
},
{
entry: "src/preload.ts",
config: "vite.preload.config.ts",
target: "preload",
},
],
renderer: [
Expand All @@ -90,15 +93,21 @@ const config = {
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
// new FusesPlugin({
// version: FuseVersion.V1,
// [FuseV1Options.RunAsNode]: false,
// [FuseV1Options.EnableCookieEncryption]: true,
// [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
// [FuseV1Options.EnableNodeCliInspectArguments]: true,
// [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
// [FuseV1Options.OnlyLoadAppFromAsar]: false,
// }),
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: true,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: false,
}),
{
name: "electron-forge-plugin-dependencies",
config: {
dependencies: Object.keys(pkg.dependencies),
},
},
],
};

Expand Down
152 changes: 77 additions & 75 deletions enjoy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,73 +29,25 @@
},
"license": "MIT",
"devDependencies": {
"@electron-forge/cli": "<7.5.0",
"@electron-forge/maker-deb": "<7.5.0",
"@electron-forge/maker-dmg": "<7.5.0",
"@electron-forge/maker-rpm": "<7.5.0",
"@electron-forge/maker-squirrel": "<7.5.0",
"@electron-forge/maker-zip": "<7.5.0",
"@electron-forge/plugin-auto-unpack-natives": "<7.5.0",
"@electron-forge/plugin-fuses": "<7.5.0",
"@electron-forge/plugin-vite": "<7.5.0",
"@electron-forge/publisher-github": "<7.5.0",
"@electron/fuses": "^1.8.0",
"@playwright/test": "^1.49.0",
"@tailwindcss/typography": "^0.5.15",
"@types/ahoy.js": "^0.4.2",
"@types/autosize": "^4.0.3",
"@types/command-exists": "^1.2.3",
"@types/electron-squirrel-startup": "^1.0.2",
"@types/fluent-ffmpeg": "^2.1.27",
"@types/html-to-text": "^9.0.4",
"@types/intl-tel-input": "^18.1.4",
"@types/lodash": "^4.17.13",
"@types/mark.js": "^8.11.12",
"@types/mime-types": "^2.1.4",
"@types/mustache": "^4.2.5",
"@types/node": "^22.10.0",
"@types/prop-types": "^15.7.13",
"@types/rails__actioncable": "^6.1.11",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/semver": "^7.5.8",
"@types/unzipper": "^0.10.10",
"@types/validator": "^13.12.2",
"@types/wavesurfer.js": "^6.0.12",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"electron": "^33.2.0",
"electron-devtools-installer": "^3.2.0",
"electron-playwright-helpers": "^1.7.1",
"eslint": "^9.15.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"flora-colossus": "^2.0.0",
"octokit": "^4.0.2",
"progress": "^2.0.3",
"prop-types": "^15.8.1",
"tailwind-merge": "^2.5.5",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.15",
"tailwindcss-animate": "^1.0.7",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"vite": "^6.0.0",
"vite-plugin-static-copy": "^2.1.0",
"zx": "^8.2.2"
},
"dependencies": {
"@andrkrn/ffprobe-static": "^5.2.0",
"@divisey/js-mdict": "^5.0.0",
"@electron-forge/publisher-s3": "^7.5.0",
"@electron-forge/cli": "^7.6.0",
"@electron-forge/maker-deb": "^7.6.0",
"@electron-forge/maker-dmg": "^7.6.0",
"@electron-forge/maker-rpm": "^7.6.0",
"@electron-forge/maker-squirrel": "^7.6.0",
"@electron-forge/maker-zip": "^7.6.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.6.0",
"@electron-forge/plugin-fuses": "^7.6.0",
"@electron-forge/plugin-vite": "7.6.0",
"@electron-forge/publisher-github": "^7.6.0",
"@electron-forge/publisher-s3": "^7.6.0",
"@electron/fuses": "^1.8.0",
"@hookform/resolvers": "^3.9.1",
"@langchain/community": "^0.3.16",
"@langchain/core": "^0.3.19",
"@langchain/ollama": "^0.1.2",
"@mozilla/readability": "^0.5.0",
"@playwright/test": "^1.49.0",
"@radix-ui/react-accordion": "^1.2.1",
"@radix-ui/react-alert-dialog": "^1.1.2",
"@radix-ui/react-aspect-ratio": "^1.1.0",
Expand All @@ -121,10 +73,35 @@
"@radix-ui/react-toggle": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.4",
"@rails/actioncable": "8.0.0",
"@tailwindcss/typography": "^0.5.15",
"@types/ahoy.js": "^0.4.2",
"@types/autosize": "^4.0.3",
"@types/command-exists": "^1.2.3",
"@types/electron-squirrel-startup": "^1.0.2",
"@types/fluent-ffmpeg": "^2.1.27",
"@types/html-to-text": "^9.0.4",
"@types/intl-tel-input": "^18.1.4",
"@types/lodash": "^4.17.13",
"@types/mark.js": "^8.11.12",
"@types/mime-types": "^2.1.4",
"@types/mustache": "^4.2.5",
"@types/node": "^22.10.0",
"@types/prop-types": "^15.7.13",
"@types/rails__actioncable": "^6.1.11",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/semver": "^7.5.8",
"@types/turndown": "^5.0.5",
"@types/unzipper": "^0.10.10",
"@types/validator": "^13.12.2",
"@types/wavesurfer.js": "^6.0.12",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@uidotdev/usehooks": "^2.4.1",
"@vidstack/react": "^1.12.12",
"@vitejs/plugin-react": "^4.3.4",
"ahoy.js": "^0.4.4",
"autoprefixer": "^10.4.20",
"autosize": "^6.0.1",
"axios": "^1.7.8",
"camelcase": "^8.0.0",
Expand All @@ -141,17 +118,20 @@
"dayjs": "^1.11.13",
"decamelize": "^6.0.0",
"decamelize-keys": "^2.0.1",
"echogarden": "<2.0",
"dependencies-tree": "^2.0.0",
"electron": "^33.2.1",
"electron-context-menu": "^4.0.4",
"electron-devtools-installer": "^3.2.0",
"electron-forge-plugin-dependencies": "^1.0.0",
"electron-log": "^5.2.3",
"electron-settings": "^4.0.4",
"electron-playwright-helpers": "^1.7.1",
"electron-squirrel-startup": "^1.0.1",
"electron-unhandled": "^5.0.0",
"ffmpeg-static": "^5.2.0",
"file-type": "^19.6.0",
"fluent-ffmpeg": "^2.1.3",
"eslint": "^9.15.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"flora-colossus": "^2.0.0",
"foliate-js": "https://github.com/johnfactotum/foliate-js.git#commit=b5ae4c22c197ef70e12ead88277dde2856447634",
"fs-extra": "^11.2.0",
"html-to-text": "^9.0.5",
"https-proxy-agent": "^7.0.5",
"i18next": "^24.0.2",
Expand All @@ -161,17 +141,20 @@
"langchain": "^0.3.6",
"lodash": "^4.17.21",
"lru-cache": "^11.0.2",
"lucide-react": "^0.461.0",
"lucide-react": "^0.462.0",
"mark.js": "^8.11.1",
"media-captions": "^0.0.18",
"microsoft-cognitiveservices-speech-sdk": "^1.41.0",
"mime-types": "^2.1.35",
"mustache": "^4.2.0",
"new-github-issue-url": "^1.0.0",
"next-themes": "^0.4.3",
"octokit": "^4.0.2",
"openai": "^4.73.1",
"pitchfinder": "^2.3.2",
"postcss": "^8.4.49",
"progress": "^2.0.3",
"prop-types": "^15.8.1",
"proxy-agent": "^6.4.0",
"react": "^18.3.1",
"react-activity-calendar": "^2.7.1",
Expand All @@ -187,21 +170,40 @@
"react-router-dom": "^7.0.1",
"react-shadow-root": "^6.2.0",
"react-tooltip": "^5.28.0",
"reflect-metadata": "^0.2.2",
"remark-gfm": "^4.0.0",
"rimraf": "^6.0.1",
"semver": "^7.6.3",
"sequelize": "^6.37.5",
"sequelize-typescript": "^2.1.6",
"sonner": "^1.7.0",
"sqlite3": "^5.1.7",
"tailwind-merge": "^2.5.5",
"tailwind-scrollbar": "^3.1.0",
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss": "^3.4.15",
"tailwindcss-animate": "^1.0.7",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"turndown": "^7.2.0",
"umzug": "^3.8.2",
"unzipper": "^0.12.3",
"typescript": "^5.7.2",
"update-electron-app": "^3.0.0",
"vite": "^6.0.1",
"vite-plugin-static-copy": "^2.2.0",
"wavesurfer.js": "^7.8.9",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.5"
"zod-to-json-schema": "^3.23.5",
"zx": "^8.2.2"
},
"dependencies": {
"@andrkrn/ffprobe-static": "^5.2.0",
"echogarden": "^1.8.7",
"electron-settings": "^4.0.4",
"ffmpeg-static": "^5.2.0",
"file-type": "^19.6.0",
"fluent-ffmpeg": "^2.1.3",
"fs-extra": "^11.2.0",
"reflect-metadata": "^0.2.2",
"sequelize": "^6.37.5",
"sequelize-typescript": "^2.1.6",
"sqlite3": "^5.1.7",
"umzug": "^3.8.2",
"unzipper": "^0.12.3"
}
}
6 changes: 1 addition & 5 deletions enjoy/src/main/camdict.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { ipcMain } from "electron";
import path from "path";
import log from "@main/logger";
import url from "url";
import { Sequelize, DataType } from "sequelize-typescript";

const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path
.dirname(__filename)
.replace("app.asar", "app.asar.unpacked");
const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked");

const logger = log.scope("camdict");

Expand Down
4 changes: 1 addition & 3 deletions enjoy/src/main/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ import {
} from "./handlers";
import os from "os";
import path from "path";
import url from "url";
import { i18n } from "@main/i18n";
import { UserSettingKeyEnum } from "@/types/enums";
import log from "@main/logger";
import fs from "fs-extra";

const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const __dirname = import.meta.dirname;
const logger = log.scope("DB");

const db = {
Expand Down
5 changes: 1 addition & 4 deletions enjoy/src/main/echogarden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ Echogarden.setGlobalOption(
"https://hf-mirror.com/echogarden/echogarden-packages/resolve/main/"
);

const __filename = url.fileURLToPath(import.meta.url);
/*
* sample files will be in /app.asar.unpacked instead of /app.asar
*/
const __dirname = path
.dirname(__filename)
.replace("app.asar", "app.asar.unpacked");
const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked");

const logger = log.scope("echogarden");
class EchogardenWrapper {
Expand Down
5 changes: 1 addition & 4 deletions enjoy/src/main/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import { enjoyUrlToPath, pathToEnjoyUrl } from "@main/utils";
*/
Ffmpeg.setFfmpegPath(ffmpegPath.replace("app.asar", "app.asar.unpacked"));
Ffmpeg.setFfprobePath(ffprobePath.replace("app.asar", "app.asar.unpacked"));
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path
.dirname(__filename)
.replace("app.asar", "app.asar.unpacked");
const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked");

const logger = log.scope("ffmpeg");
export default class FfmpegWrapper {
Expand Down
5 changes: 1 addition & 4 deletions enjoy/src/main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ import { REPO_URL, WS_URL } from "@/constants";
import { AudibleProvider, TedProvider, YoutubeProvider } from "@main/providers";
import Ffmpeg from "@main/ffmpeg";
import { Waveform } from "./waveform";
import url from "url";
import echogarden from "./echogarden";
import camdict from "./camdict";
import dict from "./dict";
import mdict from "./mdict";
import decompresser from "./decompresser";
import { UserSetting } from "@main/db/models";
import { platform } from "os";
import { t } from "i18next";

const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const __dirname = import.meta.dirname;

const logger = log.scope("window");

Expand Down
7 changes: 1 addition & 6 deletions enjoy/src/main/youtubedr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ import os from "os";
import log from "@main/logger";
import snakeCase from "lodash/snakeCase";
import settings from "@main/settings";
import url from "url";
import mainWin from "@main/window";

const __filename = url.fileURLToPath(import.meta.url);

// youtubedr bin file will be in /app.asar.unpacked instead of /app.asar
const __dirname = path
.dirname(__filename)
.replace("app.asar", "app.asar.unpacked");
const __dirname = import.meta.dirname.replace("app.asar", "app.asar.unpacked");

const logger = log.scope("YOUTUBEDR");

Expand Down
Loading

0 comments on commit 5ab0ecf

Please sign in to comment.