From 88ab55aa4882cbf229bc6c53531f37736a16cf80 Mon Sep 17 00:00:00 2001 From: Aseer KT Date: Wed, 21 Aug 2024 14:35:32 +0530 Subject: [PATCH] fix: common package commonjs exports --- .github/workflows/ec2-cd.yml | 5 ++++- common/package.json | 15 +++++++++++++++ common/tsconfig.json | 13 +++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 common/tsconfig.json diff --git a/.github/workflows/ec2-cd.yml b/.github/workflows/ec2-cd.yml index 1e84f63..2da7039 100644 --- a/.github/workflows/ec2-cd.yml +++ b/.github/workflows/ec2-cd.yml @@ -56,7 +56,10 @@ jobs: uses: actions/download-artifact@v4 with: name: mchat_build - + + - name: Install packages + run: pnpm i + - name: Restart application run: pm2 restart mchat diff --git a/common/package.json b/common/package.json index 07e3bfc..2f01369 100644 --- a/common/package.json +++ b/common/package.json @@ -1,8 +1,23 @@ { "name": "common", "version": "1.0.0", + "scripts": { + "build": "tsc" + }, "dependencies": { "drizzle-orm": "^0.31.2", "socket.io": "^4.7.5" + }, + "exports": { + "./tables": { + "import": "./tables/index.ts", + "types": "./tables/index.ts", + "require": "./dist/tables/index.js" + }, + "./socket": { + "import": "./socket/index.ts", + "types": "./socket/index.ts", + "require": "./dist/socket/index.js" + } } } \ No newline at end of file diff --git a/common/tsconfig.json b/common/tsconfig.json new file mode 100644 index 0000000..89ee5f7 --- /dev/null +++ b/common/tsconfig.json @@ -0,0 +1,13 @@ +{ + "include": ["socket", "tables"], + "compilerOptions": { + "target": "es6", + "module": "CommonJS", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist", + "resolveJsonModule": true + } +}