From 9b68253aff4d4e348ab7dcdaa649a6da37473506 Mon Sep 17 00:00:00 2001 From: rexchoppers Date: Wed, 22 May 2024 20:49:16 +0100 Subject: [PATCH] FIXED Few build issues --- package.json | 12 +++++++++++- server/index.ts | 8 +++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 823b866..7953f2a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "awms-keycloak-configuration-tool", "version": "1.0.0", "description": "", - "main": "index.js", + "main": "server/index.ts", + "bin": "dist/index.js", "scripts": { "start": "node dist/index.js", "server": "nodemon --watch 'server/**/*.ts' --exec 'ts-node' server/index.ts", @@ -32,5 +33,14 @@ "@types/node": "^20.12.12", "ts-node": "^10.9.2", "typescript": "^5.4.5" + }, + "pkg": { + "assets": [ + "client/build/**/*", + "server/**/*.ts" + ], + "scripts": [ + "dist/**/*.js" + ] } } diff --git a/server/index.ts b/server/index.ts index 7af583f..00ca103 100644 --- a/server/index.ts +++ b/server/index.ts @@ -7,15 +7,17 @@ const app = express(); const port = process.env.PORT || 5000; const router = express.Router(); -app.use('/api/keycloak', testRoutes); + +const buildPath = path.join(__dirname, '../client/build'); +app.use(express.static(buildPath)); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); -app.use(express.static(path.join(__dirname, '../client/build'))); +app.use('/api/keycloak', testRoutes); app.get('*', (req, res) => { - res.sendFile(path.join(__dirname, '../client/build', 'index.html')); + res.sendFile(path.join(buildPath, 'index.html')); }); app.listen(port, () => {