implemented release build

This commit is contained in:
Altair-sh
2026-09-29 18:56:04 +02:00
parent 7d64ab4809
commit 03eaa951f7
4 changed files with 78 additions and 0 deletions
+19
View File
@@ -1 +1,20 @@
# paradox-save-parser-frontend
## Install dependencies
```sh
npm i
```
## Build release
```sh
npm run build
```
## Run release
```sh
cd .next/standalone
node --enable-source-maps ./server.js
```
+22
View File
@@ -2,7 +2,29 @@ import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
// call tsc6 instead of import 'typescript'
useTypeScriptCli: true,
// faster "npm run dev"
turbopackFileSystemCacheForDev: true,
// don't create temporary files in .next/ during "npm run build"
turbopackFileSystemCacheForBuild: false,
// options to make standalone build more debuggable
serverSourceMaps: true,
serverMinification: false,
},
// produce .next/standalone
// which can be started by `node server.js` without any dependencies
output: 'standalone',
images: {
unoptimized: true,
},
// remove next/image from build, which this project doesn't use
outputFileTracingExcludes: {
'*': ['node_modules/sharp/**', 'node_modules/@img/**'],
},
// sometimes production builds ran without proper type checking
typescript: {
ignoreBuildErrors: false,
},
}
+1
View File
@@ -6,6 +6,7 @@
"dev": "cross-env NEXT_TELEMETRY_DISABLED=1 next dev --turbopack",
"prebuild": "node scripts/replace-tsc6-with-tsc7.mjs",
"build": "cross-env NEXT_TELEMETRY_DISABLED=1 next build",
"postbuild": "node scripts/prepare-build.mjs",
"start": "next start",
"lint": "eslint",
"format": "npx prettier --write ."
+36
View File
@@ -0,0 +1,36 @@
/**
Assembles a self-contained deployment folder at ./build/ from the
`output: 'standalone'` next build output. Next.js does not include
.next/static or public/ in .next/standalone by itself, so this script
copies them in. The result can be deployed as-is and started with
`node server.js` from inside ./build/, without running `npm install`.
*/
import { cpSync, existsSync, rmSync } from 'node:fs'
import path from 'node:path'
const root = path.resolve(import.meta.dirname, '..')
const standaloneDir = path.join(root, '.next', 'standalone')
const buildDir = path.join(root, 'build')
if (!existsSync(standaloneDir)) {
console.error(
`${standaloneDir} not found. Run "next build" with output: 'standalone' set in next.config.ts first.`
)
process.exit(1)
}
rmSync(buildDir, { recursive: true, force: true })
cpSync(standaloneDir, buildDir, { recursive: true })
cpSync(
path.join(root, '.next', 'static'),
path.join(buildDir, '.next', 'static'),
{ recursive: true }
)
const publicDir = path.join(root, 'public')
if (existsSync(publicDir)) {
cpSync(publicDir, path.join(buildDir, 'public'), { recursive: true })
}
console.log(`build assembled at ${buildDir}`)