From 363838fc9efb9d262024e15dbf738a04a5e0ed52 Mon Sep 17 00:00:00 2001 From: LiaoLiao Date: Sat, 21 Sep 2024 23:57:54 +0800 Subject: [PATCH] ci: support esm build --- .github/workflows/publish.yaml | 9 +++++++-- packages/redis/tsconfig.esm.json | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 packages/redis/tsconfig.esm.json diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 10bf790..c227b91 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -18,8 +18,13 @@ jobs: architecture: x64 registry-url: 'https://registry.npmjs.org' - run: pnpm install --frozen-lockfile - - run: pnpm -r run lint - - run: pnpm -r run build + - run: pnpm -F "@liaoliaots/nestjs-redis" run lint + - name: Build for CJS + run: pnpm -F "@liaoliaots/nestjs-redis" run build + - name: Build for ESM + run: | + npm pkg set type=module + pnpm -F "@liaoliaots/nestjs-redis" exec tsc --project tsconfig.esm.json && tsc-alias -p tsconfig.esm.json # - run: pnpm -r run publish # env: # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/packages/redis/tsconfig.esm.json b/packages/redis/tsconfig.esm.json new file mode 100644 index 0000000..b05431e --- /dev/null +++ b/packages/redis/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["test", "**/*spec.ts"], + "compilerOptions": { + "outDir": "dist/esm" + } +}