Skip to content

Commit 06db349

Browse files
committed
build fixes
1 parent e81763e commit 06db349

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ RUN npm run ui:build
3838

3939
# Build Next.js app
4040
WORKDIR /src/MyApp.Client
41-
COPY MyApp.Client/package*.json MyApp.Client/npm-shrinkwrap.json ./
41+
COPY MyApp.Client/package*.json MyApp.Client/npm-shrinkwrap.json MyApp.Client/postinstall.mjs ./
4242
RUN npm ci
4343
COPY MyApp.Client/ ./
44-
RUN npm run build:prod
44+
RUN npm run build
4545

4646
# Restore and publish .NET app
4747
WORKDIR /src

MyApp.Client/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./dist/dev/types/routes.d.ts";
3+
import "./dist/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

MyApp.Client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
"dev": "next dev",
66
"dtos": "npx get-dtos ts",
77
"build": "next build",
8-
"build:local": "cross-env NODE_ENV=development MODE=local next build",
98
"publish": "npm run build && dotnet publish ../MyApp/MyApp.csproj -c Release",
109
"start": "next start",
1110
"typecheck": "tsc",
1211
"test": "vitest",
1312
"test:ui": "vitest --ui",
1413
"test:run": "vitest run",
15-
"postinstall": "test -f ./postinstall.mjs && node ./postinstall.mjs || true"
14+
"postinstall": "node ./postinstall.mjs"
1615
},
1716
"dependencies": {
1817
"@servicestack/client": "^2.1.13",

MyApp.Client/postinstall.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { execSync } from 'child_process'
66
import { join, dirname } from 'path'
77
import { fileURLToPath } from 'url'
8+
import { readdirSync, existsSync } from 'fs'
89

910
const __filename = fileURLToPath(import.meta.url)
1011
const __dirname = dirname(__filename)
@@ -20,6 +21,16 @@ function isDotnetInstalled() {
2021

2122
function runMigration() {
2223
const myAppPath = join(__dirname, '..', 'MyApp')
24+
const appDataPath = join(myAppPath, 'App_Data')
25+
26+
// Only run migration if App_Data doesn't exist or has no files (other than .gitkeep)
27+
if (existsSync(appDataPath)) {
28+
const files = readdirSync(appDataPath).filter(file => file !== '.gitkeep')
29+
if (files.length > 0) {
30+
console.log('Skipping migration: App_Data already contains files')
31+
return
32+
}
33+
}
2334

2435
try {
2536
console.log('Running database migration...')

0 commit comments

Comments
 (0)