chore(build): add webpack and fix paths for build
authorxangelo <me@xangelo.ca>
Wed, 4 Dec 2024 17:46:11 +0000 (12:46 -0500)
committerxangelo <me@xangelo.ca>
Wed, 4 Dec 2024 17:46:11 +0000 (12:46 -0500)
We're using typescript paths, so we need to include tsconfig-paths in the
build process. Also added webpack to build to the build and simplified:

```
npm run build -> build FE + BE
npm start -> start server
```

This is more in line with what DO is expecting and a more standard build
process.

package.json

index d8be3520c09a2b995d1871c379e075f108ec0437..e692d29f8801ecea307f177883e9cb914a2594d8 100644 (file)
@@ -3,10 +3,9 @@
   "private": true,
   "version": "0.4.3",
   "scripts": {
-    "up": "npx prisma migrate dev --name \"init\"",
-    "start": "pm2 start dist/server/api.js",
-    "build:prod": "npx tsc",
-    "postbuild:prod": "cp -R public dist/",
+    "start": "TS_NODE_BASEURL=./dist node -r tsconfig-paths/register dist/src/server/api.js",
+    "build": "npx tsc && npx webpack",
+    "postbuild": "cp -R public dist/",
     "migrate": "npx ts-node ./node_modules/knex/bin/cli.js migrate:latest",
     "migrate:prod": "NODE_ENV=production npx ts-node ./node_modules/knex/bin/cli.js migrate:latest",
     "seed": "npx ts-node ./node_modules/knex/bin/cli.js seed:run",