diff --git a/package.json b/package.json index e74b2e3..4276729 100644 --- a/package.json +++ b/package.json @@ -4,22 +4,23 @@ "description": "Um pedacinho massa da internet clonado.", "main": "index.js", "scripts": { - "set-env": "npm run docker:up && npm run wait-for-postgres", - "dev": "npm run set-env && npm run migration:up && next dev", + "predev": "npm run services:up && npm run services:wait:database && npm run migrations:up", + "dev": "trap \"\" INT TERM && next dev", + "postdev": "npm run services:stop", + "pretest": "npm run services:up", + "test": "concurrently -n next,jest --hide next -k -s command-jest \"next dev\" \"jest --runInBand --forceExit --verbose\"", + "posttest": "npm run services:stop", + "test:watch": "jest --watchAll --runInBand --verbose", + "services:up": "docker compose -f infra/compose.yaml up -d", + "services:down": "docker compose -f infra/compose.yaml down", + "services:stop": "docker compose -f infra/compose.yaml stop", + "services:wait:database": "node infra/scripts/wait-for-postgres.js", + "migrations:create": "node-pg-migrate --migrations-dir infra/migrations create", + "migrations:up": "node-pg-migrate --migrations-dir infra/migrations --envPath .env.development up", "lint:prettier:check": "prettier --check .", "lint:prettier:fix": "prettier --write .", "lint:eslint:check": "next lint --dir .", - "concurrent-base": "concurrently -n next,jest -s command-jest --hide next -k \"next dev\"", - "test-concurrently": "npm run concurrent-base -- \"jest --runInBand\"", - "test": "npm run set-env && npm run test-concurrently", - "test-concurrently-watch": "npm run concurrent-base -- \"jest --watchAll --runInBand\"", - "test:watch": "npm run set-env && npm run test-concurrently-watch", - "docker:up": "docker compose -f infra/compose.yaml up -d", - "docker:down": "docker compose -f infra/compose.yaml down", - "docker:stop": "docker compose -f infra/compose.yaml stop", - "migration:create": "node-pg-migrate --migrations-dir infra/migrations create", - "migration:up": "node-pg-migrate --migrations-dir infra/migrations --envPath .env.development up", - "wait-for-postgres": "node infra/scripts/wait-for-postgres.js", + "concurrent:base": "concurrently -n next,jest -s command-jest --hide next -k \"next dev\"", "prepare": "husky", "commit": "cz" },