Skip to content

Commit

Permalink
Feature/monopuff (#74)
Browse files Browse the repository at this point in the history
* Initial commit

* React Integration

Base PoC rendering demo with React working.

* Geometry (#2)

* ok, basic painting to canvas size

* Mouse stuff (#3)

* something basic working

* Content editor (#4)

* add content editor
* rendering to second canvas
* split overlay selection rendering out from component into drawing utility
* remove unneeded logging

* Obscure overlay (#5)

* obscuring works

* Initial commit

* Node Setup (#1)

Basic node server accepting image uploads.

* Websockets

* real time updates are working

* Websockets

* yeah, real time updates

* ok, background is working now

* ugh forgot to branch

* Background Upload

* background uploads working

* Link to Background

Pass a link to update the background.

* linked backgrounds work now -- hurray (#8)

* Table Update

Table updates working.

* Table Update

Table updates are working - yay!

* Get state (#6)

* add state retrieval

* ok, restoring overlay now all good - yah - piano practice time (#10)

* frontend working

* backend working

* move public to after cors setup so images don't get tainted (#7)

* Reveal (#11)

* work around tainted canvas
* reveal works

* Fix variable canvas (#12)

* minor cleanup

* working towards proper overlay scaling

* cleanup

* Zoom (#8)

Handle viewport (zoom) in table state.

* Zoom

zooming works.

* Ci build (#9)

build with CI

* GitHub ci (#14)

Build with GitHub Actions.

* Play fixes (#15)

* Fix portrait images on wide display

* Fix overlay background

* Cleanup stuff (#17)

* builds on every push
* attempt to bump patch on merge

* fix ci (#18)

* set identity (#19)

* next version yo (#20)

* ok see if we can fix env vars (#21)

* fix env vars
* change name of testing workflow

* will perms help (#22)

* will perms help

* allow writing contents

* next version (#23)

* 0.0.7 (#24)

Should properly create a release branch

* Release/0.0.8 (#25)

* try specifying version

* Fixit (#26)

* ok try again

* lskjdflkjsdf (#27)

* Version vars (#28)

Trying to get actions sorted.

* Release/0.0.9 (#29)

* Release/0.0.10 (#30)

* 0.0.10

* Release/0.0.11 (#31)

* Release/0.0.12 (#32)

* simplify actions build just a little

* 0.0.13 (#37)

* try to fix combined api url
* closes #36

* 0.0.14 (#39)

* infer ws url for combined
* closes #38

* Release/0.0.15 (#41)

* Add opacity menu
* Add colour picker

* Release/0.0.16 (#42)

* Keep remote display awake if possible

* Landing (#43)

* Updated packages.
* Add landing page
* Add react router
* Add mui

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.18 (#45)

* Add lading page
* Add router for distinction between editor and display
* Big refactor for material design content editor
* Draw image for full-screen & contained

---------

Co-authored-by: micahg <[email protected]>

* 0.0.3 (#10)

* add token validation
* attempt automatic release branch creation

* 0.0.4

* Release/0.0.5 (#13)

Build docker image

---------

Co-authored-by: micahg <[email protected]>

* fix deps in ci (#14)

* 0.0.19 (#47)

* Auth0
* Docker images

---------

Co-authored-by: micahg <[email protected]>

* 0.0.20 (#48)

* 0.0.20
* cleanup auth config

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.21 (#49)

* Add ws url back

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.6 (#15)

* fix deps in ci
* Set audience dynamically

* Release/0.0.7 (#16)

* use envvar for audience

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.22 (#50)

* Fetch device code
* Device code token retrieved
* Add QR code
* Add WS auth

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.8 (#17)

* Add websocket validation

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.9 (#18)

* Fix error around noauth envvar

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.10 (#19)

* 0.0.10
* Fix big images on firestick

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.11 (#20)

* 0.0.11

* Clean up

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.23 (#51)

* Handle amazon silk reduced resolution
* Refactor authconfig and envconfig
* Update dev deps
* Don't reload all the environment data

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.24 (#52)

* Display reconnection and improve auth logic
* Fix zoom dimensions

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.25 (#53)

* Set file modification time to fix npm behavior
* fix auth issues

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.26 (#54)

* Don't clear overlay if it was sent by server

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.27 (#55)

* Wait for authClient to attempt auth (firefox)

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.28 (#56)

* restore wakelock

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.29 (#57)

* Add connect and auth config errors on remote display

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.12 (#24)

* 0.0.12

* add req logging and auth emulation for noauth
* mongoose models
* mongo mem server for testing
* viewport and bg to scene
* add state/tabletop
* input checking
* gracefully shutdown websockets
* add lint
* add websocket unit test
* add coverage

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.30 (#58)

* 0.0.30
* add scenes.
* use scene based assets.
* cleanup unused state

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.13 (#25)

* return updated copies of things.
* add information messages

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.31 (#59)

* display server information

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.32 (#60)

* 0.0.32

* add websocket error codes.

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.14 (#26)

* 0.0.14

* add improved socket connection errors.

* fix unit test to expect error message

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.15 (#27)

* 0.0.15

* test pv

---------

Co-authored-by: micahg <[email protected]>

* make the landing component less cumersome for desktop

* fake scenes.

* get rid of junk

* Release/0.0.16 (#29)

* 0.0.16

* handle noauth

* add todo for later cleanup

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.33 (#61)

* 0.0.33

* Fix silk scaling what a doozy
* fix unit tests and improve comments.
* handle local run a little more gracefully

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.34 (#63)

* 0.0.34

* fix: Dockerfile to reduce vulnerabilities (#62)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-DEBIAN12-LIBXPM-5927176
- https://snyk.io/vuln/SNYK-DEBIAN12-NGHTTP2-5953379
- https://snyk.io/vuln/SNYK-DEBIAN12-NGINX-5953391
- https://snyk.io/vuln/SNYK-DEBIAN12-TIFF-5934984
- https://snyk.io/vuln/SNYK-DEBIAN12-ZLIB-6008963

Co-authored-by: snyk-bot <[email protected]>

* work around silk scale for the overlay

* ok fix rendering glitches

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.17 (#34)

* 0.0.17

* fix: upgrade ws from 8.12.0 to 8.13.0 (#21)

Snyk has created this PR to upgrade ws from 8.12.0 to 8.13.0.

See this package in npm:
https://www.npmjs.com/package/ws

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade winston from 3.8.2 to 3.10.0 (#22)

Snyk has created this PR to upgrade winston from 3.8.2 to 3.10.0.

See this package in npm:
https://www.npmjs.com/package/winston

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @aws-sdk/client-s3 from 3.420.0 to 3.421.0 (#28)

Snyk has created this PR to upgrade @aws-sdk/client-s3 from 3.420.0 to 3.421.0.

See this package in npm:
https://www.npmjs.com/package/@aws-sdk/client-s3

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix body parser manually

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.18 (#45)

0.0.18

* fix: upgrade mongoose from 7.5.3 to 7.6.0 (#36)
* fix: upgrade @aws-sdk/client-s3 from 3.421.0 to 3.427.0 (#35)
* create and delete scenes
* fix: upgrade @aws-sdk/client-s3 from 3.421.0 to 3.427.0 (#37)
* fix: upgrade mongoose from 7.5.3 to 7.6.0 (#38)
* fix: upgrade winston from 3.10.0 to 3.11.0 (#39)
* fix: upgrade express-oauth2-jwt-bearer from 1.5.0 to 1.6.0 (#40)
* validate object id
* add image revisions

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.35 (#67)

* 0.0.35

* fix: package.json & package-lock.json to reduce vulnerabilities (#65)
* Add scene component
* add create and delete scene
* handle flipping between scenes
* add lint config
* Fix rendering glitches
* accept failure (allow any in eslint -- fix this later)

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.19 (#51)

* 0.0.19

* fix: upgrade @aws-sdk/client-s3 from 3.427.0 to 3.429.0 (#46)

Snyk has created this PR to upgrade @aws-sdk/client-s3 from 3.427.0 to 3.429.0.

See this package in npm:
https://www.npmjs.com/package/@aws-sdk/client-s3

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade mongoose from 7.6.0 to 7.6.3 (#47)

Snyk has created this PR to upgrade mongoose from 7.6.0 to 7.6.3.

See this package in npm:
https://www.npmjs.com/package/mongoose

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* refactor for new nomenclature

* fix failing unit tests

* fail definitively when oauth pem can't be fetched.

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.36 (#71)

* 0.0.36

Details image

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.37 (#75)

* Improved rendering speed with off-screen canvas (so much rework)
* typescripot web worker (so much less work than i thought -- thank you webpack)
* user-control rotation (no more auto-rotation based on image aspect ratio)

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.20 (#58)

* fix: upgrade @aws-sdk/client-s3 from 3.429.0 to 3.433.0 (#52)
* fix: upgrade mongoose from 7.6.3 to 7.6.4 (#53)
* feat: add angle to scene

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.38 (#78)

* fix: spelling
* fix: eslint
* fix: un-rotate canvas box reveal

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.21 (#59)

* fix: eslint prettier recommended fixes

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.39 (#79)

* 0.0.39

* fix: display opacity

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.40 (#89)

* 0.0.40

* feat/zoom (#88)
* feat: responsive canvas
* fix: package.json & package-lock.json to reduce vulnerabilities (#82)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-6144788

Co-authored-by: snyk-bot <[email protected]>

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* 0.0.41 (#90)

Co-authored-by: micahg <[email protected]>

* 0.0.42 (#96)

* Fixes #92 (#95)
* Fixes #91 (#97)
* Fixed #68 (this was actually fixed on #88)

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.43 (#100)

* 0.0.43

* fix: error displayed (#99)
* fix: delete scene after creation uploads fail
* fix: do not set current scene to the one you just deleted 😮‍💨
* fix: set content error on asset update failure
* fix: add success alert to scene update
* feature: scene upload progress (#101)
* fix: use upload progress indicators
* fix: don't reset scene to first in list of scenes on return to editor

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.44 (#103)

Fixes #77 (#102)
Fixes #94 (#104)

* Release/0.0.45 (#107)

feat: authenticate content

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.22 (#69)

* 0.0.22

* fix: upgrade mongoose from 7.6.4 to 7.6.6 (#61)

Snyk has created this PR to upgrade mongoose from 7.6.4 to 7.6.6.

See this package in npm:
https://www.npmjs.com/package/mongoose

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @aws-sdk/client-s3 from 3.433.0 to 3.456.0 (#60)

Snyk has created this PR to upgrade @aws-sdk/client-s3 from 3.433.0 to 3.456.0.

See this package in npm:
https://www.npmjs.com/package/@aws-sdk/client-s3

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade ws from 8.13.0 to 8.15.0 (#64)

Snyk has created this PR to upgrade ws from 8.13.0 to 8.15.0.

See this package in npm:
https://www.npmjs.com/package/ws

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* feat: add auth on public asset requests (#66)

* feat: add auth on public asset requests
* chore: add "heartbeat" to try to fix render glitching

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.23 (#70)

* 0.0.23

* fix: upgrade mongoose from 7.6.4 to 7.6.6 (#63)

Snyk has created this PR to upgrade mongoose from 7.6.4 to 7.6.6.

See this package in npm:
https://www.npmjs.com/package/mongoose

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: cleanup dev logging

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.24 (#76)

* 0.0.24

* fix: upgrade ws from 8.15.0 to 8.16.0 (#72)

Snyk has created this PR to upgrade ws from 8.15.0 to 8.16.0.

See this package in npm:
https://www.npmjs.com/package/ws

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade mongoose from 7.6.6 to 7.6.7 (#73)

Snyk has created this PR to upgrade mongoose from 7.6.6 to 7.6.7.

See this package in npm:
https://www.npmjs.com/package/mongoose

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade @aws-sdk/client-s3 from 3.456.0 to 3.484.0 (#71)

Snyk has created this PR to upgrade @aws-sdk/client-s3 from 3.456.0 to 3.484.0.

See this package in npm:
https://www.npmjs.com/package/@aws-sdk/client-s3

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade mongoose from 7.6.6 to 7.6.7 (#79)

Snyk has created this PR to upgrade mongoose from 7.6.6 to 7.6.7.

See this package in npm:
https://www.npmjs.com/package/mongoose

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: upgrade ws from 8.15.0 to 8.16.0 (#78)

Snyk has created this PR to upgrade ws from 8.15.0 to 8.16.0.

See this package in npm:
https://www.npmjs.com/package/ws

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* fix: do not leak secrets yikes

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.25 (#83)

* 0.0.25

* fix: upgrade ws from 8.15.0 to 8.16.0 (#82)

Snyk has created this PR to upgrade ws from 8.15.0 to 8.16.0.

See this package in npm:
https://www.npmjs.com/package/ws

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

* chore: migrate to tbltp db

* chore: bump mongoose

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* Release/0.0.46 (#112)

* 0.0.46
* feat: painting
* fix: cleanup editor toolbar state
* feat: add toolbar button emphasis colour (looks gross but whatever)
* feat: add editor crash course when there is no player content in the scene (#111)
* fix: Closes #110

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.26 (#84)

* 0.0.26

* fix: display host and db name when mongo connects

---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.47 (#113)

* 0.0.47
* fix: set bearer to NOAUTH for no-authentication mode so editor loads.
---------

Co-authored-by: micahg <[email protected]>

* Release/0.0.27 (#86)

* 0.0.27

* fix: upgrade @aws-sdk/client-s3 from 3.484.0 to 3.501.0 (#85)

Snyk has created this PR to upgrade @aws-sdk/client-s3 from 3.484.0 to 3.501.0.

See this package in npm:
https://www.npmjs.com/package/@aws-sdk/client-s3

See this project in Snyk:
https://app.snyk.io/org/micahgalizia/project/9eb5757d-41bf-44f0-a368-39f3cd465441?utm_source=github&utm_medium=referral&page=upgrade-pr

Co-authored-by: snyk-bot <[email protected]>

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>

* 0.0.28

* Release/0.0.48 (#114)

* 0.0.48
* fix: set NOAUTH token when no-auth mode is on
---------

Co-authored-by: micahg <[email protected]>

* 0.0.49

* monorepo prep

* prep for monorepo

* fix: correct spelling.

---------

Co-authored-by: micahg <[email protected]>
Co-authored-by: snyk-bot <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2024
1 parent 5bf808e commit a1ad6e6
Show file tree
Hide file tree
Showing 106 changed files with 40,541 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Monorepo for open source network table-top, which aims to be:
* An alternative to printing maps
* Free for you to run on your own hardware

## Running With Dockerr
## Running With Docker

Download https://raw.githubusercontent.com/micahg/tbltp/main/compose.yaml, and run `docker compose up`.

Expand Down
19 changes: 19 additions & 0 deletions packages/api/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
]
}
106 changes: 106 additions & 0 deletions packages/api/.github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Publish package to GitHub Packages
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.get_version.outputs.package_version }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- id: get_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "package_version=$VERSION"
echo "package_version=$VERSION" >> "$GITHUB_OUTPUT"
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v3
with:
name: serverjs
path: server.js
publish:
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@micahg'
- uses: actions/download-artifact@v3
with:
name: serverjs
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package:
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker registry login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the server js file
uses: actions/download-artifact@v3
with:
name: serverjs
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
env:
IMAGE_VERSION: ${{needs.build.outputs.package_version}}
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.version=${{ env.IMAGE_VERSION }}
tags: |
type=semver,pattern={{version}},value=${{ env.IMAGE_VERSION }}
- name: Docker Build and Push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "[email protected]"
npm version patch
VERSION=$(node -p "require('./package.json').version")
BRANCH="release/$VERSION"
echo "Checking out $BRANCH"
git checkout -b "$BRANCH"
git push --set-upstream origin "$BRANCH"
52 changes: 52 additions & 0 deletions packages/api/.github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test changes
on:
push:
branches-ignore:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
MONGO_CACHE_PATH: ~/.cache/mongodb-binaries
MONGO_BINARY: mongod-x86_64-ubuntu-7.0.0
MONGOMS_VERSION: 7.0.0
MONGOMS_DOWNLOAD_URL: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.0.tgz
jobs:
test:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.get_version.outputs.package_version }}
permissions:
contents: read
steps:
# cache download ./node_modules/.cache
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Cache Mongo Binary
uses: actions/cache@v3
with:
path: ${{ env.MONGO_CACHE_PATH }}/${{ env.MONGO_BINARY }}
key: ${{ env.MONGO_BINARY }}
- name: Node Modules
run: npm ci
- name: Lint Code
run: npm run lint
- name: Prune Dead Code
run: npm run prune
- name: Unit Test
run: npm run test
build:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.get_version.outputs.package_version }}
permissions:
contents: read
steps:
# cache download ./node_modules/.cache
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- run: npm ci
- run: npm run build
110 changes: 110 additions & 0 deletions packages/api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Typescript Output
server.js

# Asset Upload
public
56 changes: 56 additions & 0 deletions packages/api/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Build",
"request": "launch",
"runtimeArgs": [
"run",
"dev"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
},
{
"type": "node",
"request": "launch",
"name": "Run",
"runtimeExecutable": "npm",
"runtimeArgs": [ "start" ],
"outputCapture": "std",
"env": {
"DISABLE_AUTH": "false",
// "AUDIENCE_URL": "asdf.com",
//"ISSUER_URL": "https://nttdev.us.auth0.com"
}
},
{
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
"--runInBand",
"--testTimeout",
"60000",
"--detectOpenHandles",
"--coverage",
// "--",
// "websocket.test.ts"
],
"env": {
"MONGOMS_VERSION": "7.0.0",
"MONGOMS_DOWNLOAD_URL": "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2204-7.0.0.tgz",
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
11 changes: 11 additions & 0 deletions packages/api/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"cSpell.languageSettings": [
{
"languageId": "javascript,typescript",
"includeRegExpList": [
"CStyleComment",
"strings"
]
},
],
}
16 changes: 16 additions & 0 deletions packages/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:18

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
COPY server.js ./

# If you are building your code for production
RUN npm install --omit=dev --only=production

EXPOSE 3000
CMD [ "node", "server.js" ]
Loading

0 comments on commit a1ad6e6

Please sign in to comment.