feat: ditch remix-serve for custom-baked server
This commit is contained in:
parent
d5ee8ae0f3
commit
13a734923d
@ -13,10 +13,11 @@ RUN pnpm prune --prod
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/build /app/build
|
||||
COPY --from=build /app/server.mjs /app/server.mjs
|
||||
COPY --from=build /app/node_modules /app/node_modules
|
||||
RUN echo '{"type":"module"}' > /app/package.json
|
||||
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
ENV HOST=0.0.0.0
|
||||
CMD [ "node_modules/.bin/remix-serve", "./build/server/index.js" ]
|
||||
CMD [ "./server.mjs" ]
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import React, { useEffect } from 'react'
|
||||
import Merge from 'react-codemirror-merge'
|
||||
import CodeMirror from '@uiw/react-codemirror'
|
||||
import * as shopify from '@shopify/lang-jsonc'
|
||||
import { ClientOnly } from 'remix-utils/client-only'
|
||||
import { ErrorBoundary } from 'react-error-boundary'
|
||||
import { jsonc } from '@shopify/lang-jsonc'
|
||||
import { githubDark, githubLight } from '@uiw/codemirror-theme-github'
|
||||
import { useState } from 'react'
|
||||
import { cn } from '~/utils/cn'
|
||||
@ -45,7 +45,7 @@ export function Editor(props: EditorProps) {
|
||||
<CodeMirror
|
||||
value={props.value}
|
||||
height="100%"
|
||||
extensions={[jsonc()]}
|
||||
extensions={[shopify.jsonc()]}
|
||||
style={{ height: "100%" }}
|
||||
theme={light ? githubLight : githubDark}
|
||||
onChange={(value) => props.onChange(value)}
|
||||
@ -104,12 +104,12 @@ export function Differ(props: DifferProps) {
|
||||
<Merge.Original
|
||||
readOnly
|
||||
value={props.left}
|
||||
extensions={[jsonc()]}
|
||||
extensions={[shopify.jsonc()]}
|
||||
/>
|
||||
<Merge.Modified
|
||||
readOnly
|
||||
value={props.right}
|
||||
extensions={[jsonc()]}
|
||||
extensions={[shopify.jsonc()]}
|
||||
/>
|
||||
</Merge>
|
||||
)}
|
||||
@ -20,7 +20,7 @@ import { HeadscaleError, pull, put } from '~/utils/headscale'
|
||||
import { getSession } from '~/utils/sessions'
|
||||
import log from '~/utils/log'
|
||||
|
||||
import { Editor, Differ } from './cm'
|
||||
import { Editor, Differ } from './cm.client'
|
||||
import { Unavailable } from './unavailable'
|
||||
import { ErrorView } from './error'
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
import tale from 'eslint-config-tale'
|
||||
|
||||
export default [
|
||||
...tale
|
||||
]
|
||||
56
package.json
56
package.json
@ -6,8 +6,6 @@
|
||||
"scripts": {
|
||||
"build": "remix vite:build",
|
||||
"dev": "remix vite:dev",
|
||||
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
|
||||
"start": "remix-serve ./build/server/index.js",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -15,48 +13,48 @@
|
||||
"@dnd-kit/modifiers": "^7.0.0",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@kubernetes/client-node": "^0.21.0",
|
||||
"@primer/octicons-react": "^19.10.0",
|
||||
"@hono/node-server": "^1.13.5",
|
||||
"@kubernetes/client-node": "^0.22.2",
|
||||
"@primer/octicons-react": "^19.12.0",
|
||||
"@react-aria/toast": "3.0.0-beta.12",
|
||||
"@react-stately/toast": "3.0.0-beta.4",
|
||||
"@remix-run/node": "^2.10.2",
|
||||
"@remix-run/react": "^2.10.2",
|
||||
"@remix-run/serve": "^2.10.2",
|
||||
"@remix-run/node": "^2.13.1",
|
||||
"@remix-run/react": "^2.13.1",
|
||||
"@shopify/lang-jsonc": "^1.0.0",
|
||||
"@uiw/codemirror-theme-github": "^4.23.5",
|
||||
"@uiw/react-codemirror": "^4.23.5",
|
||||
"@uiw/codemirror-theme-github": "^4.23.6",
|
||||
"@uiw/react-codemirror": "^4.23.6",
|
||||
"clsx": "^2.1.1",
|
||||
"dotenv": "^16.4.5",
|
||||
"isbot": "^5.1.11",
|
||||
"oauth4webapi": "^2.11.1",
|
||||
"hono": "^4.6.9",
|
||||
"isbot": "^5.1.17",
|
||||
"oauth4webapi": "^2.17.0",
|
||||
"react": "19.0.0-beta-26f2496093-20240514",
|
||||
"react-aria-components": "^1.2.1",
|
||||
"react-codemirror-merge": "^4.23.5",
|
||||
"react-codemirror-merge": "^4.23.6",
|
||||
"react-dom": "19.0.0-beta-26f2496093-20240514",
|
||||
"react-error-boundary": "^4.1.2",
|
||||
"remix-utils": "^7.6.0",
|
||||
"tailwind-merge": "^2.3.0",
|
||||
"tailwindcss-react-aria-components": "^1.1.3",
|
||||
"undici": "^6.19.2",
|
||||
"remix-hono": "^0.0.16",
|
||||
"remix-utils": "^7.7.0",
|
||||
"tailwind-merge": "^2.5.4",
|
||||
"tailwindcss-react-aria-components": "^1.1.6",
|
||||
"undici": "^6.20.1",
|
||||
"usehooks-ts": "^3.1.0",
|
||||
"yaml": "^2.4.5",
|
||||
"yaml": "^2.6.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@remix-run/dev": "^2.10.2",
|
||||
"@remix-run/dev": "^2.13.1",
|
||||
"@types/react": "npm:types-react@beta",
|
||||
"@types/react-dom": "npm:types-react-dom@beta",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"babel-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-tale": "^2.0.4",
|
||||
"postcss": "^8.4.39",
|
||||
"tailwindcss": "^3.4.4",
|
||||
"postcss": "^8.4.47",
|
||||
"tailwindcss": "^3.4.14",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "^5.5.3",
|
||||
"vite": "^5.3.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.10",
|
||||
"vite-plugin-babel": "^1.2.0",
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
"vite-tsconfig-paths": "^5.1.0"
|
||||
},
|
||||
"overrides": {
|
||||
"@types/react": "npm:types-react@beta",
|
||||
@ -70,6 +68,12 @@
|
||||
"patchedDependencies": {
|
||||
"@react-aria/overlays@3.22.1": "patches/@react-aria__overlays@3.22.1.patch",
|
||||
"@shopify/lang-jsonc@1.0.0": "patches/@shopify__lang-jsonc@1.0.0.patch"
|
||||
},
|
||||
"peerDependencyRules": {
|
||||
"allowAny": [
|
||||
"react",
|
||||
"react-dom"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3953
pnpm-lock.yaml
3953
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
52
server.mjs
Executable file
52
server.mjs
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { access, constants } from 'node:fs/promises'
|
||||
|
||||
function log(level, message) {
|
||||
const date = new Date().toISOString()
|
||||
console.log(`${date} (${level}) [SRVX] ${message}`)
|
||||
}
|
||||
|
||||
log('INFO', `Running with Node.js ${process.versions.node}`)
|
||||
|
||||
try {
|
||||
await access('./node_modules/@remix-run', constants.F_OK | constants.R_OK)
|
||||
log('INFO', 'Found node_modules dependencies')
|
||||
} catch (error) {
|
||||
log('ERROR', 'No node_modules found. Please run `pnpm install` first')
|
||||
log('ERROR', error)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
try {
|
||||
await access('./build/server', constants.F_OK | constants.R_OK)
|
||||
log('INFO', 'Found build directory')
|
||||
} catch (error) {
|
||||
const date = new Date().toISOString()
|
||||
log('ERROR', 'No build directory found. Please run `pnpm build` first')
|
||||
log('ERROR', error)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const { installGlobals } = await import('@remix-run/node')
|
||||
const { remix } = await import('remix-hono/handler')
|
||||
const { serve } = await import('@hono/node-server')
|
||||
const { Hono } = await import('hono')
|
||||
|
||||
installGlobals()
|
||||
const app = new Hono()
|
||||
const port = process.env.PORT || 3000
|
||||
const host = process.env.HOST || '0.0.0.0'
|
||||
|
||||
app.use('*', remix({
|
||||
build: await import('./build/server/index.js'),
|
||||
mode: 'production'
|
||||
}))
|
||||
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
hostname: host,
|
||||
port
|
||||
})
|
||||
|
||||
log('INFO', `Running on ${host}:${port}`)
|
||||
Loading…
Reference in New Issue
Block a user