Skip to content

Commit

Permalink
Remove unused dependencies. (#170)
Browse files Browse the repository at this point in the history
* Local todesktop publish.

* Remove unused packages: ws and update-electron.

* update yarn lock.

* update.

* test
  • Loading branch information
robinjhuang authored Nov 3, 2024
1 parent 9553e41 commit 6fc7a56
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 82 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"test:update-snapshots": "npx playwright test --update-snapshots",
"todesktop:afterPack": "./scripts/todesktop/afterPack.js",
"todesktop:beforeInstall": "./scripts/todesktop/beforeInstall.js",
"todesktop:postInstall": "./scripts/todesktop/postInstall.js",
"typescript": "yarn run tsc",
"vite:compile": "vite build --config vite.renderer.config.ts && vite build --config vite.main.config.ts && vite build --config vite.preload.config.ts"
},
Expand All @@ -54,7 +55,6 @@
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/tar": "6.1.13",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"electron": "31.3.1",
Expand Down Expand Up @@ -90,8 +90,6 @@
"react-dom": "^18.3.1",
"systeminformation": "^5.23.5",
"tar": "^7.4.3",
"update-electron-app": "^3.0.0",
"ws": "^8.18.0",
"yaml": "^2.6.0"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/preMake.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ module.exports = async ({ appOutDir, packager, outDir }) => {

}
console.log(">PREMAKE FINISH<");
}
}
2 changes: 1 addition & 1 deletion scripts/todesktop/afterPack.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ module.exports = async ({ appOutDir, packager, outDir }) => {
const resourcePath = path.join(path.dirname(appPath), "resources");
await fs.cp(assetPath, resourcePath, { recursive: true });
}
}
}
2 changes: 1 addition & 1 deletion scripts/todesktop/postInstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ async function postInstall() {
}
};

postInstall();
postInstall();
8 changes: 0 additions & 8 deletions src/__tests__/unit/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ jest.mock('electron-log/main', () => ({
// Add other methods you might use from electron-log
}));

// Mock the update-electron-app module
jest.mock('update-electron-app', () => ({
updateElectronApp: jest.fn(),
UpdateSourceType: {
StaticStorage: 'StaticStorage',
},
}));

describe('createWindow', () => {
// it('should create a new BrowserWindow with correct options', async () => {
// const window = await createWindow('/');
Expand Down
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Store from 'electron-store';
import * as net from 'net';
import { graphics } from 'systeminformation';
import { createModelConfigFiles, readBasePathFromConfig } from './config/extra_model_config';
import { WebSocketServer } from 'ws';
import { StoreType } from './store';
import todesktop from '@todesktop/runtime';
import { PythonEnvironment } from './pythonEnvironment';
Expand All @@ -31,7 +30,6 @@ let isRestarting: boolean = false; // Prevents double restarts TODO(robinhuang):
const host = '127.0.0.1';
let port = 8188;
let mainWindow: BrowserWindow | null = null;
let wss: WebSocketServer | null;
let store: Store<StoreType> | null = null;
const messageQueue: Array<any> = []; // Stores mesaages before renderer is ready.
let downloadManager: DownloadManager;
Expand Down
15 changes: 3 additions & 12 deletions todesktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@
"schemaVersion": 1,
"uploadSizeLimit": 250,
"appPath": ".",
"appFiles": ["src/**", "scripts/**", "assets/**", "dist/**", ".vite/**", ".yarnrc.yml", ".yarn/**"],
"extraResources": [{ "from": "./assets" }],
"filesForDistribution": ["!assets/**", "!dist/**", "!src/**", "!scripts/**", "!.yarn/**", "!.yarnrc.yml"],
"mac": {
"additionalBinariesToSign": [
"./assets/output/lib/libpython3.12.dylib",
"./assets/output/lib/python3.12/lib-dynload/_crypt.cpython-312-darwin.so",
"./assets/output/bin/uv",
"./assets/output/bin/uvx",
"./assets/output/bin/python3.12"
]
}
"appFiles": ["src/**", "scripts/**", "assets/UI/**", ".vite/**", ".yarnrc.yml", ".yarn/**"],
"extraResources": [{ "from": "./assets/UI" }],
"filesForDistribution": ["!assets/**", "!dist/**", "!src/**", "!scripts/**", "!.yarn/**", "!.yarnrc.yml"]
}
54 changes: 0 additions & 54 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3281,15 +3281,6 @@ __metadata:
languageName: node
linkType: hard

"@types/ws@npm:^8.5.12":
version: 8.5.12
resolution: "@types/ws@npm:8.5.12"
dependencies:
"@types/node": "npm:*"
checksum: 10c0/3fd77c9e4e05c24ce42bfc7647f7506b08c40a40fe2aea236ef6d4e96fc7cb4006a81ed1b28ec9c457e177a74a72924f4768b7b4652680b42dfd52bc380e15f9
languageName: node
linkType: hard

"@types/yargs-parser@npm:*":
version: 21.0.3
resolution: "@types/yargs-parser@npm:21.0.3"
Expand Down Expand Up @@ -4864,7 +4855,6 @@ __metadata:
"@types/react": "npm:^18.3.4"
"@types/react-dom": "npm:^18.3.0"
"@types/tar": "npm:6.1.13"
"@types/ws": "npm:^8.5.12"
"@typescript-eslint/eslint-plugin": "npm:^5.0.0"
"@typescript-eslint/parser": "npm:^5.0.0"
adm-zip: "npm:^0.5.15"
Expand All @@ -4888,9 +4878,7 @@ __metadata:
ts-jest: "npm:^29.2.5"
ts-node: "npm:^10.0.0"
typescript: "npm:~5.5.4"
update-electron-app: "npm:^3.0.0"
vite: "npm:^5.0.12"
ws: "npm:^8.18.0"
yaml: "npm:^2.6.0"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -6750,15 +6738,6 @@ __metadata:
languageName: node
linkType: hard

"github-url-to-object@npm:^4.0.4":
version: 4.0.6
resolution: "github-url-to-object@npm:4.0.6"
dependencies:
is-url: "npm:^1.1.0"
checksum: 10c0/b8ed9b2b93c55657299b7cc5ce9faf4441f143e59f995e126929d18f8fc692fc932d8530da9bde7655f35b29201beacbc17b066b7e26dbcc0dc983f8d3c918cf
languageName: node
linkType: hard

"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2":
version: 5.1.2
resolution: "glob-parent@npm:5.1.2"
Expand Down Expand Up @@ -7790,13 +7769,6 @@ __metadata:
languageName: node
linkType: hard

"is-url@npm:^1.1.0, is-url@npm:^1.2.4":
version: 1.2.4
resolution: "is-url@npm:1.2.4"
checksum: 10c0/0157a79874f8f95fdd63540e3f38c8583c2ef572661cd0693cda80ae3e42dfe8e9a4a972ec1b827f861d9a9acf75b37f7d58a37f94a8a053259642912c252bc3
languageName: node
linkType: hard

"is-weakref@npm:^1.0.2":
version: 1.0.2
resolution: "is-weakref@npm:1.0.2"
Expand Down Expand Up @@ -12212,17 +12184,6 @@ __metadata:
languageName: node
linkType: hard

"update-electron-app@npm:^3.0.0":
version: 3.0.0
resolution: "update-electron-app@npm:3.0.0"
dependencies:
github-url-to-object: "npm:^4.0.4"
is-url: "npm:^1.2.4"
ms: "npm:^2.1.1"
checksum: 10c0/5e0b9ce8fd2cbcf6ea64d8029f90d90394facf05d86c8dceda5dba79af6e21522ef4f37f212982be781f488d497882529d9b11b91174159f6567a24039c76e6a
languageName: node
linkType: hard

"uri-js@npm:^4.2.2":
version: 4.4.1
resolution: "uri-js@npm:4.4.1"
Expand Down Expand Up @@ -12577,21 +12538,6 @@ __metadata:
languageName: node
linkType: hard

"ws@npm:^8.18.0":
version: 8.18.0
resolution: "ws@npm:8.18.0"
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ">=5.0.2"
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
checksum: 10c0/25eb33aff17edcb90721ed6b0eb250976328533ad3cd1a28a274bd263682e7296a6591ff1436d6cbc50fa67463158b062f9d1122013b361cec99a05f84680e06
languageName: node
linkType: hard

"xcode@npm:3.0.1":
version: 3.0.1
resolution: "xcode@npm:3.0.1"
Expand Down

0 comments on commit 6fc7a56

Please sign in to comment.