diff --git a/package-lock.json b/package-lock.json index 33e0f71..7ed7687 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,6 @@ "remark-preset-lint-markdown-style-guide": "^5.1.3", "remark-preset-lint-recommended": "^6.1.3", "ts-node": "^10.9.1", - "tsc": "^2.0.4", "tsc-watch": "^6.0.4", "tsconfig-paths": "^4.2.0", "typescript": "^5.3.2" @@ -12756,15 +12755,6 @@ } } }, - "node_modules/tsc": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/tsc/-/tsc-2.0.4.tgz", - "integrity": "sha512-fzoSieZI5KKJVBYGvwbVZs/J5za84f2lSTLPYf6AGiIf43tZ3GNrI1QzTLcjtyDDP4aLxd46RTZq1nQxe7+k5Q==", - "dev": true, - "bin": { - "tsc": "bin/tsc" - } - }, "node_modules/tsc-watch": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/tsc-watch/-/tsc-watch-6.0.4.tgz", diff --git a/package.json b/package.json index 8d0fd8c..99ac644 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,7 @@ "name": "boilerplate-backend", "version": "1.0.0", "description": "The IT4C Boilerplate for backends", - "main": "build/index.js", - "type": "module", + "main": "build/index.ts", "repository": { "type": "git", "url": "git+https://github.com/IT4Change/boilerplate-backend.git" @@ -16,8 +15,14 @@ "url": "https://github.com/IT4Change/boilerplate-backend/issues" }, "scripts": { - "watch": "nodemon --watch './**/*.{ts,graphql}' --exec 'node --loader ts-node/esm' src/index.ts", - "dev": "tsc-watch --noClear --onSuccess \"npm run watch\"", + "build": "tsc", + "server": "node --loader ts-node/esm ./src/index.ts", + "server:dev": "npm run server", + "server:prod": "NODE_ENV=production npm run server", + "gdd": "TZ=UTC nodemon -w src --ext ts,pug,json,css --exec ts-node -r tsconfig-paths/register src/index.ts", + "watch2": "nodemon -w src --ext ts,pug,json,css --exec ts-node -r tsconfig-paths/register src/index.ts", + "watch": "nodemon --watch './**/*.{ts,graphql}' --exec 'node --no-warnings=ExperimentalWarning --loader ts-node/esm' src/index.ts", + "dev": "tsc-watch --noClear --onSuccess \"npm run watch\"", "test:lint": "npm run test:lint:eslint && npm run test:lint:remark", "test:lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx,.json,.yml,.yaml --max-warnings 0 --ignore-path .gitignore .", "test:lint:remark": "remark . --quiet --frail" @@ -53,7 +58,6 @@ "remark-preset-lint-markdown-style-guide": "^5.1.3", "remark-preset-lint-recommended": "^6.1.3", "ts-node": "^10.9.1", - "tsc": "^2.0.4", "tsc-watch": "^6.0.4", "tsconfig-paths": "^4.2.0", "typescript": "^5.3.2" diff --git a/src/graphql/schema.ts b/src/graphql/schema.ts index df2d0bb..d99378f 100644 --- a/src/graphql/schema.ts +++ b/src/graphql/schema.ts @@ -1,12 +1,8 @@ import path from 'path' -import { fileURLToPath } from 'url' import { GraphQLSchema } from 'graphql' import { buildSchema } from 'type-graphql' -const __filename = fileURLToPath(import.meta.url) -const __dirname = path.dirname(__filename) - export const schema = async (): Promise => { return buildSchema({ resolvers: [path.join(__dirname, 'resolvers', `!(*.spec).{ts,js}`)], diff --git a/tsconfig.json b/tsconfig.json index 15546e1..1c9aabb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "ESNext", "experimentalDecorators": true, "emitDecoratorMetadata": true, - "module": "ESNext", + "module": "commonjs", "moduleResolution": "node", "baseUrl": ".", "lib": ["ESNext"], @@ -14,8 +14,5 @@ "esModuleInterop": true, "strict": true, "skipLibCheck": true - }, - "ts-node": { - "experimentalSpecifierResolution": "node" } }