Skip to content

Commit

Permalink
chore: reduce bundle size (janhq#1970)
Browse files Browse the repository at this point in the history
* chore: reduce bundle size

* chore: trimming langchainjs

* chore: trim pdf-parse
  • Loading branch information
louis-jan authored Feb 9, 2024
1 parent bb11bc2 commit eb09399
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 32 deletions.
9 changes: 4 additions & 5 deletions electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"productName": "Jan",
"files": [
"renderer/**/*",
"build/*.{js,map}",
"build/**/*.{js,map}",
"pre-install",
"models/**/*",
Expand Down Expand Up @@ -77,7 +76,6 @@
"@janhq/core": "link:./core",
"@janhq/server": "link:./server",
"@npmcli/arborist": "^7.1.0",
"@types/request": "^2.48.12",
"@uiball/loaders": "^1.3.0",
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
Expand All @@ -86,8 +84,6 @@
"pacote": "^17.0.4",
"request": "^2.88.2",
"request-progress": "^3.0.0",
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"ulid": "^2.3.0",
"use-debounce": "^9.0.4"
},
Expand All @@ -96,14 +92,17 @@
"@playwright/test": "^1.38.1",
"@types/npmcli__arborist": "^5.6.4",
"@types/pacote": "^11.1.7",
"@types/request": "^2.48.12",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"electron": "28.0.0",
"electron-builder": "^24.9.1",
"electron-devtools-installer": "^3.2.0",
"electron-playwright-helpers": "^1.6.0",
"eslint-plugin-react": "^7.33.2",
"run-script-os": "^1.1.6"
"rimraf": "^5.0.5",
"run-script-os": "^1.1.6",
"typescript": "^5.2.2"
},
"installConfig": {
"hoistingLimits": "workspaces"
Expand Down
10 changes: 4 additions & 6 deletions extensions/assistant-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"author": "Jan <[email protected]>",
"license": "AGPL-3.0",
"scripts": {
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"clean:modules": "rimraf node_modules/pdf-parse/test && cd node_modules/pdf-parse/lib/pdf.js && rimraf v1.9.426 v1.10.88 v2.0.550",
"build": "yarn clean:modules && tsc --module commonjs && rollup -c rollup.config.ts",
"build:publish:linux": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install",
"build:publish:darwin": "rimraf *.tgz --glob && npm run build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install",
"build:publish:win32": "rimraf *.tgz --glob && npm run build && npm pack && cpx *.tgz ../../pre-install",
Expand All @@ -25,7 +26,7 @@
"rollup-plugin-define": "^1.0.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.36.0",
"typescript": "^5.3.3",
"typescript": "^5.2.2",
"run-script-os": "^1.1.6"
},
"dependencies": {
Expand All @@ -44,9 +45,6 @@
],
"bundleDependencies": [
"@janhq/core",
"@langchain/community",
"hnswlib-node",
"langchain",
"pdf-parse"
"hnswlib-node"
]
}
3 changes: 0 additions & 3 deletions extensions/assistant-extension/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export default [
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: [
"@janhq/core/node",
"@langchain/community",
"langchain",
"langsmith",
"path",
"hnswlib-node",
],
Expand Down
6 changes: 3 additions & 3 deletions extensions/conversational-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"cpx": "^1.5.0",
"rimraf": "^3.0.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"ts-loader": "^9.5.0"
},
"dependencies": {
"@janhq/core": "file:../../core",
"path-browserify": "^1.0.1",
"ts-loader": "^9.5.0"
"path-browserify": "^1.0.1"
},
"engines": {
"node": ">=18.0.0"
Expand Down
6 changes: 3 additions & 3 deletions extensions/inference-nitro-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.36.0",
"run-script-os": "^1.1.6",
"typescript": "^5.2.2"
"typescript": "^5.2.2",
"@types/os-utils": "^0.0.4",
"@rollup/plugin-replace": "^5.0.5"
},
"dependencies": {
"@janhq/core": "file:../../core",
"@rollup/plugin-replace": "^5.0.5",
"@types/os-utils": "^0.0.4",
"fetch-retry": "^5.0.6",
"path-browserify": "^1.0.1",
"rxjs": "^7.8.1",
Expand Down
4 changes: 2 additions & 2 deletions extensions/inference-openai-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"cpx": "^1.5.0",
"rimraf": "^3.0.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"ts-loader": "^9.5.0"
},
"dependencies": {
"@janhq/core": "file:../../core",
"fetch-retry": "^5.0.6",
"path-browserify": "^1.0.1",
"ts-loader": "^9.5.0",
"ulid": "^2.3.0"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions extensions/inference-triton-trtllm-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
"cpx": "^1.5.0",
"rimraf": "^3.0.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"ts-loader": "^9.5.0"
},
"dependencies": {
"@janhq/core": "file:../../core",
"fetch-retry": "^5.0.6",
"path-browserify": "^1.0.1",
"ts-loader": "^9.5.0",
"ulid": "^2.3.0",
"rxjs": "^7.8.1"
},
Expand Down
6 changes: 3 additions & 3 deletions extensions/model-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"cpx": "^1.5.0",
"rimraf": "^3.0.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"ts-loader": "^9.5.0"
},
"files": [
"dist/*",
Expand All @@ -23,7 +24,6 @@
],
"dependencies": {
"@janhq/core": "file:../../core",
"path-browserify": "^1.0.1",
"ts-loader": "^9.5.0"
"path-browserify": "^1.0.1"
}
}
6 changes: 3 additions & 3 deletions extensions/monitoring-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"devDependencies": {
"rimraf": "^3.0.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"ts-loader": "^9.5.0"
},
"dependencies": {
"@janhq/core": "file:../../core",
"node-os-utils": "^1.3.7",
"ts-loader": "^9.5.0"
"node-os-utils": "^1.3.7"
},
"files": [
"dist/*",
Expand Down
Binary file modified models/mistral-ins-7b-q4/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified models/openhermes-neural-7b/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified models/trinity-v1.2-7b/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions web/screens/ExploreModels/ExploreModelList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ExploreModelList: React.FC<Props> = ({ models }) => {
const takenModelIds: string[] = []
const featuredModels = models
.filter((m) => {
if (m.metadata.tags.includes('Featured')) {
if (m.metadata?.tags?.includes('Featured')) {
takenModelIds.push(m.id)
return m
}
Expand All @@ -19,7 +19,7 @@ const ExploreModelList: React.FC<Props> = ({ models }) => {

const recommendedModels = models
.filter((m) => {
if (m.metadata.tags.includes('Recommended')) {
if (m.metadata?.tags?.includes('Recommended')) {
takenModelIds.push(m.id)
return m
}
Expand Down

0 comments on commit eb09399

Please sign in to comment.