diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index 052c188b..2580693a 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/apps/admin/tsconfig.json b/apps/admin/tsconfig.json index 4c535ffd..20f61515 100644 --- a/apps/admin/tsconfig.json +++ b/apps/admin/tsconfig.json @@ -1,25 +1,11 @@ { - "compilerOptions": { - "jsx": "react", - "module": "nodenext", - "moduleResolution": "nodenext", - "declaration": true, - "removeComments": true, - "allowSyntheticDefaultImports": true, - "target": "es6", - "lib": [ - "esnext" - ], - "sourceMap": true, - "outDir": "dist", - "skipLibCheck": true, - "esModuleInterop": true - }, - "exclude": [ - "node_modules", - "src/**/theme.bundle.js" - ], + "extends": "@celluloid/config/tsconfig/react.json", "include": [ - "src" + "**/*.ts", + "**/*.tsx", + "tsup.config.ts" + ], + "exclude": [ + "node_modules" ] } diff --git a/apps/backend/package.json b/apps/backend/package.json index 46f7c999..ee4607fb 100644 --- a/apps/backend/package.json +++ b/apps/backend/package.json @@ -4,9 +4,9 @@ "version": "2.0.1", "type": "module", "scripts": { - "build": "esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --outdir=dist --sourcemap", + "build": "tsup", "dev": "tsx watch --clear-screen=false src ", - "start": "node dist", + "start": "node dist/index", "test-start": "start-server-and-test 'node dist/index' 2021" }, "dependencies": { @@ -22,6 +22,8 @@ "express": "^4.18.2", "express-session": "^1.17.3", "lodash": "^4.17.21", + "passport": "^0.6.0", + "passport-local": "^1.0.0", "redis": "^4.6.10", "swagger-ui-express": "^5.0.0", "trpc-openapi": "^1.2.0", @@ -30,11 +32,14 @@ }, "devDependencies": { "@types/express": "^4.17.17", + "@types/node": "^20.8.2", "@types/swagger-ui-express": "^4.1.3", "@types/uuid": "^9.0.4", - "esbuild": "^0.19.4", "start-server-and-test": "^2.0.0", + "tslib": "^2.6.2", + "tsup": "^7.2.0", "tsx": "^3.12.10", + "typescript": "^5.2.2", "wait-port": "^1.0.4" } } diff --git a/apps/backend/src/passport.ts b/apps/backend/src/passport.ts index 74095fed..0a8a959f 100644 --- a/apps/backend/src/passport.ts +++ b/apps/backend/src/passport.ts @@ -53,7 +53,8 @@ const loginStrategy = new LocalStrategy( const user = await prisma.user.findUnique({ where: { - OR: [{ email: login }, { username: login, }] + //OR: [{ email: login }, { username: login, }] + email: login } }); diff --git a/apps/backend/tsconfig.json b/apps/backend/tsconfig.json index e1e872ad..847685fc 100644 --- a/apps/backend/tsconfig.json +++ b/apps/backend/tsconfig.json @@ -1,23 +1,11 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "esModuleInterop": true, - "composite": true, - "strict": true, - "outDir": "dist" - }, + "extends": "@celluloid/config/tsconfig/node16.json", "include": [ - "src" + "**/*.ts", + "**/*.tsx", + "tsup.config.ts" ], "exclude": [ "node_modules" - ], - "references": [ - { - "path": "../../packages/trpc" - } ] } diff --git a/apps/admin/tsup.config.ts b/apps/backend/tsup.config.ts similarity index 100% rename from apps/admin/tsup.config.ts rename to apps/backend/tsup.config.ts diff --git a/packages/config/tsconfig/react.json b/packages/config/tsconfig/react.json index 08fceff4..9a8dbb5d 100644 --- a/packages/config/tsconfig/react.json +++ b/packages/config/tsconfig/react.json @@ -10,7 +10,7 @@ "strict": false, "forceConsistentCasingInFileNames": true, "noEmit": true, - "incremental": true, + "incremental": false, "esModuleInterop": true, "module": "esnext", "resolveJsonModule": true, diff --git a/packages/prisma/package.json b/packages/prisma/package.json index 26cf51f1..0ebaecbd 100644 --- a/packages/prisma/package.json +++ b/packages/prisma/package.json @@ -5,11 +5,12 @@ "repository": "http://github.com/celluloid-edu/celluloid", "author": "Younes Benaomar ", "license": "MIT", + "type": "module", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "files": [ - "src/index.ts" + "dist" ], "prisma": { "schema": "schema.prisma", @@ -38,7 +39,6 @@ "@types/dotenv": "^6.0.0", "copyfiles": "^2.4.1", "dotenv-cli": "^7.2.1", - "esbuild": "^0.19.4", "eslint": "^8.12.0", "prisma": "^5.3.1", "rimraf": "^5.0.1", diff --git a/packages/prisma/src/index.ts b/packages/prisma/src/index.ts index 57ddbf84..02a3c76e 100644 --- a/packages/prisma/src/index.ts +++ b/packages/prisma/src/index.ts @@ -1,4 +1,4 @@ -import { PrismaClient } from "@prisma/client"; +import PrismaModule, { PrismaClient } from "@prisma/client"; declare global { @@ -17,3 +17,5 @@ export const prisma = global.prisma || new PrismaClient({ if (process.env.NODE_ENV !== "production") global.prisma = prisma; export * from "@prisma/client"; + +export default PrismaModule; diff --git a/packages/trpc/package.json b/packages/trpc/package.json index 6281c66e..5ff2580c 100644 --- a/packages/trpc/package.json +++ b/packages/trpc/package.json @@ -2,13 +2,16 @@ "name": "@celluloid/trpc", "private": true, "version": "2.0.1", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "type": "module", - "main": "dist/index.js", "files": [ - "src/index.ts" + "dist" ], "scripts": { - "build": "esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --outdir=dist --sourcemap", + "build": "tsup", + "build1": "esbuild src/index.ts --bundle --packages=external --platform=neutral --format=esm --outdir=dist --sourcemap", "dev": "esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --outdir=dist --sourcemap --watch" }, "dependencies": { @@ -24,7 +27,7 @@ }, "devDependencies": { "@types/uuid": "^9.0.4", - "esbuild": "^0.19.4", + "tsup": "^7.2.0", "tsx": "^3.12.10" } } diff --git a/packages/trpc/src/routers/project.ts b/packages/trpc/src/routers/project.ts index a9cdaf0a..e5c47f5f 100644 --- a/packages/trpc/src/routers/project.ts +++ b/packages/trpc/src/routers/project.ts @@ -1,5 +1,4 @@ -import { Prisma, UserRole } from '@celluloid/prisma'; -import { prisma } from "@celluloid/prisma" +import { Prisma, prisma, UserRole } from '@celluloid/prisma'; import { TRPCError } from '@trpc/server'; import { z } from 'zod'; diff --git a/packages/trpc/tsconfig.json b/packages/trpc/tsconfig.json index 35d13550..847685fc 100644 --- a/packages/trpc/tsconfig.json +++ b/packages/trpc/tsconfig.json @@ -1,15 +1,9 @@ { - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "esModuleInterop": true, - "composite": true, - "strict": true, - "outDir": "dist" - }, + "extends": "@celluloid/config/tsconfig/node16.json", "include": [ - "src" + "**/*.ts", + "**/*.tsx", + "tsup.config.ts" ], "exclude": [ "node_modules" diff --git a/packages/trpc/tsup.config.ts b/packages/trpc/tsup.config.ts new file mode 100644 index 00000000..27be5a77 --- /dev/null +++ b/packages/trpc/tsup.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from "tsup"; + +const isProduction = process.env.NODE_ENV === "production"; + +export default defineConfig({ + clean: true, + dts: true, + entry: ["src/index.ts"], + format: ["cjs", "esm"], + minify: isProduction, + sourcemap: true, +}); diff --git a/yarn.lock b/yarn.lock index cb4986f5..6f614580 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1837,7 +1837,6 @@ __metadata: "@types/dotenv": ^6.0.0 copyfiles: ^2.4.1 dotenv-cli: ^7.2.1 - esbuild: ^0.19.4 eslint: ^8.12.0 prisma: ^5.3.1 rimraf: ^5.0.1 @@ -1873,9 +1872,9 @@ __metadata: bcryptjs: ^2.4.3 change-case: ^4.1.2 dotenv: ^16.3.1 - esbuild: ^0.19.4 lodash: ^4.17.21 trpc-openapi: ^1.2.0 + tsup: ^7.2.0 tsx: ^3.12.10 uuid: ^9.0.1 zod: ^3.22.2 @@ -5392,6 +5391,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^20.8.2": + version: 20.8.2 + resolution: "@types/node@npm:20.8.2" + checksum: 3da73e25d821bfcdb7de98589027e08bb4848e55408671c4a83ec0341e124b5313a0b20e1e4b4eff1168ea17a86f622ad73fcb04b761abd77496b9a27cbd5de5 + languageName: node + linkType: hard + "@types/nodemailer-direct-transport@npm:*": version: 1.0.33 resolution: "@types/nodemailer-direct-transport@npm:1.0.33" @@ -7320,6 +7326,7 @@ __metadata: "@celluloid/trpc": "*" "@trpc/server": ^10.38.5 "@types/express": ^4.17.17 + "@types/node": ^20.8.2 "@types/swagger-ui-express": ^4.1.3 "@types/uuid": ^9.0.4 bcryptjs: ^2.4.3 @@ -7328,15 +7335,19 @@ __metadata: cookie-parser: ^1.4.6 cors: ^2.8.5 dotenv: ^16.3.1 - esbuild: ^0.19.4 express: ^4.18.2 express-session: ^1.17.3 lodash: ^4.17.21 + passport: ^0.6.0 + passport-local: ^1.0.0 redis: ^4.6.10 start-server-and-test: ^2.0.0 swagger-ui-express: ^5.0.0 trpc-openapi: ^1.2.0 + tslib: ^2.6.2 + tsup: ^7.2.0 tsx: ^3.12.10 + typescript: ^5.2.2 uuid: ^9.0.1 wait-port: ^1.0.4 zod: ^3.22.2 @@ -23566,7 +23577,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^2.0.0, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.2.0": +"tslib@npm:^2.0.0, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.2.0, tslib@npm:^2.6.2": version: 2.6.2 resolution: "tslib@npm:2.6.2" checksum: 329ea56123005922f39642318e3d1f0f8265d1e7fcb92c633e0809521da75eeaca28d2cf96d7248229deb40e5c19adf408259f4b9640afd20d13aecc1430f3ad @@ -23922,7 +23933,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.0.2, typescript@npm:^5.0.4": +"typescript@npm:^5.0.2, typescript@npm:^5.0.4, typescript@npm:^5.2.2": version: 5.2.2 resolution: "typescript@npm:5.2.2" bin: @@ -23942,7 +23953,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@^5.0.2#~builtin, typescript@patch:typescript@^5.0.4#~builtin": +"typescript@patch:typescript@^5.0.2#~builtin, typescript@patch:typescript@^5.0.4#~builtin, typescript@patch:typescript@^5.2.2#~builtin": version: 5.2.2 resolution: "typescript@patch:typescript@npm%3A5.2.2#~builtin::version=5.2.2&hash=1f5320" bin: