Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: https://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Set default charset
charset = utf-8

# 2 space indentation (default)
indent_style = space
indent_size = 2

# 2 space indentation (JS and JSX and TS files)
[*.{js,jsx,ts}]
indent_size = 2

# Trim trailing whitespace
trim_trailing_whitespace = true

# Max line length
max_line_length = 150
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

53 changes: 53 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
version: 2
updates:
# deps
- package-ecosystem: npm
target-branch: 'master'
schedule:
interval: weekly
allow:
- dependency-type: production
directory: /
commit-message:
prefix: 'deps'
groups:
map-colonies:
patterns:
- '@map-colonies/*'
opentelemetry:
patterns:
- '@opentelemetry/*'
patch:
update-types:
- patch
# dev-deps
- package-ecosystem: npm
schedule:
interval: weekly
allow:
- dependency-type: development
directory: /
commit-message:
prefix: 'devdeps'
groups:
map-colonies:
patterns:
- '@map-colonies/*'
opentelemetry:
patterns:
- '@opentelemetry/*'
types:
patterns:
- '@types/*'
dev-patch:
update-types:
- patch

# github deps
- package-ecosystem: github-actions
schedule:
interval: weekly
commit-message:
prefix: 'ci'
directory: '/'
16 changes: 16 additions & 0 deletions .github/workflows/auto-author-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: PR Author Auto Assign

on:
pull_request_target:
types: [opened, reopened]

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/auto-author-assign@v2.1.1
with:
repo-token: ${{ secrets.GH_PAT }}
102 changes: 61 additions & 41 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -1,65 +1,82 @@
name: pull_request

on: [pull_request]
on: pull_request

permissions:
contents: read
pull-requests: read

env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: postgres
DB_USERNAME: postgres
DB_PASSWORD: postgres
# DB_SCHEMA: public

jobs:
eslint:
name: Run eslint
name: Run TS Project eslint
runs-on: ubuntu-latest

strategy:
matrix:
node: [24.x]

steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Check out TS Project Git repository
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v1
- name: Init Nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1
with:
node-version: 16

- name: Install dependencies
run: npm ci
node-version: ${{ matrix.node }}

- name: Run linters
uses: wearerequired/lint-action@v1
- name: Run TS Project linters
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }}
# Enable linters
eslint: true
prettier: true
eslint_extensions: ts
tsc: true

openapi-lint:
name: Run OpenAPI lint Check
runs-on: ubuntu-latest

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v6

- name: Init Nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1

- name: OpenAPI Lint Checks
uses: nwestfall/openapi-action@v1.0.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
file: ./openapi3.yaml
run: npx @redocly/cli lint --format=github-actions openapi3.yaml

security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

tests:
name: Run Tests
runs-on: ubuntu-latest
container: node:16

services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:12
# Provide the password for postgres
image: postgres:15
env:
POSTGRES_PASSWORD: 1234
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres
Comment on lines +75 to 77

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note:
You can add top-level ENVs and reference them.
See example here

# Set health checks to wait until postgres has started
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -68,24 +85,27 @@ jobs:

strategy:
matrix:
node: [14.x, 16.x]
node: [24.x]

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v1
- name: Init Nodejs
uses: MapColonies/shared-workflows/actions/init-npm@init-npm-v1
with:
node-version: ${{ matrix.node }}

- name: Install Node.js dependencies
run: npm ci

- name: Run tests
run: npm run test
env:
DB_HOST: localhost
DB_PASSWORD: postgres

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: always()
with:
name: Test Reporters
path: reports/**
name: Test Reporters Node-${{ matrix.node }}
path: |
html/**
coverage/**
21 changes: 21 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.GH_PAT }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,13 @@ jest_html_reporters.html
reports

/**/local.json

*.tar
*.zip

# husky runtime files
.husky/_

# vitest html reporter output
html
helm/local.yaml
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit ${1}
6 changes: 6 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0);
}
const husky = (await import('husky')).default;
console.log(husky());
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx pretty-quick --staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v24
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ tsbuildconfig.json
tsconfig.json
node_modules
*.html
html
helm
reports
33 changes: 0 additions & 33 deletions .redocly.yaml

This file was deleted.

8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM node:16 as build
FROM node:24 AS build

WORKDIR /tmp/buildApp

COPY ./package*.json ./
COPY .husky/ .husky/

RUN npm install
COPY . .
RUN npm run build

FROM node:16.14.2-alpine3.14 as production
FROM node:24.10.0-alpine3.22 AS production

RUN apk add dumb-init

Expand All @@ -18,6 +19,7 @@ ENV SERVER_PORT=8080
WORKDIR /usr/src/app

COPY --chown=node:node package*.json ./
COPY .husky/ .husky/

RUN npm ci --only=production

Expand All @@ -26,4 +28,4 @@ COPY --chown=node:node ./config ./config

USER node
EXPOSE 8080
CMD ["dumb-init", "node", "--max_old_space_size=512", "./index.js"]
CMD ["dumb-init", "node", "--max_old_space_size=512", "--import", "./instrumentation.mjs", "./index.js"]
Loading
Loading