Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Add tbdex-pfi-exemplar
Browse files Browse the repository at this point in the history
  • Loading branch information
finn-block committed Jul 31, 2024
1 parent 860a4e1 commit 9b2de5a
Show file tree
Hide file tree
Showing 46 changed files with 8,638 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/pfi-exemplar-container-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: PFI Exemplar Container Image Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-image:
name: ${{ matrix.directory }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
include:
- directory: javascript/tbdex-pfi-exemplar
image: ghcr.io/tbd54566975/tbd-examples-tbdex-pfi-exemplar

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the container registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ matrix.image }}

- name: Build and push container image
uses: docker/build-push-action@94f8f8c2eec4bc3f1d78c1755580779804cb87b2 # v6.0.1
with:
context: ${{ matrix.directory }}
push: true
target: ${{ matrix.target }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
27 changes: 27 additions & 0 deletions javascript/tbdex-pfi-exemplar/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{

"setupTasks": [
{
"name": "Install Node dependencies",
"command": "npm install"
},
{
"name": "Install dbmate",
"command": "curl -fsSL -o /usr/local/bin/dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64 && chmod +x /usr/local/bin/dbmate"
},
{
"name": "prepare scripts",
"command": "chmod +x ./db/scripts/*"
}
],

"tasks" : {
"install": {
"name": "Install deps",
"command": "npm install"
}
}



}
22 changes: 22 additions & 0 deletions javascript/tbdex-pfi-exemplar/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
5 changes: 5 additions & 0 deletions javascript/tbdex-pfi-exemplar/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
npm-debug.log
docker-compose.yml
.DS_Store
.git
12 changes: 12 additions & 0 deletions javascript/tbdex-pfi-exemplar/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# environment info
ENV=
LOG_LEVEL=
HOST=
PORT=

# DB info
SEC_DB_HOST=
SEC_DB_PORT=
SEC_DB_USER=
SEC_DB_PASSWORD=
SEC_DB_NAME=
41 changes: 41 additions & 0 deletions javascript/tbdex-pfi-exemplar/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/** @type {import('eslint').ESLint.ConfigData} */
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion : 2022,
sourceType : 'module'
},
ignorePatterns: ['dist'],
plugins : ['@typescript-eslint'],
env : {
node : true,
es2022 : true
},
rules: {
'quotes': [
'error',
'single',
{ 'allowTemplateLiterals': true }
],
'indent' : ['error', 2, { 'SwitchCase': 1 }],
'no-unused-vars' : 'off',
'prefer-const' : 'off',
'@typescript-eslint/no-unused-vars' : [
'error',
{
'vars' : 'all',
'args' : 'after-used',
'ignoreRestSiblings' : true,
'argsIgnorePattern' : '^_',
'varsIgnorePattern' : '^_'
}
],
'@typescript-eslint/no-explicit-any' : 'off',
'@typescript-eslint/semi' : ['error', 'never'],
'no-trailing-spaces' : ['error'],
'@typescript-eslint/ban-ts-comment' : 'off',
'space-infix-ops' : ['warn']
}
}
9 changes: 9 additions & 0 deletions javascript/tbdex-pfi-exemplar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dist
node_modules/
.env
.DS_STORE
alice.json
issuer.json
pfi.json
DATASTORE
*.txt
5 changes: 5 additions & 0 deletions javascript/tbdex-pfi-exemplar/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"enable-source-maps": true,
"exit": true,
"spec": ["dist/test/**/*.spec.js"]
}
1 change: 1 addition & 0 deletions javascript/tbdex-pfi-exemplar/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org
1 change: 1 addition & 0 deletions javascript/tbdex-pfi-exemplar/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.3.1
14 changes: 14 additions & 0 deletions javascript/tbdex-pfi-exemplar/.tbd-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "TBDex PFI",
"tests": {
"pre": [
"npm install",
"wget https://github.com/amacneil/dbmate/releases/download/v1.12.1/dbmate-linux-amd64 && echo 36430799fa4a4265e05593adf6b5705339c8ddc1d0bcc94040f548c0304c5cf4 dbmate-linux-amd64 | sha256sum -c",
"chmod +x dbmate-linux-amd64",
"sudo mv dbmate-linux-amd64 /usr/bin/dbmate",
"./db/scripts/start-pg",
"./db/scripts/migrate"
],
"commands": ["npm run test:ci"]
}
}
19 changes: 19 additions & 0 deletions javascript/tbdex-pfi-exemplar/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Use the official Node.js image as the base image
FROM node:lts

# Set the working directory inside the container
WORKDIR /home/node/app

# Copy package.json and package-lock.json to the working directory
COPY --chown=node:node . /home/node/app/

# Install the application dependencies
RUN npm i

# Download and install dbmate
RUN curl -fsSL https://github.com/amacneil/dbmate/releases/download/v1.12.1/dbmate-linux-amd64 -o dbmate \
&& chmod +x dbmate \
&& mv dbmate /usr/local/bin

EXPOSE 9000
CMD [ "npm", "run", "server" ]
Loading

0 comments on commit 9b2de5a

Please sign in to comment.