From a580ba2f8dab412b9a25e7fb646be17c6b139d09 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Fri, 23 Dec 2022 11:45:33 +0800 Subject: [PATCH 1/2] chore: switch build to esnext module type --- Dockerfile | 2 +- package.json | 1 + tsconfig.json | 4 ++-- tsconfig.module.json | 2 +- tsconfig.server.json | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3ecc3301..71332842 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:16 as build WORKDIR /usr/src/app # Do `npm ci` separately so we can cache `node_modules` # https://nodejs.org/en/docs/guides/nodejs-docker-webapp/ -COPY package.json package-lock.json . +COPY package.json package-lock.json ./ RUN npm clean-install COPY . . RUN npm run build:server diff --git a/package.json b/package.json index 9e927674..bcba3560 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "files": [ "dist" ], + "type": "module", "main": "dist/main/index.js", "module": "dist/module/index.js", "repository": "supabase/postgres-meta", diff --git a/tsconfig.json b/tsconfig.json index 21407433..d1f90076 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,11 +3,11 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "module": "CommonJS", + "module": "esnext", "outDir": "dist/main", "rootDir": "src/lib", "sourceMap": true, - "target": "ES2015", + "target": "esnext", "strict": true, diff --git a/tsconfig.module.json b/tsconfig.module.json index d424e626..4a9a446e 100644 --- a/tsconfig.module.json +++ b/tsconfig.module.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "ES2015", + "module": "esnext", "outDir": "dist/module" } } diff --git a/tsconfig.server.json b/tsconfig.server.json index 750cda7e..141c2ab3 100644 --- a/tsconfig.server.json +++ b/tsconfig.server.json @@ -3,10 +3,10 @@ "compilerOptions": { "declaration": true, "declarationMap": true, - "module": "CommonJS", + "module": "esnext", "outDir": "bin", "sourceMap": true, - "target": "ES2015", + "target": "esnext", "strict": true, From 0915af4b2b6a973abf8409328e5b69efda4c3c99 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Fri, 23 Dec 2022 12:30:08 +0800 Subject: [PATCH 2/2] chore: move jest config to package.json --- jest.config.js | 5 ----- package.json | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 jest.config.js diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 2bd7f337..00000000 --- a/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - testMatch: ['**/*.test.ts'] -} diff --git a/package.json b/package.json index bcba3560..e2c2336f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,13 @@ "node": ">=16", "npm": ">=8" }, + "jest": { + "preset": "ts-jest", + "testEnvironment": "node", + "testMatch": [ + "**/*.test.ts" + ] + }, "dependencies": { "@sinclair/typebox": "^0.25.1", "pg": "^8.7.1",