From 3517c0fa4161038b6a8845907bc049c2d12fb0bf Mon Sep 17 00:00:00 2001 From: Akira Hayashi Date: Mon, 17 Jun 2024 22:00:31 +0900 Subject: [PATCH 1/2] Reproduce runtime error --- .github/workflows/check.yaml | 7 +++++-- Makefile | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 7dbf529..b877a6b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -21,11 +21,14 @@ jobs: node-version-file: '.node-version' cache: 'pnpm' - - name: Install dependencies - run: make install + - name: Install dependencies & build application + run: make - name: Lint & format run: make lint - name: Run tests run: make test + + - name: Confirm no error + run: make version diff --git a/Makefile b/Makefile index 0ee651b..71b5d83 100644 --- a/Makefile +++ b/Makefile @@ -29,3 +29,6 @@ lint: format: pnpm format + +version: + pnpm exec node $(BUILD_DIR)/index.js --version From aae0c9dc2da0c964cb1c9d4ddd78aeb4b2f1e420 Mon Sep 17 00:00:00 2001 From: Akira Hayashi Date: Mon, 17 Jun 2024 22:04:21 +0900 Subject: [PATCH 2/2] Import `dayjs` plugins as ESmodule to resolve runtime error --- src/cost.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cost.ts b/src/cost.ts index 9046427..bb70440 100644 --- a/src/cost.ts +++ b/src/cost.ts @@ -1,7 +1,7 @@ import AWS from 'aws-sdk'; import dayjs from 'dayjs'; -import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'; -import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'; +import isSameOrAfter from 'dayjs/plugin/isSameOrAfter.js'; +import isSameOrBefore from 'dayjs/plugin/isSameOrBefore.js'; dayjs.extend(isSameOrAfter); dayjs.extend(isSameOrBefore); import { AWSConfig } from './config';