Skip to content

Commit

Permalink
build: Update start script to include database preparation for dev en…
Browse files Browse the repository at this point in the history
…vironment
  • Loading branch information
wajeht committed Aug 14, 2024
1 parent 0b58580 commit 32ae7f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl

ENV NODE_ENV production

RUN npm run db:prepare:prod

CMD ["node", "--no-warnings", "dist/src/server.js"]
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "index.js",
"scripts": {
"prepare": "husky",
"start": "npm run build && node --no-warnings ./dist/src/server.js",
"dev": "tsx watch --no-warnings --clear-screen=false ./src/server.ts",
"start": "npm run build && npm run db:prepare:prod && node --no-warnings ./dist/src/server.js",
"dev": "npm run db:prepare:dev && tsx watch --no-warnings --clear-screen=false ./src/server.ts",
"dev:tailwind": "npx tailwindcss -i ./public/css/tailwind.css -o ./public/css/style.css --watch",
"build:server": "tsc",
"build": "npm run build:tailwind && npm run build:server",
Expand All @@ -18,14 +18,16 @@
"format": "prettier --write --cache . > /dev/null",
"lint:check": "eslint .",
"lint": "eslint --fix --cache . --ignore-path .gitignore",
"migrate:make": "tsx ./node_modules/knex/bin/cli.js migrate:make --knexfile=./src/db/knexfile.ts",
"migrate:latest:prod": "knex migrate:latest --knexfile=./dist/src/db/knexfile.js",
"migrate:latest": "tsx ./node_modules/knex/bin/cli.js migrate:latest --knexfile=./src/db/knexfile.ts",
"migrate:rollback": "tsx ./node_modules/knex/bin/cli.js migrate:rollback --knexfile=./src/db/knexfile.ts",
"migrate:rollback:prod": "knex migrate:rollback --knexfile=./dist/src/db/knexfile.js",
"seed:make": "tsx ./node_modules/knex/bin/cli.js seed:make --knexfile=./src/db/knexfile.ts",
"seed:run": "tsx ./node_modules/knex/bin/cli.js seed:run --knexfile=./src/db/knexfile.ts",
"seed:run:prod": "knex seed:run --knexfile=./dist/src/db/knexfile.js"
"db:prepare:dev": "npm run db:migrate:latest && npm run db:seed:run",
"db:prepare:prod": "npm run db:migrate:latest:prod",
"db:migrate:make": "tsx ./node_modules/knex/bin/cli.js migrate:make --knexfile=./src/db/knexfile.ts",
"db:migrate:latest:prod": "knex migrate:latest --knexfile=./dist/src/db/knexfile.js",
"db:migrate:latest": "tsx ./node_modules/knex/bin/cli.js migrate:latest --knexfile=./src/db/knexfile.ts",
"db:migrate:rollback": "tsx ./node_modules/knex/bin/cli.js migrate:rollback --knexfile=./src/db/knexfile.ts",
"db:migrate:rollback:prod": "knex migrate:rollback --knexfile=./dist/src/db/knexfile.js",
"db:seed:make": "tsx ./node_modules/knex/bin/cli.js seed:make --knexfile=./src/db/knexfile.ts",
"db:seed:run": "tsx ./node_modules/knex/bin/cli.js seed:run --knexfile=./src/db/knexfile.ts",
"db:seed:run:prod": "knex seed:run --knexfile=./dist/src/db/knexfile.js"
},
"keywords": [
"discord",
Expand Down

0 comments on commit 32ae7f9

Please sign in to comment.