From 8c97c41e91846d67ea7cd3adcf890b37c256ff6d Mon Sep 17 00:00:00 2001 From: trevor-anderson Date: Tue, 26 Mar 2024 11:52:35 -0400 Subject: [PATCH 1/6] build(docker): changed env_file name to '.api.dev.env' --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 66e9ef8..08f24a8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -16,7 +16,7 @@ services: ports: - "8080:8080" env_file: - - .env.dev + - .api.dev.env environment: AWS_ACCESS_KEY_ID: local AWS_SECRET_ACCESS_KEY: local From 8681bc9e0d172d4945f70cdb7895c7b6ccb63582 Mon Sep 17 00:00:00 2001 From: trevor-anderson Date: Tue, 26 Mar 2024 11:53:12 -0400 Subject: [PATCH 2/6] docs: add misc comment documenting created tags --- .github/workflows/deploy.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 902cac5..dbba07e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -29,6 +29,11 @@ jobs: # Note: The above makes "outputs.registry" unavailable in any subsequent jobs. - name: Build and Push Image+Tags + # IMAGE TAGS: + # 1. commit sha (always added) + # 2. release tag (if release/pre-release) + # 3. env tag (if release: "prod", anything else: "staging") + # 4. relative pointer (if release: "latest", anything else: "next") run: | IMAGE_TAGS=( "${{ github.sha }}" ) From 7210346bd5cdb7f609f47e3b19edb8c887ff201d Mon Sep 17 00:00:00 2001 From: trevor-anderson Date: Tue, 26 Mar 2024 11:53:40 -0400 Subject: [PATCH 3/6] fix: add '.js' extensions to local imports --- src/lib/googleOAuth2Client/helpers.ts | 2 +- src/lib/googleOAuth2Client/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/googleOAuth2Client/helpers.ts b/src/lib/googleOAuth2Client/helpers.ts index b706fb5..f6f1cb4 100644 --- a/src/lib/googleOAuth2Client/helpers.ts +++ b/src/lib/googleOAuth2Client/helpers.ts @@ -10,7 +10,7 @@ import { } from "@nerdware/ts-string-helpers"; import { getTypeSafeError } from "@nerdware/ts-type-safety-utils"; import { AuthError } from "@/utils/httpErrors.js"; -import { googleOAuth2Client } from "./googleOAuth2Client"; +import { googleOAuth2Client } from "./googleOAuth2Client.js"; import type { TokenPayload as GoogleOAuth2IDTokenPayload } from "google-auth-library"; /** diff --git a/src/lib/googleOAuth2Client/index.ts b/src/lib/googleOAuth2Client/index.ts index 3119bee..39bf215 100644 --- a/src/lib/googleOAuth2Client/index.ts +++ b/src/lib/googleOAuth2Client/index.ts @@ -1,2 +1,2 @@ -export * from "./googleOAuth2Client"; -export * from "./helpers"; +export * from "./googleOAuth2Client.js"; +export * from "./helpers.js"; From 7b7697406f990b95cb58a54e7cc43e601bd931ac Mon Sep 17 00:00:00 2001 From: trevor-anderson Date: Tue, 26 Mar 2024 11:55:44 -0400 Subject: [PATCH 4/6] build(swc): add '--strip-leading-paths' to build script Without this flag, SWC was creating a build wherein the entrypoint file, `index.js`, was located at `dist/src/index.js`, rather than the intended location of `dist/index.js`. Adding this flag achieves the desired behavior. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4534e99..39b3493 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "start": "docker compose up", "start:dist": "API_COMMAND='node dist/index.js' docker compose up", "prebuild": "[ -d dist ] && rm -rf dist || true", - "build": "swc src --out-dir dist", + "build": "swc src --out-dir dist --strip-leading-paths", "lint": "eslint src", "postlint": "npm run test:types", "test": "vitest run", From 22d652e3646c8c99149a9e2573270112d62c5b44 Mon Sep 17 00:00:00 2001 From: trevor-anderson Date: Tue, 26 Mar 2024 12:11:37 -0400 Subject: [PATCH 5/6] build(docker): add configs to speed up compose up/down/restart 1. In `package.json`, add `--abort-on-container-exit` flag to the npm `start` script. This ensures the `dynamodb-local` container is also killed when the `api` container is stopped, which ensures the db container's port is released and made available for subsequent `up` invocations. Without this, the next `up` will fail bc the port will be unavailable (unless additional action has been taken to free up the port). 2. In `package.json`, change the `start:dist` script to use the `start` script so it doesn't have to repeat the long `--abort-on-container-exit` docker compose flag. 3. In `docker-compose.yaml`, add `stop_grace_period: 2s` to the `api` container's configs. This overrides the default of `10s`, which is unnecessarily long and slows down container killing/restart. --- docker-compose.yaml | 1 + package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 08f24a8..899a7da 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,6 +22,7 @@ services: AWS_SECRET_ACCESS_KEY: local DYNAMODB_ENDPOINT: "http://dynamodb-local:8000" tty: true + stop_grace_period: 2s # default is 10s dynamodb-local: container_name: dynamodb-local diff --git a/package.json b/package.json index 39b3493..d2ae3e0 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ }, "type": "module", "scripts": { - "start": "docker compose up", - "start:dist": "API_COMMAND='node dist/index.js' docker compose up", + "start": "docker compose up --abort-on-container-exit", + "start:dist": "API_COMMAND='node dist/index.js' && npm start", "prebuild": "[ -d dist ] && rm -rf dist || true", "build": "swc src --out-dir dist --strip-leading-paths", "lint": "eslint src", From 66716297c306aa933c7dde0dbe304fab3a7b8d56 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 26 Mar 2024 16:20:49 +0000 Subject: [PATCH 6/6] chore(release): version 2.1.1-next.1 [skip ci] ## [2.1.1-next.1](https://github.com/Nerdware-LLC/fixit-api/compare/v2.1.0...v2.1.1-next.1) (2024-03-26) ### Bug Fixes * add '.js' extensions to local imports ([7210346](https://github.com/Nerdware-LLC/fixit-api/commit/7210346bd5cdb7f609f47e3b19edb8c887ff201d)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8775458..0377cd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. --- +## [2.1.1-next.1](https://github.com/Nerdware-LLC/fixit-api/compare/v2.1.0...v2.1.1-next.1) (2024-03-26) + + +### Bug Fixes + +* add '.js' extensions to local imports ([7210346](https://github.com/Nerdware-LLC/fixit-api/commit/7210346bd5cdb7f609f47e3b19edb8c887ff201d)) + # [2.1.0](https://github.com/Nerdware-LLC/fixit-api/compare/v2.0.1...v2.1.0) (2024-03-24) diff --git a/package-lock.json b/package-lock.json index defa30d..a570aea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fixit-api", - "version": "2.1.0", + "version": "2.1.1-next.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fixit-api", - "version": "2.1.0", + "version": "2.1.1-next.1", "license": "LicenseRef-LICENSE", "dependencies": { "@apollo/server": "^4.10.1", diff --git a/package.json b/package.json index d2ae3e0..78afd46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fixit-api", - "version": "2.1.0", + "version": "2.1.1-next.1", "description": "Fixit API services built on NodeJS and Apollo GraphQL.", "author": { "name": "Trevor Anderson",