From 6c5de3d38dabd824fbae78463efc73cc98c6dca7 Mon Sep 17 00:00:00 2001 From: Alexander Ungar Date: Wed, 22 Mar 2023 00:56:59 +0100 Subject: [PATCH] Improve build pipeline --- package.json | 12 +++++++++--- src/repository/budget/mongo/budgetMongoRepository.ts | 4 ++-- tsconfig.json | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 38dcf65..132c351 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,14 @@ "type": "module", "main": "dist/src/index.js", "scripts": { - "build": "tsc", + "clean": "rimraf dist", + "generate-api-types": "openapi-typescript api/my-finance-pal.yml --output generated/api.ts", + "copy-resources": "copyfiles env/production.env api/* dist/", + "compile": "tsc", + "build": "run-s clean compile generate-api-types copy-resources", "lint": "eslint --ext .ts src/", "dev": "nodemon src/server.ts", - "test": "nodemon --config ./spec/nodemon.json", - "generate-api-types": "openapi-typescript api/my-finance-pal.yml --output generated/api.ts" + "test": "nodemon --config ./spec/nodemon.json" }, "nodemonConfig": { "execMap": { @@ -43,6 +46,7 @@ "@types/node": "^18.15.0", "@types/uuid": "^9.0.1", "@typescript-eslint/eslint-plugin": "^5.54.1", + "copyfiles": "^2.4.1", "eslint": "^8.36.0", "eslint-config-prettier": "^8.7.0", "eslint-config-standard-with-typescript": "^34.0.0", @@ -51,7 +55,9 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.1.1", "nodemon": "^2.0.21", + "npm-run-all": "^4.1.5", "prettier": "^2.8.4", + "rimraf": "^4.4.0", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.2", "typescript": "^4.9.5" diff --git a/src/repository/budget/mongo/budgetMongoRepository.ts b/src/repository/budget/mongo/budgetMongoRepository.ts index 478a90a..452d464 100644 --- a/src/repository/budget/mongo/budgetMongoRepository.ts +++ b/src/repository/budget/mongo/budgetMongoRepository.ts @@ -1,9 +1,9 @@ import type BudgetRepository from "../budgetRepository.js"; import { BudgetEntityConverter } from "../entity/converters.js"; -import { BudgetModel } from "./models.js"; +import { BudgetSummaryModel } from "./models.js"; export const findBudgets: BudgetRepository["findAll"] = async () => { - const found = await BudgetModel.find().select("-transactions"); + const found = await BudgetSummaryModel.find().select("-transactions"); return found.map(BudgetEntityConverter.toDomain); }; diff --git a/tsconfig.json b/tsconfig.json index bf3775f..1922493 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -79,6 +79,7 @@ "include": [ "src/**/*.ts", "generated/**/*.ts", - "env/*.env" + "env", + "api" ], } \ No newline at end of file