Skip to content

Commit

Permalink
add: initial commit of cabinet-app with toolkit, esign-app and dispat…
Browse files Browse the repository at this point in the history
…ch-app
  • Loading branch information
pbek committed Feb 15, 2024
1 parent ad584b5 commit 39c1f3b
Show file tree
Hide file tree
Showing 110 changed files with 30,831 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor/**
/dist/**
/*.js
/_*cache
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", {"args": "none"}],
"semi": [2, "always"],
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-description": 0
}
}
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#### Expected behavior

#### Actual behavior

#### Steps to reproduce

#### Output from the Javascript console in your browser
<!-- You have to enable the developer tools with Ctrl + Shift + I in your browser. -->
63 changes: 63 additions & 0 deletions .github/workflows/build-deploy-prod-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 📦 Create and publish Production Docker image

on:
schedule:
- cron: "0 10 * * *"
workflow_cabinet:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- "main"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
85 changes: 85 additions & 0 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build, Test and Publish
on: [push, pull_request, workflow_cabinet]

jobs:
test:
runs-on: ubuntu-latest

env:
PLAYWRIGHT_BROWSERS_PATH: /tmp/_playwright_cache

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- name: Restore playwright cache
uses: actions/cache@v4
with:
path: |
${{ env.PLAYWRIGHT_BROWSERS_PATH }}
key: playwright-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
playwright-
- name: Install dependencies
run: npm ci

- name: Run build
run: APP_ENV=development npm run build

- name: Install test dependencies
run: |
./node_modules/.bin/playwright install-deps chromium firefox
- name: Run tests
run: npm run test-full

- name: Run lint
run: npm run lint

deploy:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/demo' || github.ref == 'refs/heads/production'
environment: ${{ github.ref_name }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- name: Publish to NPM
if: github.ref == 'refs/heads/main'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# https://www.npmjs.com/settings/dbp-deploy/tokens
# NPM_TOKEN needs to be a "Publish" token with 2FA disabled!
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc
npm ci
npm run build
npm run publish
- name: Deploy and wait for completion
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/demo' || github.ref == 'refs/heads/production'
uses: digital-blueprint/gitlab-pipeline-trigger-action@v1
with:
host: 'gitlab.tugraz.at'
trigger_token: ${{ secrets.DEPLOY_TRIGGER_TOKEN }}
access_token: ${{ secrets.DEPLOY_ACCESS_TOKEN }}
id: '21238'
ref: 'main'
variables: '{"UPSTREAM_PROJECT_PATH":"dbp/cabinet/cabinet","UPSTREAM_COMMIT_BRANCH":"${{ github.ref_name }}","UPSTREAM_COMMIT_SHA":"${{ github.ref_name }}"}'
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist
node_modules
.idea
npm-debug.log
.vscode
.cert
yarn.lock
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "vendor/toolkit"]
path = vendor/toolkit
url = https://github.com/digital-blueprint/toolkit
[submodule "vendor/signature"]
path = vendor/signature
url = https://github.com/digital-blueprint/esign-app
[submodule "vendor/dispatch"]
path = vendor/dispatch
url = https://github.com/digital-blueprint/dispatch-app.git
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
.idea
package-lock.json
vendor
rollup.config.js
_cypress_cache
scripts
docker
.github
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
legacy-peer-deps=true
engine-strict=true
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
/dist
/vendor
16 changes: 16 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"bracketSpacing": false,
"singleQuote": true,
"tabWidth": 4,
"printWidth": 100,
"bracketSameLine": true,
"htmlWhitespaceSensitivity": "ignore",
"overrides": [
{
"files": "*.js",
"options": {
"semi": true
}
}
]
}
23 changes: 23 additions & 0 deletions .renovaterc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": ["config:base", "group:allNonMajor", "schedule:weekly", "docker:disable"],
"ignorePresets": [":prHourlyLimit2"],
"rangeStrategy": "update-lockfile",
"composer": {
"enabled": false
},
"cloneSubmodules": true,
"packageRules": [
{
"matchPackageNames": ["pdfjs-dist"],
"allowedVersions": "<3"
},
{
"matchPackageNames": ["@open-wc/scoped-elements"],
"allowedVersions": "<3"
},
{
"matchPackageNames": ["rollup-plugin-serve"],
"allowedVersions": "<3"
}
]
}
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18-alpine as node
RUN apk add --no-cache git
WORKDIR /app
COPY . /app
#COPY ./dist /app/dist
#COPY ./app-template /app/app-template

RUN npm ci && APP_ENV=production npm run build
#RUN cp /app/dist/dbp-cabinet.html /app/dist/index.html

#RUN export path=; cp ./app-template public -R && cd public && \
# sed -i 's|="/|="'"$path"'/|g' index.html && \
# sed -i "s|from '/|from '$path/|g" index.html && \
# sed -i 's|@import "/|@import "'"$path"'/|g' index.html && \
# sed -i 's|: "/|: "'"$path"'/|g' index.html && \
# sed -i 's| /| '"$path"'/|g' .htaccess && \
# sed -i 's|="/|="'"$path"'/|g' browserconfig.xml || true && \
# sed -i 's|"path": "/|"path": "'"$path"'/|g' topic.metadata.json

FROM httpd:latest
#COPY --from=node /app/dist /usr/local/apache2/htdocs
COPY --from=node /app/app-template /usr/local/apache2/htdocs
COPY --from=node /app/dist /usr/local/apache2/htdocs/app
Loading

0 comments on commit 39c1f3b

Please sign in to comment.