From d2a87e65aef30f9e33ff1da9413045a9a8c9555d Mon Sep 17 00:00:00 2001 From: Bruno Perel Date: Wed, 7 Feb 2024 14:34:04 +0100 Subject: [PATCH] WIP --- apps/dumili | 2 +- apps/web/package.json | 1 - apps/web/pnpm-lock.yaml | 17 ------------ packages/api/index.ts | 8 +++--- packages/api/nodemon.json | 12 ++++++--- packages/api/services/bookcase/order/index.ts | 3 +-- packages/api/services/collection/user/util.ts | 2 +- packages/api/tsconfig.json | 4 +-- packages/prisma-clients/.prettierrc.js | 5 ---- .../prisma-clients}/.prettierrc.json | 0 packages/prisma-clients/package.json | 5 +++- packages/prisma-clients/pnpm-lock.yaml | 26 +++++++++++++++++++ packages/socket.io-client-services/index.ts | 2 +- packages/types/exclude.ts | 2 +- 14 files changed, 48 insertions(+), 41 deletions(-) delete mode 100644 packages/prisma-clients/.prettierrc.js rename {apps/web => packages/prisma-clients}/.prettierrc.json (100%) diff --git a/apps/dumili b/apps/dumili index 86cd8b197..373e0eee8 160000 --- a/apps/dumili +++ b/apps/dumili @@ -1 +1 @@ -Subproject commit 86cd8b1973c88068d39a632e5e0aaf28335f3f8c +Subproject commit 373e0eee8c4768d39dcac1e574471b4bd609be8f diff --git a/apps/web/package.json b/apps/web/package.json index 0f2e72b1d..8559b7fc1 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -71,7 +71,6 @@ "eslint-plugin-vue": "^9.20.1", "histoire": "^0.17.9", "prettier": "^3.2.4", - "prettier-plugin-prisma": "^5.0.0", "rollup-plugin-typescript-paths": "^1.5.0", "sass": "^1.70.0", "typescript": "^5.3.3", diff --git a/apps/web/pnpm-lock.yaml b/apps/web/pnpm-lock.yaml index fa1088e56..ed3094d4b 100644 --- a/apps/web/pnpm-lock.yaml +++ b/apps/web/pnpm-lock.yaml @@ -166,9 +166,6 @@ devDependencies: prettier: specifier: ^3.2.4 version: 3.2.4 - prettier-plugin-prisma: - specifier: ^5.0.0 - version: 5.0.0(prettier@3.2.4) rollup-plugin-typescript-paths: specifier: ^1.5.0 version: 1.5.0(typescript@5.3.3) @@ -1118,10 +1115,6 @@ packages: resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} dev: false - /@prisma/prisma-schema-wasm@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584: - resolution: {integrity: sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA==} - dev: true - /@rollup/plugin-typescript@11.1.6(typescript@5.3.3): resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} engines: {node: '>=14.0.0'} @@ -5153,16 +5146,6 @@ packages: fast-diff: 1.3.0 dev: true - /prettier-plugin-prisma@5.0.0(prettier@3.2.4): - resolution: {integrity: sha512-jTJV04D9+yF7ziOOMs7CJe4ijgAH7DEGjt0SAWAToGNRy1H6BEhvcKA2UQH6gC6KVW5zeeOSAvsoiDDTt9oKXg==} - engines: {node: '>=14', npm: '>=8'} - peerDependencies: - prettier: '>=2 || >=3' - dependencies: - '@prisma/prisma-schema-wasm': 4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584 - prettier: 3.2.4 - dev: true - /prettier@3.2.4: resolution: {integrity: sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==} engines: {node: '>=14'} diff --git a/packages/api/index.ts b/packages/api/index.ts index 9bd39c84a..061f0df0d 100644 --- a/packages/api/index.ts +++ b/packages/api/index.ts @@ -1,5 +1,3 @@ -import "module-alias/register"; - import * as Sentry from "@sentry/node"; import { instrument } from "@socket.io/admin-ui"; import dotenv from "dotenv"; @@ -8,10 +6,10 @@ import { Server } from "socket.io"; import { SessionUser } from "~dm-types/SessionUser"; -import auth from "./services/auth"; +import auth from "./services/auth/index"; import { OptionalAuthMiddleware } from "./services/auth/util"; -import bookcase from "./services/bookcase"; -import bookstores from "./services/bookstores"; +import bookcase from "./services/bookcase/index"; +import bookstores from "./services/bookstores/index"; import coa from "./services/coa"; import collection from "./services/collection"; import coverId from "./services/cover-id"; diff --git a/packages/api/nodemon.json b/packages/api/nodemon.json index cf08ecf9d..ca6650743 100644 --- a/packages/api/nodemon.json +++ b/packages/api/nodemon.json @@ -1,6 +1,10 @@ { - "ignore": ["node_modules"], - "watch": ["."], - "exec": "ts-node -r tsconfig-paths/register index.ts", + "ignore": [ + "node_modules" + ], + "watch": [ + "." + ], + "exec": "ts-node --esm -r tsconfig-paths/register index.ts", "ext": "ts" -} +} \ No newline at end of file diff --git a/packages/api/services/bookcase/order/index.ts b/packages/api/services/bookcase/order/index.ts index 1a1ffc049..40886bdc5 100644 --- a/packages/api/services/bookcase/order/index.ts +++ b/packages/api/services/bookcase/order/index.ts @@ -1,10 +1,9 @@ import { Socket } from "socket.io"; -import { dmExtends } from "~prisma-clients/extended"; +import prismaDm from "~prisma-clients/extended/dm.extends"; import Events from "../types"; import { checkValidBookcaseUser } from "../util"; -const prismaDm = dmExtends.default; export default (socket: Socket) => { socket.on("getBookcaseOrder", async (username, callback) => { diff --git a/packages/api/services/collection/user/util.ts b/packages/api/services/collection/user/util.ts index 61e8905c9..9585e5a9b 100644 --- a/packages/api/services/collection/user/util.ts +++ b/packages/api/services/collection/user/util.ts @@ -8,7 +8,7 @@ interface ScopedError { selector: string; } -export type ScopedErrorDetails<> = { +export type ScopedErrorDetails = { message: ScopedError["message"]; selector: ScopedError["selector"]; }; diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 29a2c2c90..463e02f27 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "baseUrl": ".", - "module": "ESNext", - "target": "es2020", + "module": "commonjs", + "target": "es2018", "lib": ["ESNext"], "strict": true, "esModuleInterop": true, diff --git a/packages/prisma-clients/.prettierrc.js b/packages/prisma-clients/.prettierrc.js deleted file mode 100644 index ba8f56897..000000000 --- a/packages/prisma-clients/.prettierrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: [ - require.resolve("prettier-plugin-prisma"), - ], -}; \ No newline at end of file diff --git a/apps/web/.prettierrc.json b/packages/prisma-clients/.prettierrc.json similarity index 100% rename from apps/web/.prettierrc.json rename to packages/prisma-clients/.prettierrc.json diff --git a/packages/prisma-clients/package.json b/packages/prisma-clients/package.json index a48932958..f9c4cfe55 100644 --- a/packages/prisma-clients/package.json +++ b/packages/prisma-clients/package.json @@ -8,13 +8,16 @@ "prisma:pull": "ls schemas/*.prisma | while read -r schema; do pnpx prisma db pull --schema=$schema; done", "dev": "docker compose -f docker-compose-dev.yml up --force-recreate -d && bash wait-until-db-ready.bash", "generate": "ls schemas/*.prisma | while read -r schema; do pnpx prisma generate --schema=$schema; done && rm -rf dist", - "build": "pnpm run generate && ./node_modules/.pnpm/node_modules/.bin/tsc" + "build": "pnpm run generate && ./node_modules/.pnpm/node_modules/.bin/tsc", + "lint": "prettier -w schemas" }, "dependencies": { "@prisma/client": "^5.9.1", "prisma": "^5.9.1" }, "devDependencies": { + "prettier": "^3.2.5", + "prettier-plugin-prisma": "^5.0.0", "ts-node": "^10.9.2" } } \ No newline at end of file diff --git a/packages/prisma-clients/pnpm-lock.yaml b/packages/prisma-clients/pnpm-lock.yaml index 6d9504f85..eb4fd4acc 100644 --- a/packages/prisma-clients/pnpm-lock.yaml +++ b/packages/prisma-clients/pnpm-lock.yaml @@ -13,6 +13,12 @@ dependencies: version: 5.9.1 devDependencies: + prettier: + specifier: ^3.2.5 + version: 3.2.5 + prettier-plugin-prisma: + specifier: ^5.0.0 + version: 5.0.0(prettier@3.2.5) ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@20.11.9)(typescript@5.3.3) @@ -87,6 +93,10 @@ packages: '@prisma/debug': 5.9.1 dev: false + /@prisma/prisma-schema-wasm@4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584: + resolution: {integrity: sha512-JFdsnSgBPN8reDTLOI9Vh/6ccCb2aD1LbY/LWQnkcIgNo6IdpzvuM+qRVbBuA6IZP2SdqQI8Lu6RL2P8EFBQUA==} + dev: true + /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} dev: true @@ -137,6 +147,22 @@ packages: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: true + /prettier-plugin-prisma@5.0.0(prettier@3.2.5): + resolution: {integrity: sha512-jTJV04D9+yF7ziOOMs7CJe4ijgAH7DEGjt0SAWAToGNRy1H6BEhvcKA2UQH6gC6KVW5zeeOSAvsoiDDTt9oKXg==} + engines: {node: '>=14', npm: '>=8'} + peerDependencies: + prettier: '>=2 || >=3' + dependencies: + '@prisma/prisma-schema-wasm': 4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584 + prettier: 3.2.5 + dev: true + + /prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + engines: {node: '>=14'} + hasBin: true + dev: true + /prisma@5.9.1: resolution: {integrity: sha512-Hy/8KJZz0ELtkw4FnG9MS9rNWlXcJhf98Z2QMqi0QiVMoS8PzsBkpla0/Y5hTlob8F3HeECYphBjqmBxrluUrQ==} engines: {node: '>=16.13'} diff --git a/packages/socket.io-client-services/index.ts b/packages/socket.io-client-services/index.ts index b83a3042f..aa9da5902 100644 --- a/packages/socket.io-client-services/index.ts +++ b/packages/socket.io-client-services/index.ts @@ -1,8 +1,8 @@ import { CacheOptions } from "axios-cache-interceptor"; import { io, Socket } from "socket.io-client"; -import { AllButLast } from "socket.io-client/build/esm/socket"; import { ref } from "vue"; +type AllButLast = T extends [...infer H, infer _L] ? H : any[] type Last = T extends [...infer _I, infer L] ? L : never; export type LastParameter unknown> = Last< diff --git a/packages/types/exclude.ts b/packages/types/exclude.ts index 947040e9e..18ec98ee4 100644 --- a/packages/types/exclude.ts +++ b/packages/types/exclude.ts @@ -1,6 +1,6 @@ export const exclude = ( object: Type | null, - key: Key + key: Key, ): Omit | null => { if (!object) { return object;