Skip to content

Commit

Permalink
Merge pull request #96 from steniowagner/feat/ts-build
Browse files Browse the repository at this point in the history
feat: properly building ts files
  • Loading branch information
steniowagner authored Feb 18, 2024
2 parents fd158a1 + 02196f3 commit 09a6c22
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 16 deletions.
9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ const { pathsToModuleNameMapper } = require("ts-jest");

/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
roots: ["<rootDir>/src"],
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/*.(test|spec).ts"],
transform: {
".+\\.ts$": "ts-jest",
},
preset: "ts-jest",
modulePaths: [tsconfig.compilerOptions.baseUrl],
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths),
modulePaths: ["<rootDir>"],
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: "<rootDir>",
}),
coverageReporters: ["html", "text"],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"codegen:init": "npx graphql-code-generator init",
"prettier:fix": "npx prettier '**/*.ts' --write",
"lint:fix": "npx eslint . --ext .ts --fix",
"build": "tsc -p tsconfig.json",
"build": "tsc -p tsconfig.json && tsc-alias",
"prepare": "husky install",
"test": "jest --passWithNoTests --no-cache",
"test:watch": "jest --watch",
Expand Down Expand Up @@ -41,6 +41,7 @@
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"tsc-alias": "^1.8.8",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
},
Expand Down
37 changes: 37 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/graphql/errors/tmdb-api/tmdb-api-error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphQLError } from "graphql";
import { GraphQLError } from "../../../../node_modules/graphql";

export default class TMDBApiError extends GraphQLError {
extensions: Record<string, string | number> = {};
Expand Down
23 changes: 13 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"target": "es2016",
"lib": ["es6"],
"module": "commonjs",
"rootDirs": ["src", "__tests__"],
"outDir": "build",
"baseUrl": "src",
"baseUrl": ".",
"resolveJsonModule": true,
"allowJs": true,
"esModuleInterop": true,
Expand All @@ -14,21 +13,25 @@
"noImplicitAny": true,
"skipLibCheck": true,
"paths": {
"@news-api/*": ["graphql/datasources/news-api/*"],
"@open-trivia-api/*": ["graphql/datasources/open-trivia-api/*"],
"@tmdb-api/*": ["graphql/datasources/the-movie-db-api/*"],
"@generated-types": ["generated/graphql.ts"],
"@types": ["types/index.ts"],
"@errors": ["graphql/errors"],
"@/*": ["*"]
"@news-api/*": ["./src/graphql/datasources/news-api/*"],
"@open-trivia-api/*": ["./src/graphql/datasources/open-trivia-api/*"],
"@tmdb-api/*": ["./src/graphql/datasources/the-movie-db-api/*"],
"@generated-types": ["./src/generated/graphql.ts"],
"@types": ["./src/types/index.ts"],
"@errors": ["./src/graphql/errors"],
"@/*": ["./src/*"]
}
},
"exclude": [
"__test__",
"node_modules",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"jest.config.js",
"coverage",
"build",
"jest-*.js"
"jest-*.js",
"static",
"docs"
]
}

0 comments on commit 09a6c22

Please sign in to comment.