160 lines
5.2 KiB
Diff
160 lines
5.2 KiB
Diff
diff --git a/next.config.js b/next.config.js
|
|
index 42ebcb3..1301a2e 100644
|
|
--- a/next.config.js
|
|
+++ b/next.config.js
|
|
@@ -30,6 +30,7 @@ try {
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
module.exports = bundleAnalyzer({ enabled: !!process.env.ANALYZE })({
|
|
+ output: "standalone",
|
|
images: {
|
|
unoptimized: true
|
|
},
|
|
diff --git a/package.json b/package.json
|
|
index 3ee262a..37dc60f 100644
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -3,10 +3,11 @@
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"license": "0BSD",
|
|
+ "bin": "server.js",
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"build:analyze": "(export ANALYZE=true || set ANALYZE=true) && npm run build",
|
|
"start": "next start",
|
|
"lint": "next lint",
|
|
"migrate:up": "dotenvx run -f .env.local -- node db-migrate.cjs up",
|
|
@@ -55,6 +57,7 @@
|
|
"@types/react-dom": "^18",
|
|
"@types/react-grid-layout": "^1.3.5",
|
|
"@types/react-resizable": "^3.0.7",
|
|
+ "@yao-pkg/pkg": "^5.11.5",
|
|
"autoprefixer": "^10.4.19",
|
|
"eslint": "^8",
|
|
"eslint-config-next": "14.2.0",
|
|
@@ -64,5 +67,27 @@
|
|
"ts-node": "^10.9.2",
|
|
"type-fest": "^4.15.0",
|
|
"typescript": "^5"
|
|
+ },
|
|
+ "pkg": {
|
|
+ "assets": [
|
|
+ ".next/**/*",
|
|
+ ".db-migraterc",
|
|
+ "node_modules/**/*.node"
|
|
+ ],
|
|
+ "scripts": [
|
|
+ ".next/server/**/*.js",
|
|
+ "next.config.js"
|
|
+ ],
|
|
+ "patches": {
|
|
+ "node_modules/next/dist/server/next-server.js": [
|
|
+ "(0, _path.join)(this.dir, _constants.CLIENT_PUBLIC_FILES_PATH)",
|
|
+ "(0, _path.join)(process.cwd(), _constants.CLIENT_PUBLIC_FILES_PATH)"
|
|
+ ],
|
|
+ "node_modules/next/dist/server/lib/router-utils/filesystem.js": [
|
|
+ "const publicFolderPath = _path.default.join(opts.dir, \"public\");",
|
|
+ "const publicFolderPath = _path.default.join(process.cwd(), \"public\");"
|
|
+ ]
|
|
+ },
|
|
+ "targets": ["host"]
|
|
}
|
|
}
|
|
diff --git a/src/app/(with-header)/header-sidebar.tsx b/src/app/(with-header)/header-sidebar.tsx
|
|
index 15f4d40..51dc8fb 100644
|
|
--- a/src/app/(with-header)/header-sidebar.tsx
|
|
+++ b/src/app/(with-header)/header-sidebar.tsx
|
|
@@ -143,6 +143,7 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => {
|
|
}
|
|
}) as { ref: RefCallback<Document>; };
|
|
|
|
+ // @ts-ignore
|
|
useEffect(() => {
|
|
ref(document);
|
|
return () => ref({} as any);
|
|
diff --git a/src/components/select-modal.tsx b/src/components/select-modal.tsx
|
|
index 1e961e7..0d1eb32 100644
|
|
--- a/src/components/select-modal.tsx
|
|
+++ b/src/components/select-modal.tsx
|
|
@@ -44,6 +44,7 @@ const SelectModalList = <D extends Data, I extends keyof D>({ onSelectionChanged
|
|
getScrollElement: () => listRef.current,
|
|
estimateSize: () => lastHeight.current,
|
|
overscan: 5,
|
|
+ // @ts-ignore
|
|
scrollingDelay: 0,
|
|
measureElement: el => {
|
|
return lastHeight.current = el.clientHeight;
|
|
@@ -91,6 +92,7 @@ const SelectModalGrid = <D extends Data, I extends keyof D>({ onSelectionChanged
|
|
getScrollElement: () => listRef.current,
|
|
estimateSize: () => lastHeight.current,
|
|
overscan: 5,
|
|
+ // @ts-ignore
|
|
scrollingDelay: 0,
|
|
measureElement: el => {
|
|
return lastHeight.current = el.clientHeight;
|
|
diff --git a/src/components/window-scroller-grid.tsx b/src/components/window-scroller-grid.tsx
|
|
index 5284a66..39c0e21 100644
|
|
--- a/src/components/window-scroller-grid.tsx
|
|
+++ b/src/components/window-scroller-grid.tsx
|
|
@@ -24,6 +24,7 @@ export const WindowScrollerGrid = <D extends any>({ rowSize, colSize, items, chi
|
|
estimateSize: () => rowSize,
|
|
scrollMargin: listRef.current?.offsetTop ?? 0,
|
|
overscan: 5,
|
|
+ // @ts-ignore
|
|
scrollingDelay: 0
|
|
});
|
|
|
|
diff --git a/src/instrumentation.ts b/src/instrumentation.ts
|
|
index 64708a7..f5f6d2c 100644
|
|
--- a/src/instrumentation.ts
|
|
+++ b/src/instrumentation.ts
|
|
@@ -57,7 +57,8 @@ export async function register() {
|
|
if (['true', 'yes', '1'].includes(process.env.AUTOMIGRATE?.toLowerCase()!)) {
|
|
process.env.DATABASE_URL = url.toString();
|
|
// using require here increases build times to like 10 minutes for some reason
|
|
- const DBMigrate = await eval('imp' + 'ort("db-migrate")');
|
|
+ // beerpsi (2024/04/24): required for actaeon-portable since `pkg` is really fussy about es modules
|
|
+ const DBMigrate = eval('req' + 'uire("db-migrate")');
|
|
const dbmigrate = DBMigrate.getInstance(true);
|
|
await dbmigrate.up();
|
|
|
|
diff --git a/server.patch b/server.patch
|
|
index 64708a7..f5f6d2c 100644
|
|
--- a/server.patch
|
|
+++ b/server.patch
|
|
@@ -0,0 +0,13 @@
|
|
+--- .\server.js
|
|
++++ .\server.js
|
|
+@@ -1,9 +1,9 @@
|
|
+ const path = require('path')
|
|
++require("@next/env").loadEnvConfig(process.cwd(), false, console, true)
|
|
+
|
|
+ const dir = path.join(__dirname)
|
|
+
|
|
+ process.env.NODE_ENV = 'production'
|
|
+-process.chdir(__dirname)
|
|
+
|
|
+ const currentPort = parseInt(process.env.PORT, 10) || 3000
|
|
+ const hostname = process.env.HOSTNAME || '0.0.0.0'
|
|
diff --git a/build-exe.sh b/build-exe.sh
|
|
index 64708a7..f5f6d2c 100644
|
|
--- a/build-exe.sh
|
|
+++ a/build-exe.sh
|
|
@@ -0,0 +0,15 @@
|
|
+npm run build
|
|
+cp -r .next/static .next/standalone/.next/
|
|
+cp .db-migraterc .next/standalone/
|
|
+patch .next/standalone/server.js server.patch
|
|
+
|
|
+TEMPDIR="$(mktemp -d)"
|
|
+echo $TEMPDIR
|
|
+cp -r .next/standalone/* "$TEMPDIR/"
|
|
+
|
|
+pushd "$TEMPDIR"
|
|
+npx @yao-pkg/pkg . --compress brotli
|
|
+popd
|
|
+
|
|
+cp "$TEMPDIR/actaeon.exe" .
|
|
+rm -r "$TEMPDIR"
|