fix: update deps and reduce app.asar bundle size (#83)
* chore: update deps Signed-off-by: Innei <i@innei.in> * chore: disable preferESM * fix: update builder Signed-off-by: Innei <i@innei.in> * fix: optimize bundle size Signed-off-by: Innei <i@innei.in> * fix: hash router Signed-off-by: Innei <i@innei.in> --------- Signed-off-by: Innei <i@innei.in> Co-authored-by: Stephen Zhou <hi@hyoban.cc>
This commit is contained in:
parent
f3418dc9e3
commit
dc2796463e
|
|
@ -3,12 +3,27 @@ productName: follow
|
|||
directories:
|
||||
buildResources: build
|
||||
files:
|
||||
- "!**/.vscode/*"
|
||||
- "!src/*"
|
||||
- "!electron.vite.config.{js,ts,mjs,cjs}"
|
||||
- "!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}"
|
||||
- "!{.env,.env.*,.npmrc,pnpm-lock.yaml}"
|
||||
- "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}"
|
||||
# - "**/*"
|
||||
# - "!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}"
|
||||
# - "!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}"
|
||||
# - "!**/node_modules/*.d.ts"
|
||||
# - "!**/node_modules/.bin"
|
||||
# - "!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}"
|
||||
# - "!.editorconfig"
|
||||
# - "!**/._*"
|
||||
# - "!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}"
|
||||
# - "!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}"
|
||||
# - "!**/{appveyor.yml,.travis.yml,circle.yml}"
|
||||
# - "!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
|
||||
# - "!**/.vscode/*"
|
||||
# - "!src/*"
|
||||
# - "!electron.vite.config.{js,ts,mjs,cjs}"
|
||||
# - "!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}"
|
||||
# - "!{.env,.env.*,.npmrc,pnpm-lock.yaml}"
|
||||
# - "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}"
|
||||
- "out"
|
||||
- "resources"
|
||||
- "!node_modules"
|
||||
asarUnpack:
|
||||
- resources/**
|
||||
win:
|
||||
|
|
|
|||
|
|
@ -2,22 +2,19 @@ import fs from "node:fs"
|
|||
import { resolve } from "node:path"
|
||||
|
||||
import react from "@vitejs/plugin-react"
|
||||
import { defineConfig, externalizeDepsPlugin } from "electron-vite"
|
||||
import { defineConfig } from "electron-vite"
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"))
|
||||
|
||||
export default defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@shared": resolve("src/shared/src"),
|
||||
},
|
||||
},
|
||||
},
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
},
|
||||
preload: {},
|
||||
renderer: {
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export default defineConfig(
|
|||
},
|
||||
lessOpinionated: true,
|
||||
ignores: ["src/renderer/src/hono.ts"],
|
||||
preferESM: false,
|
||||
},
|
||||
{
|
||||
settings: {
|
||||
|
|
@ -21,5 +22,8 @@ export default defineConfig(
|
|||
],
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"unicorn/prefer-module": "off",
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
|||
89
package.json
89
package.json
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "follow",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"packageManager": "pnpm@9.1.4",
|
||||
"description": "An Electron application with React and TypeScript",
|
||||
|
|
@ -29,28 +30,28 @@
|
|||
"@electron-toolkit/utils": "^3.0.0",
|
||||
"@fontsource/sn-pro": "5.0.1",
|
||||
"@hono/auth-js": "1.0.8",
|
||||
"@hookform/resolvers": "3.4.2",
|
||||
"@hookform/resolvers": "3.6.0",
|
||||
"@iconify/tools": "4.0.4",
|
||||
"@radix-ui/react-alert-dialog": "1.0.5",
|
||||
"@radix-ui/react-avatar": "1.0.4",
|
||||
"@radix-ui/react-checkbox": "1.0.4",
|
||||
"@radix-ui/react-collapsible": "1.0.3",
|
||||
"@radix-ui/react-context-menu": "2.2.0",
|
||||
"@radix-ui/react-dialog": "1.0.5",
|
||||
"@radix-ui/react-dropdown-menu": "2.1.0",
|
||||
"@radix-ui/react-label": "2.0.2",
|
||||
"@radix-ui/react-navigation-menu": "1.1.4",
|
||||
"@radix-ui/react-popover": "1.0.7",
|
||||
"@radix-ui/react-radio-group": "1.1.3",
|
||||
"@radix-ui/react-select": "2.0.0",
|
||||
"@radix-ui/react-slot": "1.0.2",
|
||||
"@radix-ui/react-switch": "1.0.3",
|
||||
"@radix-ui/react-tabs": "1.0.4",
|
||||
"@radix-ui/react-toast": "1.1.5",
|
||||
"@radix-ui/react-tooltip": "1.0.7",
|
||||
"@tanstack/query-sync-storage-persister": "5.40.0",
|
||||
"@tanstack/react-query": "5.40.0",
|
||||
"@tanstack/react-query-persist-client": "5.40.0",
|
||||
"@radix-ui/react-alert-dialog": "1.1.1",
|
||||
"@radix-ui/react-avatar": "1.1.0",
|
||||
"@radix-ui/react-checkbox": "1.1.0",
|
||||
"@radix-ui/react-collapsible": "1.1.0",
|
||||
"@radix-ui/react-context-menu": "2.2.1",
|
||||
"@radix-ui/react-dialog": "1.1.1",
|
||||
"@radix-ui/react-dropdown-menu": "2.1.1",
|
||||
"@radix-ui/react-label": "2.1.0",
|
||||
"@radix-ui/react-navigation-menu": "1.2.0",
|
||||
"@radix-ui/react-popover": "1.1.1",
|
||||
"@radix-ui/react-radio-group": "1.2.0",
|
||||
"@radix-ui/react-select": "2.1.1",
|
||||
"@radix-ui/react-slot": "1.1.0",
|
||||
"@radix-ui/react-switch": "1.1.0",
|
||||
"@radix-ui/react-tabs": "1.1.0",
|
||||
"@radix-ui/react-toast": "1.2.1",
|
||||
"@radix-ui/react-tooltip": "1.1.1",
|
||||
"@tanstack/query-sync-storage-persister": "5.45.0",
|
||||
"@tanstack/react-query": "5.45.1",
|
||||
"@tanstack/react-query-persist-client": "5.45.1",
|
||||
"@use-gesture/react": "10.3.1",
|
||||
"class-variance-authority": "0.7.0",
|
||||
"click-to-react-component": "1.1.0",
|
||||
|
|
@ -58,26 +59,26 @@
|
|||
"cmdk": "1.0.0",
|
||||
"dayjs": "1.11.11",
|
||||
"dotenv": "16.4.5",
|
||||
"electron-store": "8.2.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
"electron-updater": "^6.2.1",
|
||||
"foxact": "0.2.35",
|
||||
"framer-motion": "11.2.9",
|
||||
"framer-motion": "11.2.11",
|
||||
"franc-min": "6.2.0",
|
||||
"fuse.js": "7.0.0",
|
||||
"hast-util-to-jsx-runtime": "2.3.0",
|
||||
"idb-keyval": "6.2.1",
|
||||
"immer": "10.1.1",
|
||||
"jotai": "2.8.2",
|
||||
"jotai-dark": "0.3.2",
|
||||
"jotai": "2.8.3",
|
||||
"jotai-dark": "0.4.0",
|
||||
"jotai-effect": "1.0.0",
|
||||
"lethargy": "1.0.9",
|
||||
"lodash-es": "4.17.21",
|
||||
"lucide-react": "0.381.0",
|
||||
"lowdb": "7.0.1",
|
||||
"lucide-react": "0.396.0",
|
||||
"ofetch": "1.3.4",
|
||||
"react-helmet-async": "2.0.5",
|
||||
"react-hook-form": "7.51.5",
|
||||
"react-hook-form": "7.52.0",
|
||||
"react-hotkeys-hook": "4.5.0",
|
||||
"react-intersection-observer": "9.10.2",
|
||||
"react-intersection-observer": "9.10.3",
|
||||
"react-resizable-layout": "0.7.2",
|
||||
"react-router-dom": "6.23.1",
|
||||
"react-virtuoso": "4.7.11",
|
||||
|
|
@ -90,8 +91,8 @@
|
|||
"swiper": "11.1.4",
|
||||
"tailwind-merge": "2.3.0",
|
||||
"tailwindcss-animate": "1.0.7",
|
||||
"tldts": "6.1.23",
|
||||
"unified": "11.0.4",
|
||||
"tldts": "6.1.28",
|
||||
"unified": "11.0.5",
|
||||
"unist-util-visit": "5.0.0",
|
||||
"usehooks-ts": "3.1.0",
|
||||
"vfile": "6.0.1",
|
||||
|
|
@ -99,37 +100,39 @@
|
|||
"zustand": "4.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@egoist/tailwindcss-icons": "1.8.0",
|
||||
"@egoist/tailwindcss-icons": "1.8.1",
|
||||
"@electron-toolkit/tsconfig": "^1.0.1",
|
||||
"@iconify-json/mingcute": "1.1.17",
|
||||
"@iconify-json/mingcute": "1.1.18",
|
||||
"@tailwindcss/container-queries": "0.1.1",
|
||||
"@tailwindcss/typography": "0.5.13",
|
||||
"@types/lodash-es": "4.17.12",
|
||||
"@types/node": "^20.12.13",
|
||||
"@types/node": "^20.14.7",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.0",
|
||||
"electron": "^30.0.9",
|
||||
"@vercel/ncc": "0.38.1",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"electron": "^31.0.2",
|
||||
"electron-builder": "^24.9.1",
|
||||
"electron-devtools-installer": "3.2.0",
|
||||
"electron-vite": "^2.2.0",
|
||||
"eslint": "^9.3.0",
|
||||
"eslint": "^9.5.0",
|
||||
"eslint-config-hyoban": "3.0.0-beta.24",
|
||||
"lint-staged": "15.2.5",
|
||||
"hono": "4.4.7",
|
||||
"lint-staged": "15.2.7",
|
||||
"postcss": "8.4.38",
|
||||
"postcss-js": "4.0.1",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"simple-git-hooks": "2.11.1",
|
||||
"tailwindcss": "3.4.3",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.12",
|
||||
"tailwindcss": "3.4.4",
|
||||
"typescript": "^5.5.2",
|
||||
"vite": "^5.3.1",
|
||||
"vitest": "1.6.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
"hono@4.4.2": "patches/hono@4.4.2.patch",
|
||||
"sonner@1.5.0": "patches/sonner@1.5.0.patch"
|
||||
"sonner@1.5.0": "patches/sonner@1.5.0.patch",
|
||||
"hono@4.4.7": "patches/hono@4.4.7.patch"
|
||||
}
|
||||
},
|
||||
"simple-git-hooks": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/dist/types/client/types.d.ts b/dist/types/client/types.d.ts
|
||||
index 14af56d34248f101aecdebdd2e56278eac4b0c0d..458962012529b4374d6109112db791d918a6a313 100644
|
||||
--- a/dist/types/client/types.d.ts
|
||||
+++ b/dist/types/client/types.d.ts
|
||||
@@ -41,7 +41,7 @@ type ClientResponseOfEndpoint<T extends Endpoint = Endpoint> = T extends {
|
||||
output: infer O;
|
||||
outputFormat: infer F;
|
||||
status: infer S;
|
||||
-} ? ClientResponse<O, S extends number ? S : never, F extends ResponseFormat ? F : never> : never;
|
||||
+ } ? O : never;
|
||||
export interface ClientResponse<T, U extends number = StatusCode, F extends ResponseFormat = ResponseFormat> extends globalThis.Response {
|
||||
readonly body: ReadableStream | null;
|
||||
readonly bodyUsed: boolean;
|
||||
2521
pnpm-lock.yaml
2521
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -1,3 +1,17 @@
|
|||
import Store from "electron-store"
|
||||
import { resolve } from "node:path"
|
||||
|
||||
export const store = new Store()
|
||||
import { app } from "electron"
|
||||
import { JSONFileSyncPreset } from "lowdb/node"
|
||||
|
||||
export const db = JSONFileSyncPreset(
|
||||
resolve(app.getPath("userData"), "db.json"),
|
||||
{},
|
||||
)
|
||||
|
||||
export const store = {
|
||||
get: (key: string) => db.data[key],
|
||||
set: (key: string, value: any) => {
|
||||
db.data[key] = value
|
||||
db.write()
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export function createWindow(
|
|||
autoHideMenuBar: true,
|
||||
...(process.platform === "linux" ? { icon } : {}),
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "../preload/index.js"),
|
||||
preload: path.join(__dirname, "../preload/index.mjs"),
|
||||
sandbox: false,
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<title>Follow</title>
|
||||
<link rel="stylesheet" href="./styles/main.css" />
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var e =
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export const NotFound = () => <div className="center size-full">404 Not Found</div>
|
||||
|
|
@ -1,16 +1,21 @@
|
|||
import { createBrowserRouter } from "react-router-dom"
|
||||
import { createHashRouter } from "react-router-dom"
|
||||
|
||||
import App from "./App"
|
||||
import { NotFound } from "./components/ui/not-found"
|
||||
import { buildGlobRoutes } from "./lib/route-builder"
|
||||
|
||||
const globTree = import.meta.glob("./pages/**/*.tsx")
|
||||
const tree = buildGlobRoutes(globTree)
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
export const router = createHashRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <App />,
|
||||
|
||||
children: tree,
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: <NotFound />,
|
||||
},
|
||||
])
|
||||
|
|
|
|||
Loading…
Reference in New Issue