Skip to content

Commit

Permalink
chore: vscode configuration errors, fix later
Browse files Browse the repository at this point in the history
  • Loading branch information
brunotot committed May 9, 2024
1 parent dccb302 commit 0c50f4c
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 67 deletions.
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,29 @@
"description": "monorepo-mern-railway-starter description",
"main": "index.js",
"type": "module",
"private": true,
"workspaces": [
"packages/*"
],
"engines": {
"pnpm": ">=8.15.7"
},
"scripts": {
"prepare": "husky && pnpm --filter @org/shared run build",
"prepare": "husky",
"root:test": "echo \"Error: no test specified\"",
"root:typedoc": "typedoc --options typedoc/typedoc.json && bash typedoc/scripts/typedoc-sanitize.sh",
"root:lint": "npx eslint . --fix",
"root:clean": "pnpm run -r clean",
"root:build": "pnpm run -r build",
"shared:build": "npm run build --prefix packages/shared",
"backend:start": "npm run start --prefix packages/backend",
"backend:build": "npm run build --prefix packages/backend",
"frontend:dev": "npm run dev --prefix packages/frontend",
"frontend:start": "npm run start --prefix packages/frontend",
"frontend:build": "npm run build --prefix packages/frontend",
"frontend:interface": "npm run interface --prefix packages/frontend",
"md:updateDeps": "node md/dependencies/updateDepDocs.js",
"md:mergeMds": "node md/scripts/mergeMds.js",
"clean": "rm -rf node_modules packages/backend/dist packages/backend/node_modules packages/frontend/dist packages/frontend/node_modules packages/shared/node_modules packages/shared/dist"
"md:mergeMds": "node md/scripts/mergeMds.js"
},
"author": "Bruno Tot",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ Maintains a consistent code style and architecture, carefully crafted to ensure
### Enhancement Decorators

Provides various decorators to enrich the controllers and services with additional functionality, such as logging and security enhancements.

//"test": "vitest",
//"build": "rm -rf dist && npm run compile:ts",
//"start": "export PACKAGE_JSON_VERSION=$(grep -o '\"version\": *\"[^\"]*\"' package.json | awk -F'\"' '{print $4}') && node --no-warnings --loader ts-node/esm --experimental-specifier-resolution=node ./dist/main.js",
12 changes: 8 additions & 4 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "@org/backend",
"version": "0.0.1",
"description": "",
"main": "main.js",
"main": "dist/main.js",
"types": "dist/index.js",
"type": "module",
"scripts": {
"test": "vitest",
"test:watch": "jest --watchAll",
"build": "npm run build --prefix ../shared && rm -rf dist && npm run compile:ts",
"compile:ts": "tsc && npm run tsc-alias",
"test": "vitest",
"build": "rm -rf dist && npm run compile:ts",
"start": "export PACKAGE_JSON_VERSION=$(grep -o '\"version\": *\"[^\"]*\"' package.json | awk -F'\"' '{print $4}') && node --no-warnings --loader ts-node/esm --experimental-specifier-resolution=node ./dist/main.js",
"compile:ts": "tsc && npm run tsc-alias",
"tsc-alias": "tsc-alias -p tsconfig.json"
},
"keywords": [],
Expand Down Expand Up @@ -62,10 +63,13 @@
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"mongodb-memory-server": "^9.2.0",
"nodemon": "^3.1.0",
"supertest": "^7.0.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsconfig-paths-jest": "^0.0.1",
"tsx": "^4.9.3",
"typescript": "^5.3.3",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/configureApp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "@org/backend/config";
import "./config";

import { App } from "./App";
import { ServiceRegistry, MongoClient } from "./config";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export class UserController {
};
}

return {
status: 403,
body: new ErrorResponse(req.originalUrl, 403, "User not found").content,
};

return {
status: 200,
body: users[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { type User } from "@org/shared";
import { type PaginableRepository } from "@org/backend/infrastructure/repository/interface/PaginableRepository";

export interface UserRepository extends PaginableRepository<User> {
findOneByUsername(username: string) => Promise<User | null>;
findOneByRefreshTokens(refreshTokens: string[]) => Promise<User | null>;
findOneByUsername: (username: string) => Promise<User | null>;
findOneByRefreshTokens: (refreshTokens: string[]) => Promise<User | null>;
findAll: () => Promise<User[]>;
insertOne: (user: Omit<User, "_id">) => Promise<User>;
updateOne: (user: User) => Promise<User>;
Expand Down
22 changes: 19 additions & 3 deletions packages/backend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"skipLibCheck": true,
"outDir": "./dist",
"typeRoots": ["./node_modules/@types"],
"types": ["jest", "node"]
"types": ["jest", "node", "@types/jest"],

"baseUrl": ".",
"paths": {
"@org/backend/config": ["./src/config/index"],
"@org/backend/config/*": ["./src/config/*"],
"@org/backend/decorators": ["./src/decorators/index"],
"@org/backend/decorators/*": ["./src/decorators/*"],
"@org/backend/types": ["./src/types/index"],
"@org/backend/types/*": ["./src/types/*"],
"@org/backend/infrastructure": ["./src/infrastructure/index"],
"@org/backend/infrastructure/*": ["./src/infrastructure/*"]
}
},
"include": ["src"],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node"
},
"include": ["src/**/*"],
"exclude": ["src/logs"]
}
9 changes: 7 additions & 2 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"name": "@org/shared",
"version": "0.0.1",
"description": "",
"main": "dist/index.js",
"main": "dist/index",
"types": "dist/index",
"type": "module",
"scripts": {
"build": "rm -rf dist && tsc",
"build": "pnpm run clean && pnpm run compile",
"clean": "rimraf ./dist",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "pnpm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
Expand All @@ -20,6 +24,7 @@
"zod": "^3.22.5"
},
"devDependencies": {
"rimraf": "^5.0.5",
"typescript": "^5.3.3"
}
}
1 change: 1 addition & 0 deletions packages/shared/src/web/contracts/UserContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const UserContract = initContract().router({
responses: {
200: User,
404: ZOD_ERROR_ANY.describe("User not found"),
403: ZOD_ERROR_ANY.describe("User not found"),
...defaultResponses,
},
},
Expand Down
7 changes: 7 additions & 0 deletions packages/shared/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.build.json",
"include": ["src/**/*"],
"compilerOptions": {
"outDir": "./dist"
}
}
7 changes: 1 addition & 6 deletions packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"typeRoots": []
},
"include": ["src"]
"extends": "../../tsconfig.json"
}
Loading

0 comments on commit 0c50f4c

Please sign in to comment.