@live-change/frontend-template 0.1.5 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +52 -0
- package/docker/app.initd.sh +73 -0
- package/docker/build-and-upload.sh +30 -0
- package/docker/build-docker-and-upload.sh +33 -0
- package/docker/commit-new-version.sh +17 -0
- package/docker/k8s-rsync-helper.sh +4 -0
- package/docker/onlyDependencies.js +16 -0
- package/docker/parse-args-and-config.sh +19 -0
- package/docker/restore-backup-with-service.sh +14 -0
- package/docker/restore-backup.sh +22 -0
- package/docker/start-service.sh +4 -0
- package/docker/upload-backup-and-restore.sh +12 -0
- package/front/index.html +2 -0
- package/front/locales/en.js +36 -0
- package/front/locales/en.json +7 -0
- package/front/src/App.vue +25 -7
- package/front/src/Index.vue +8 -1
- package/front/src/config.js +18 -6
- package/front/src/entry-client.js +1 -1
- package/front/src/router.js +1 -1
- package/front/vite.config.js +24 -2
- package/package.json +73 -62
- package/server/{services.config.js → app.config.js} +36 -19
- package/server/init.js +3 -3
- package/server/page.documentType.js +103 -0
- package/server/security.config.js +2 -2
- package/server/services.list.js +43 -0
- package/server/start.js +11 -0
- package/locales/en.json +0 -3
package/Dockerfile
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
FROM --platform=amd64 debian:buster
|
|
2
|
+
|
|
3
|
+
# SYSTEM
|
|
4
|
+
RUN echo no cache 3
|
|
5
|
+
RUN apt-get -qq update
|
|
6
|
+
RUN apt-get install -qq -y wget curl apt-utils git openssh-server locales gnupg2 make cmake gcc g++ unzip nano \
|
|
7
|
+
alpine-pico fish rsync
|
|
8
|
+
|
|
9
|
+
ENV LANG en_US.UTF-8
|
|
10
|
+
ENV LANGUAGE en_US.UTF-8
|
|
11
|
+
ENV LC_ALL en_US.UTF-8
|
|
12
|
+
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
|
|
13
|
+
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
|
|
14
|
+
RUN echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
|
15
|
+
RUN locale-gen en_US.UTF-8
|
|
16
|
+
|
|
17
|
+
# NODE
|
|
18
|
+
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
|
19
|
+
RUN apt-get install -y nodejs
|
|
20
|
+
|
|
21
|
+
#NPM, PM2
|
|
22
|
+
RUN npm install cross-env yarn -g
|
|
23
|
+
|
|
24
|
+
# APP
|
|
25
|
+
RUN mkdir -p /app
|
|
26
|
+
WORKDIR /app
|
|
27
|
+
COPY package-deps.json package.json
|
|
28
|
+
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc yarn install
|
|
29
|
+
|
|
30
|
+
RUN mkdir -p /app/docker
|
|
31
|
+
COPY docker/restore-backup-with-service.sh /app/docker/restore-backup-with-service.sh
|
|
32
|
+
COPY docker/restore-backup.sh /app/docker/restore-backup.sh
|
|
33
|
+
COPY /front front
|
|
34
|
+
COPY /server server
|
|
35
|
+
COPY package.json package.json
|
|
36
|
+
|
|
37
|
+
ARG VERSION='unknown'
|
|
38
|
+
|
|
39
|
+
ENV VERSION=$VERSION
|
|
40
|
+
|
|
41
|
+
RUN echo "VERSION=$VERSION" >> /etc/environment
|
|
42
|
+
|
|
43
|
+
RUN npm run build
|
|
44
|
+
|
|
45
|
+
# START
|
|
46
|
+
EXPOSE 8001
|
|
47
|
+
EXPOSE 8007
|
|
48
|
+
COPY docker/start-service.sh /start-service.sh
|
|
49
|
+
COPY docker/app.initd.sh /etc/init.d/app
|
|
50
|
+
|
|
51
|
+
#CMD /start-service.sh
|
|
52
|
+
CMD node server/start.js ssrServer --withApi --withServices --updateServices --enableSessions --createDb
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
|
|
3
|
+
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
|
|
4
|
+
|
|
5
|
+
NAME=app
|
|
6
|
+
DIR=/app
|
|
7
|
+
PIDFILE=/var/run/$NAME.pid
|
|
8
|
+
DAEMON=/usr/bin/node
|
|
9
|
+
DAEMON_ARGS="server/start.js server ssrServer --withApi --withServices --updateServices --enableSessions --createDb"
|
|
10
|
+
STOP_SIGNAL=INT
|
|
11
|
+
USER=root
|
|
12
|
+
LOG=/var/log/$NAME.log
|
|
13
|
+
|
|
14
|
+
export NODE_ENV=production
|
|
15
|
+
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
|
16
|
+
|
|
17
|
+
common_opts="--quiet --chuid $USER --pidfile $PIDFILE"
|
|
18
|
+
|
|
19
|
+
do_start(){
|
|
20
|
+
start-stop-daemon --start $common_opts --chdir $DIR --make-pidfile --background --startas \
|
|
21
|
+
/bin/bash -- -c "exec $DAEMON $DAEMON_ARGS > $LOG 2>&1"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
do_stop(){
|
|
25
|
+
opt=${@:-}
|
|
26
|
+
start-stop-daemon --stop $common_opts --signal $STOP_SIGNAL --oknodo $opt --remove-pidfile
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
do_status(){
|
|
30
|
+
start-stop-daemon --status $common_opts && exit_status=$? || exit_status=$?
|
|
31
|
+
echo asdf $exit_status
|
|
32
|
+
case "$exit_status" in
|
|
33
|
+
0)
|
|
34
|
+
echo "Program '$NAME' is running."
|
|
35
|
+
;;
|
|
36
|
+
1)
|
|
37
|
+
echo "Program '$NAME' is not running and the pid file exists."
|
|
38
|
+
;;
|
|
39
|
+
3)
|
|
40
|
+
echo "Program '$NAME' is not running."
|
|
41
|
+
;;
|
|
42
|
+
4)
|
|
43
|
+
echo "Unable to determine program '$NAME' status."
|
|
44
|
+
;;
|
|
45
|
+
esac
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
case "$1" in
|
|
49
|
+
status)
|
|
50
|
+
do_status
|
|
51
|
+
;;
|
|
52
|
+
start)
|
|
53
|
+
echo -n "Starting daemon: "$NAME
|
|
54
|
+
do_start
|
|
55
|
+
echo "."
|
|
56
|
+
;;
|
|
57
|
+
stop)
|
|
58
|
+
echo -n "Stopping daemon: "$NAME
|
|
59
|
+
do_stop
|
|
60
|
+
echo "."
|
|
61
|
+
;;
|
|
62
|
+
restart)
|
|
63
|
+
echo -n "Restarting daemon: "$NAME
|
|
64
|
+
do_stop --retry 30
|
|
65
|
+
do_start
|
|
66
|
+
echo "."
|
|
67
|
+
;;
|
|
68
|
+
*)
|
|
69
|
+
echo "Usage: "$1" {status|start|stop|restart}"
|
|
70
|
+
exit 1
|
|
71
|
+
esac
|
|
72
|
+
|
|
73
|
+
exit 0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
|
4
|
+
pushd "$DIR/.."
|
|
5
|
+
|
|
6
|
+
source ./docker/parse-args-and-config.sh
|
|
7
|
+
|
|
8
|
+
POD_NAME="${POD_NAME="$DEPLOYMENT-$PROJECT_NAME"}"
|
|
9
|
+
echo POD_NAME=$POD_NAME
|
|
10
|
+
|
|
11
|
+
echo Compiling
|
|
12
|
+
|
|
13
|
+
npm run build
|
|
14
|
+
|
|
15
|
+
echo Uploading
|
|
16
|
+
|
|
17
|
+
rsync -av --progress --stats --delete -e 'docker/k8s-rsync-helper.sh' \
|
|
18
|
+
front server package.json package-lock.json \
|
|
19
|
+
$POD_NAME:/app
|
|
20
|
+
|
|
21
|
+
echo Updating deps
|
|
22
|
+
kubectl exec $POD_NAME -- yarn install
|
|
23
|
+
|
|
24
|
+
echo Restarting
|
|
25
|
+
|
|
26
|
+
kubectl exec $POD_NAME -- /etc/init.d/app restart
|
|
27
|
+
|
|
28
|
+
echo Done
|
|
29
|
+
|
|
30
|
+
popd
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
|
5
|
+
|
|
6
|
+
pushd "$DIR/.."
|
|
7
|
+
|
|
8
|
+
source ./docker/parse-args-and-config.sh
|
|
9
|
+
|
|
10
|
+
echo "Building ${NAME}:${VERSION}-${DEPLOYMENT}"
|
|
11
|
+
|
|
12
|
+
set -ex
|
|
13
|
+
|
|
14
|
+
./docker/onlyDependencies.js > package-deps.json
|
|
15
|
+
|
|
16
|
+
docker build \
|
|
17
|
+
-t ${NAME}:${VERSION}-${DEPLOYMENT}\
|
|
18
|
+
-t ${NAME}:${DEPLOYMENT}\
|
|
19
|
+
-t ${REPO}/${NAME}:${VERSION}-${DEPLOYMENT}\
|
|
20
|
+
-t ${REPO}/${NAME}:${DEPLOYMENT}\
|
|
21
|
+
--secret id=npmrc,src=$HOME/.npmrc\
|
|
22
|
+
--build-arg VERSION=${VERSION}-${DEPLOYMENT}\
|
|
23
|
+
--build-arg BASE_HREF=${BASE_HREF}\
|
|
24
|
+
.
|
|
25
|
+
|
|
26
|
+
docker push ${REPO}/${NAME}:${VERSION}-${DEPLOYMENT}
|
|
27
|
+
docker push ${REPO}/${NAME}:${DEPLOYMENT}
|
|
28
|
+
|
|
29
|
+
set +x
|
|
30
|
+
|
|
31
|
+
echo "Done building ${NAME}:${VERSION}-${DEPLOYMENT}"
|
|
32
|
+
|
|
33
|
+
popd
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
|
4
|
+
pushd "$DIR/.."
|
|
5
|
+
|
|
6
|
+
source ./scripts/parse-args-and-config.sh
|
|
7
|
+
|
|
8
|
+
set +ex
|
|
9
|
+
|
|
10
|
+
git commit -a
|
|
11
|
+
npm version patch
|
|
12
|
+
git push
|
|
13
|
+
./docker/build-docker-and-upload.sh $DEPLOYMENT
|
|
14
|
+
|
|
15
|
+
set -e
|
|
16
|
+
|
|
17
|
+
popd
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs/promises")
|
|
4
|
+
|
|
5
|
+
;(async () => {
|
|
6
|
+
|
|
7
|
+
const packageData = JSON.parse(await fs.readFile(process.argv[2] || "package.json"))
|
|
8
|
+
|
|
9
|
+
const { dependencies, devDependencies } = packageData
|
|
10
|
+
|
|
11
|
+
console.log(JSON.stringify({
|
|
12
|
+
dependencies,
|
|
13
|
+
devDependencies
|
|
14
|
+
}, null, 2))
|
|
15
|
+
|
|
16
|
+
})()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
REPO=docker.chaosu.pl
|
|
2
|
+
|
|
3
|
+
VERSION=`echo "console.log(require('./package.json').version)" | node`
|
|
4
|
+
NAME=`echo "console.log(require('./package.json').name.split('/').pop())" | node`
|
|
5
|
+
|
|
6
|
+
DEPLOYMENT=${1:-dev}
|
|
7
|
+
echo "DEPLOYMENT=${DEPLOYMENT}"
|
|
8
|
+
|
|
9
|
+
#BASE_HREF="https://$DEPLOYMENT.example.com/"
|
|
10
|
+
|
|
11
|
+
#if [ "$DEPLOYMENT" == "master" ]; then
|
|
12
|
+
BASE_HREF='https://www.example.com/'
|
|
13
|
+
#fi
|
|
14
|
+
|
|
15
|
+
PROJECT_NAME=${NAME}
|
|
16
|
+
|
|
17
|
+
if [ "$DEPLOYMENT" == "master" ]; then
|
|
18
|
+
echo ok
|
|
19
|
+
fi
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
BACKUP_PATH=${1:-../backup.tar.gz}
|
|
4
|
+
|
|
5
|
+
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
|
6
|
+
pushd "$DIR/.."
|
|
7
|
+
|
|
8
|
+
/etc/init.d/app stop
|
|
9
|
+
sleep 1
|
|
10
|
+
./docker/restore-backup.sh $BACKUP_PATH
|
|
11
|
+
sleep 1
|
|
12
|
+
/etc/init.d/app start
|
|
13
|
+
|
|
14
|
+
popd
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
BACKUP_PATH=${1:-../backup.tar.gz}
|
|
4
|
+
DB_NAME=${DB_NAME:-laszczewski-pl}
|
|
5
|
+
|
|
6
|
+
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
|
7
|
+
pushd "$DIR/.."
|
|
8
|
+
|
|
9
|
+
rm -rf backup
|
|
10
|
+
mkdir -p backup
|
|
11
|
+
pushd backup
|
|
12
|
+
tar -zxf $BACKUP_PATH
|
|
13
|
+
../node_modules/.bin/lcdbc --serverUrl $DB_URL --verbose request database.deleteDatabase $DB_NAME
|
|
14
|
+
echo uploading data to database...
|
|
15
|
+
../node_modules/.bin/lcdbc --serverUrl $DB_URL --verbose exec --targetDb $DB_NAME db.json
|
|
16
|
+
echo data uploaded
|
|
17
|
+
rm -rf ../storage/*
|
|
18
|
+
mv storage/* ../storage
|
|
19
|
+
echo backup restored
|
|
20
|
+
popd
|
|
21
|
+
|
|
22
|
+
popd
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
POD_NAME=$1
|
|
4
|
+
BACKUP_PATH=${2:-../backup.tar.gz}
|
|
5
|
+
|
|
6
|
+
DIR="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
|
7
|
+
pushd "$DIR/.."
|
|
8
|
+
|
|
9
|
+
kubectl cp $BACKUP_PATH $POD_NAME:/app/backup.tar.gz
|
|
10
|
+
kubectl exec -it $POD_NAME -- /app/docker/restore-backup-with-service.sh /app/backup.tar.gz
|
|
11
|
+
|
|
12
|
+
popd
|
package/front/index.html
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import messages from "./en.json"
|
|
2
|
+
export { messages }
|
|
3
|
+
|
|
4
|
+
export const numberFormats ={
|
|
5
|
+
"ipi": {
|
|
6
|
+
"style": "currency",
|
|
7
|
+
"currency": "ipi",
|
|
8
|
+
"notation": "standard"
|
|
9
|
+
},
|
|
10
|
+
"btc": {
|
|
11
|
+
"style": "currency",
|
|
12
|
+
"currency": "btc",
|
|
13
|
+
"notation": "standard"
|
|
14
|
+
},
|
|
15
|
+
"usd": {
|
|
16
|
+
"style": "currency",
|
|
17
|
+
"currency": "USD",
|
|
18
|
+
"notation": "standard"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const datetimeFormats = {
|
|
23
|
+
"short": {
|
|
24
|
+
"year": "numeric", "month": "short", "day": "numeric"
|
|
25
|
+
},
|
|
26
|
+
"shortTime": {
|
|
27
|
+
"dateStyle": "short", "timeStyle": "short", "hour12": false
|
|
28
|
+
},
|
|
29
|
+
"shortestTime": {
|
|
30
|
+
"month": "numeric", "day": "numeric", "hour": "numeric", "minute": "numeric", "hour12": false
|
|
31
|
+
},
|
|
32
|
+
"long": {
|
|
33
|
+
"year": "numeric", "month": "short", "day": "numeric",
|
|
34
|
+
"weekday": "short", "hour": "numeric", "minute": "numeric"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/front/src/App.vue
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<view-root>
|
|
3
3
|
<template #navbar>
|
|
4
4
|
<NavBar />
|
|
5
|
+
<UpdateBanner />
|
|
5
6
|
</template>
|
|
6
7
|
</view-root>
|
|
7
8
|
</template>
|
|
@@ -10,16 +11,27 @@
|
|
|
10
11
|
import 'primevue/resources/themes/saga-green/theme.css'
|
|
11
12
|
import "@fortawesome/fontawesome-free/css/all.min.css"
|
|
12
13
|
|
|
13
|
-
import { ViewRoot, NavBar } from "@live-change/frontend-base"
|
|
14
|
+
import { ViewRoot, NavBar, UpdateBanner } from "@live-change/frontend-base"
|
|
14
15
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
import { computed } from 'vue'
|
|
17
|
+
import { useHead } from '@vueuse/head'
|
|
18
|
+
|
|
19
|
+
import { useI18n } from 'vue-i18n'
|
|
20
|
+
const i18n = useI18n()
|
|
21
|
+
|
|
22
|
+
useHead(computed(() => ({
|
|
23
|
+
title: ENV_BRAND_NAME,
|
|
24
|
+
meta: [
|
|
25
|
+
{ charset: 'utf-8' },
|
|
26
|
+
{ name: 'viewport',
|
|
27
|
+
content: "user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1," +
|
|
28
|
+
" width=device-width, viewport-fit=cover" }
|
|
29
|
+
],
|
|
18
30
|
htmlAttrs: {
|
|
19
|
-
lang:
|
|
31
|
+
lang: i18n.locale.value,
|
|
20
32
|
amp: true
|
|
21
|
-
}
|
|
22
|
-
})
|
|
33
|
+
},
|
|
34
|
+
})))
|
|
23
35
|
|
|
24
36
|
import { watch } from 'vue'
|
|
25
37
|
import { client as useClient, useApi } from '@live-change/vue3-ssr'
|
|
@@ -34,4 +46,10 @@
|
|
|
34
46
|
api.validators.email = emailValidator
|
|
35
47
|
api.validators.password = passwordValidator
|
|
36
48
|
|
|
49
|
+
import { defaultHighlightStyle } from "@codemirror/language"
|
|
50
|
+
import { StyleModule } from "style-mod"
|
|
51
|
+
if(typeof window != 'undefined') {
|
|
52
|
+
StyleModule.mount(window.document, defaultHighlightStyle.module)
|
|
53
|
+
}
|
|
54
|
+
|
|
37
55
|
</script>
|
package/front/src/Index.vue
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div>
|
|
3
|
+
<h1>Hello world!</h1>
|
|
4
|
+
<p>{{ currentTime }}</p>
|
|
5
|
+
</div>
|
|
3
6
|
</template>
|
|
4
7
|
|
|
5
8
|
<script setup>
|
|
9
|
+
import { currentTime } from "@live-change/frontend-base";
|
|
10
|
+
import { useTimestamp } from "@vueuse/core";
|
|
11
|
+
|
|
12
|
+
const now = useTimestamp({ interval: 500 })
|
|
6
13
|
|
|
7
14
|
</script>
|
|
8
15
|
|
package/front/src/config.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import deepmerge from 'deepmerge';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as exchangeEn from "../locales/en.js"
|
|
4
4
|
import { locales as autoFormLocales } from "@live-change/frontend-auto-form"
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
i18n: {
|
|
8
|
+
messages: {
|
|
9
|
+
en: deepmerge.all([
|
|
10
|
+
autoFormLocales.en,
|
|
11
|
+
exchangeEn.messages
|
|
12
|
+
])
|
|
13
|
+
},
|
|
14
|
+
numberFormats: {
|
|
15
|
+
en: deepmerge.all([
|
|
16
|
+
exchangeEn.numberFormats
|
|
17
|
+
])
|
|
18
|
+
},
|
|
19
|
+
datetimeFormats: {
|
|
20
|
+
en: deepmerge.all([
|
|
21
|
+
exchangeEn.datetimeFormats
|
|
22
|
+
])
|
|
23
|
+
}
|
|
12
24
|
}
|
|
13
25
|
}
|
package/front/src/router.js
CHANGED
|
@@ -12,7 +12,7 @@ import { dbAdminRoutes } from "@live-change/db-admin"
|
|
|
12
12
|
import { userRoutes } from "@live-change/user-frontend"
|
|
13
13
|
import { catchAllPagesRoute, contentEditRoutes, pagesSitemap } from "@live-change/content-frontend"
|
|
14
14
|
|
|
15
|
-
export function
|
|
15
|
+
export function routes(config = {}) {
|
|
16
16
|
const { prefix = '/', route = (r) => r } = config
|
|
17
17
|
return [
|
|
18
18
|
...userRoutes({ ...config, prefix: prefix + 'user/' }),
|
package/front/vite.config.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
|
+
import Pages from 'vite-plugin-pages'
|
|
3
|
+
|
|
4
|
+
let version = process.env.VERSION ?? 'unknown'
|
|
2
5
|
|
|
3
6
|
import baseViteConfig from '@live-change/frontend-base/vite-config.js'
|
|
4
7
|
|
|
@@ -7,11 +10,30 @@ export default defineConfig(async ({ command, mode }) => {
|
|
|
7
10
|
return {
|
|
8
11
|
...baseConfig,
|
|
9
12
|
|
|
13
|
+
define: {
|
|
14
|
+
...baseConfig.define,
|
|
15
|
+
ENV_VERSION: JSON.stringify(version),
|
|
16
|
+
ENV_BRAND_NAME: JSON.stringify("Example"),
|
|
17
|
+
ENV_BRAND_DOMAIN: JSON.stringify("example.com"),
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
plugins: [
|
|
21
|
+
...baseConfig.plugins,
|
|
22
|
+
Pages({
|
|
23
|
+
dirs: [
|
|
24
|
+
// basic
|
|
25
|
+
{ dir: 'src/pages', baseRoute: '' },
|
|
26
|
+
// blog
|
|
27
|
+
// { dir: 'src/blog', baseRoute: 'blog' },
|
|
28
|
+
],
|
|
29
|
+
extensions: ['vue', 'md'],
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
|
|
10
33
|
resolve: {
|
|
34
|
+
...baseConfig.resolve,
|
|
11
35
|
alias: [
|
|
12
36
|
...baseConfig.resolve.alias,
|
|
13
|
-
/* { find: 'vue', replacement: 'vue/dist/vue.esm-bundler.js' },
|
|
14
|
-
{ find: 'vue/server-renderer', replacement: 'vue/server-renderer' },*/
|
|
15
37
|
]
|
|
16
38
|
}
|
|
17
39
|
}
|
package/package.json
CHANGED
|
@@ -1,86 +1,97 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/frontend-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"memDev": "
|
|
6
|
-
"localDevInit": "rm tmp.db;
|
|
7
|
-
"localDev": "
|
|
8
|
-
"dev": "
|
|
9
|
-
"ssrDev": "
|
|
10
|
-
"serveAllMem": "cross-env NODE_ENV=production
|
|
11
|
-
"serveAll": "cross-env NODE_ENV=production
|
|
12
|
-
"serve": "cross-env NODE_ENV=production
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
5
|
+
"memDev": "node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
|
|
6
|
+
"localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
|
|
7
|
+
"localDev": "node server/start.js localDev --enableSessions",
|
|
8
|
+
"dev": "node server/start.js dev --enableSessions",
|
|
9
|
+
"ssrDev": "node server/start.js ssrDev --enableSessions",
|
|
10
|
+
"serveAllMem": "cross-env NODE_ENV=production node server/start.js ssrServer --withApi --withServices --updateServices --enableSessions --withDb --dbBackend mem --createDb",
|
|
11
|
+
"serveAll": "cross-env NODE_ENV=production node server/start.js ssrServer --withApi --withServices --updateServices --enableSessions",
|
|
12
|
+
"serve": "cross-env NODE_ENV=production node server/start.js ssrServer --enableSessions",
|
|
13
|
+
"memDev:spa": "node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess --spa",
|
|
14
|
+
"localDevInit:spa": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js --spa",
|
|
15
|
+
"localDev:spa": "node server/start.js localDev --enableSessions --spa",
|
|
16
|
+
"dev:spa": "node server/start.js dev --enableSessions --spa",
|
|
17
|
+
"ssrDev:spa": "node server/start.js ssrDev --enableSessions --spa",
|
|
18
|
+
"serveAllMem:spa": "cross-env NODE_ENV=production node server/start.js server --withApi --withServices --updateServices --enableSessions --withDb --dbBackend mem --createDb --spa",
|
|
19
|
+
"serveAll:spa": "cross-env NODE_ENV=production node server/start.js server --withApi --withServices --updateServices --enableSessions --spa",
|
|
20
|
+
"serve:spa": "cross-env NODE_ENV=production node server/start.js server --enableSessions --spa",
|
|
21
|
+
"apiServer": "node server/start.js apiServer --enableSessions",
|
|
22
|
+
"devApiServer": "node server/start.js devApiServer --enableSessions",
|
|
23
|
+
"memApiServer": "node server/start.js memApiServer --enableSessions",
|
|
16
24
|
"build": "cd front; yarn build:client && yarn build:server",
|
|
17
25
|
"build:client": "cd front; vite build --ssrManifest --outDir dist/client",
|
|
18
26
|
"build:server": "cd front; vite build --ssr src/entry-server.js --outDir dist/server",
|
|
27
|
+
"build:spa": "cd front; vite build --outDir dist/spa",
|
|
19
28
|
"generate": "vite build --ssrManifest --outDir dist/static && yarn build:server && node prerender",
|
|
20
29
|
"debug": "node --inspect-brk server"
|
|
21
30
|
},
|
|
31
|
+
"type": "module",
|
|
22
32
|
"dependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@live-change/
|
|
26
|
-
"@live-change/
|
|
27
|
-
"@live-change/
|
|
28
|
-
"@live-change/
|
|
29
|
-
"@live-change/
|
|
30
|
-
"@live-change/
|
|
31
|
-
"@live-change/
|
|
32
|
-
"@live-change/
|
|
33
|
-
"@live-change/
|
|
34
|
-
"@live-change/
|
|
35
|
-
"@live-change/
|
|
36
|
-
"@live-change/
|
|
37
|
-
"@live-change/
|
|
38
|
-
"@live-change/
|
|
39
|
-
"@live-change/
|
|
40
|
-
"@live-change/
|
|
41
|
-
"@live-change/
|
|
42
|
-
"@live-change/
|
|
43
|
-
"@live-change/
|
|
44
|
-
"@live-change/
|
|
45
|
-
"@live-change/
|
|
46
|
-
"@live-change/
|
|
47
|
-
"@live-change/upload-frontend": "0.
|
|
48
|
-
"@live-change/
|
|
49
|
-
"@live-change/
|
|
50
|
-
"@live-change/
|
|
51
|
-
"@live-change/
|
|
52
|
-
"@live-change/
|
|
53
|
-
"@live-change/
|
|
54
|
-
"@
|
|
33
|
+
"@codemirror/language": "6.10.1",
|
|
34
|
+
"@fortawesome/fontawesome-free": "^6.4.2",
|
|
35
|
+
"@live-change/access-control-frontend": "0.4.5",
|
|
36
|
+
"@live-change/access-control-service": "^0.8.2",
|
|
37
|
+
"@live-change/backup-server": "0.4.4",
|
|
38
|
+
"@live-change/blog-frontend": "0.4.5",
|
|
39
|
+
"@live-change/blog-service": "^0.8.2",
|
|
40
|
+
"@live-change/cli": "^0.8.2",
|
|
41
|
+
"@live-change/content-frontend": "0.4.5",
|
|
42
|
+
"@live-change/content-service": "^0.8.2",
|
|
43
|
+
"@live-change/dao": "0.6.0",
|
|
44
|
+
"@live-change/dao-vue3": "^0.8.2",
|
|
45
|
+
"@live-change/dao-websocket": "^0.8.2",
|
|
46
|
+
"@live-change/db-client": "^0.8.2",
|
|
47
|
+
"@live-change/email-service": "^0.8.2",
|
|
48
|
+
"@live-change/framework": "^0.8.2",
|
|
49
|
+
"@live-change/frontend-auto-form": "0.4.5",
|
|
50
|
+
"@live-change/frontend-base": "0.4.5",
|
|
51
|
+
"@live-change/image-frontend": "0.4.5",
|
|
52
|
+
"@live-change/password-authentication-service": "^0.8.2",
|
|
53
|
+
"@live-change/prosemirror-service": "^0.8.2",
|
|
54
|
+
"@live-change/secret-code-service": "^0.8.2",
|
|
55
|
+
"@live-change/secret-link-service": "^0.8.2",
|
|
56
|
+
"@live-change/session-service": "^0.8.2",
|
|
57
|
+
"@live-change/upload-frontend": "0.4.5",
|
|
58
|
+
"@live-change/url-frontend": "0.4.5",
|
|
59
|
+
"@live-change/url-service": "^0.8.2",
|
|
60
|
+
"@live-change/user-frontend": "0.4.5",
|
|
61
|
+
"@live-change/user-identification-service": "^0.8.2",
|
|
62
|
+
"@live-change/user-service": "^0.8.2",
|
|
63
|
+
"@live-change/vue3-components": "^0.8.2",
|
|
64
|
+
"@live-change/vue3-ssr": "^0.8.2",
|
|
65
|
+
"@live-change/wysiwyg-frontend": "0.4.5",
|
|
66
|
+
"@vueuse/core": "^10.7.2",
|
|
55
67
|
"codeceptjs-assert": "^0.0.5",
|
|
56
68
|
"compression": "^1.7.4",
|
|
57
69
|
"cross-env": "^7.0.3",
|
|
58
70
|
"get-port-sync": "1.0.1",
|
|
59
71
|
"pica": "^9.0.1",
|
|
60
|
-
"pretty-bytes": "^6.
|
|
61
|
-
"primeflex": "^3.
|
|
62
|
-
"primeicons": "^
|
|
63
|
-
"primevue": "^3.
|
|
72
|
+
"pretty-bytes": "^6.1.1",
|
|
73
|
+
"primeflex": "^3.3.1",
|
|
74
|
+
"primeicons": "^6.0.1",
|
|
75
|
+
"primevue": "^3.48.1",
|
|
64
76
|
"rollup-plugin-node-builtins": "^2.1.2",
|
|
65
|
-
"rollup-plugin-visualizer": "5.
|
|
66
|
-
"serialize-javascript": "^6.0.
|
|
77
|
+
"rollup-plugin-visualizer": "5.12.0",
|
|
78
|
+
"serialize-javascript": "^6.0.2",
|
|
67
79
|
"serve-static": "^1.15.0",
|
|
68
|
-
"v-shared-element": "3.1.
|
|
69
|
-
"vue-
|
|
70
|
-
"
|
|
71
|
-
"vue3-scroll-border": "0.1.2"
|
|
80
|
+
"v-shared-element": "3.1.1",
|
|
81
|
+
"vue-router": "^4.2.5",
|
|
82
|
+
"vue3-scroll-border": "0.1.6"
|
|
72
83
|
},
|
|
73
84
|
"devDependencies": {
|
|
74
|
-
"@live-change/codeceptjs-helper": "0.
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"playwright": "^1.24.2",
|
|
85
|
+
"@live-change/codeceptjs-helper": "^0.8.2",
|
|
86
|
+
"codeceptjs": "^3.5.12",
|
|
87
|
+
"generate-password": "1.7.1",
|
|
88
|
+
"playwright": "^1.41.2",
|
|
79
89
|
"random-profile-generator": "^2.3.0",
|
|
80
|
-
"txtgen": "^3.0.
|
|
81
|
-
"webdriverio": "^
|
|
90
|
+
"txtgen": "^3.0.6",
|
|
91
|
+
"webdriverio": "^8.31.1"
|
|
82
92
|
},
|
|
83
93
|
"author": "",
|
|
84
94
|
"license": "ISC",
|
|
85
|
-
"description": ""
|
|
95
|
+
"description": "",
|
|
96
|
+
"gitHead": "53b8efc8ec7f5c1c4af33077d8fb4a8a5580f1d9"
|
|
86
97
|
}
|
|
@@ -1,69 +1,86 @@
|
|
|
1
|
+
import App from "@live-change/framework"
|
|
2
|
+
const app = App.app()
|
|
3
|
+
|
|
1
4
|
const contactTypes = ['email']
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
import securityConfig from './security.config.js'
|
|
7
|
+
import documentTypePage from './page.documentType.js'
|
|
8
|
+
|
|
9
|
+
app.config = {
|
|
4
10
|
services: [
|
|
5
11
|
{
|
|
6
12
|
name: 'session',
|
|
7
|
-
path: '@live-change/session-service',
|
|
8
13
|
createSessionOnUpdate: true
|
|
9
14
|
},
|
|
10
15
|
{
|
|
11
16
|
name: 'user',
|
|
12
|
-
path: '@live-change/user-service'
|
|
13
17
|
},
|
|
14
18
|
{
|
|
15
19
|
name: 'email',
|
|
16
|
-
path: '@live-change/email-service'
|
|
17
20
|
},
|
|
18
21
|
{
|
|
19
22
|
name: 'passwordAuthentication',
|
|
20
|
-
path: '@live-change/password-authentication-service',
|
|
21
23
|
contactTypes,
|
|
22
24
|
signInWithoutPassword: true
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
27
|
name: 'userIdentification',
|
|
26
|
-
path: '@live-change/user-identification-service'
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
30
|
name: 'identicon',
|
|
30
|
-
path: '@live-change/identicon-service'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
name: 'accessControl',
|
|
34
|
-
path: '@live-change/access-control-service',
|
|
35
34
|
createSessionOnUpdate: true,
|
|
36
35
|
contactTypes,
|
|
37
36
|
},
|
|
38
37
|
{
|
|
39
38
|
name: 'security',
|
|
40
|
-
|
|
41
|
-
...require('./security.config.js')
|
|
39
|
+
...securityConfig,
|
|
42
40
|
},
|
|
43
41
|
{
|
|
44
42
|
name: 'notification',
|
|
45
|
-
path: '@live-change/notification-service',
|
|
46
43
|
contactTypes,
|
|
47
44
|
notificationTypes: ['example_TestNotification']
|
|
48
45
|
},
|
|
49
46
|
{
|
|
50
47
|
name: 'upload',
|
|
51
|
-
path: '@live-change/upload-service'
|
|
52
48
|
},
|
|
53
49
|
{
|
|
54
50
|
name: 'image',
|
|
55
|
-
path: '@live-change/image-service'
|
|
56
51
|
},
|
|
57
52
|
{
|
|
58
53
|
name: 'secretCode',
|
|
59
|
-
path: '@live-change/secret-code-service'
|
|
60
54
|
},
|
|
61
55
|
{
|
|
62
56
|
name: 'secretLink',
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'messageAuthentication',
|
|
60
|
+
contactTypes,
|
|
61
|
+
signUp: true,
|
|
62
|
+
signIn: true,
|
|
63
|
+
connect: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'url',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'prosemirror',
|
|
70
|
+
documentTypes: {
|
|
71
|
+
page: documentTypePage,
|
|
72
|
+
/*rich: require('./rich.documentType.js'),*/
|
|
73
|
+
},
|
|
74
|
+
testLatency: 2000
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'content',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'backup',
|
|
81
|
+
port: 8007
|
|
82
|
+
},
|
|
68
83
|
]
|
|
69
84
|
}
|
|
85
|
+
|
|
86
|
+
export default app.config
|
package/server/init.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createUser } from "@live-change/user-frontend/server/init-functions.js"
|
|
2
|
+
import App from '@live-change/framework'
|
|
3
3
|
const app = App.app()
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default async function(services) {
|
|
6
6
|
|
|
7
7
|
const testUser = await createUser(services,
|
|
8
8
|
'Test User', 'test@test.com', 'Testy123', 'u1', ['writer'])
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"marks": {
|
|
3
|
+
"bold": {},
|
|
4
|
+
"italic": {},
|
|
5
|
+
"underline": {},
|
|
6
|
+
"strike": {}
|
|
7
|
+
},
|
|
8
|
+
"nodes": {
|
|
9
|
+
"paragraph": {
|
|
10
|
+
"content": "inline*",
|
|
11
|
+
"group": "block"
|
|
12
|
+
},
|
|
13
|
+
"horizontalRule": {
|
|
14
|
+
"group": "block"
|
|
15
|
+
},
|
|
16
|
+
"heading": {
|
|
17
|
+
"content": "inline*",
|
|
18
|
+
"group": "block",
|
|
19
|
+
"defining": true,
|
|
20
|
+
"attrs": {
|
|
21
|
+
"level": {
|
|
22
|
+
"default": 1
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"blockquote": {
|
|
27
|
+
"content": "block+",
|
|
28
|
+
"group": "block",
|
|
29
|
+
"defining": true
|
|
30
|
+
},
|
|
31
|
+
"codeBlock": {
|
|
32
|
+
"content": "text*",
|
|
33
|
+
"marks": "",
|
|
34
|
+
"group": "block",
|
|
35
|
+
"code": true,
|
|
36
|
+
"defining": true,
|
|
37
|
+
"attrs": {
|
|
38
|
+
"language": {
|
|
39
|
+
"default": null
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"bulletList": {
|
|
44
|
+
"content": "listItem+",
|
|
45
|
+
"group": "block list"
|
|
46
|
+
},
|
|
47
|
+
"orderedList": {
|
|
48
|
+
"content": "listItem+",
|
|
49
|
+
"group": "block list",
|
|
50
|
+
"attrs": {
|
|
51
|
+
"start": {
|
|
52
|
+
"default": 1
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"listItem": {
|
|
57
|
+
"content": "paragraph block*",
|
|
58
|
+
"defining": true
|
|
59
|
+
},
|
|
60
|
+
"image": {
|
|
61
|
+
"content": "",
|
|
62
|
+
"marks": "",
|
|
63
|
+
"group": "block",
|
|
64
|
+
"inline": false,
|
|
65
|
+
"atom": true,
|
|
66
|
+
"selectable": true,
|
|
67
|
+
"draggable": true,
|
|
68
|
+
"attrs": {
|
|
69
|
+
"image": {
|
|
70
|
+
"default": null
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"doc": {
|
|
75
|
+
"content": "block+"
|
|
76
|
+
},
|
|
77
|
+
"text": {
|
|
78
|
+
"group": "inline"
|
|
79
|
+
},
|
|
80
|
+
"hardBreak": {
|
|
81
|
+
"group": "inline",
|
|
82
|
+
"inline": true,
|
|
83
|
+
"selectable": false
|
|
84
|
+
},
|
|
85
|
+
"component": {
|
|
86
|
+
"content": "block*",
|
|
87
|
+
"marks": "",
|
|
88
|
+
"group": "block",
|
|
89
|
+
"inline": false,
|
|
90
|
+
"selectable": true,
|
|
91
|
+
"draggable": true,
|
|
92
|
+
"attrs": {
|
|
93
|
+
"is": {
|
|
94
|
+
"default": "card"
|
|
95
|
+
},
|
|
96
|
+
"attrs": {
|
|
97
|
+
"default": {}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"topNode": "doc"
|
|
103
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import lcp from "@live-change/pattern"
|
|
2
2
|
|
|
3
3
|
const clientKeys = (client) => [
|
|
4
4
|
{ key: 'user', value: client.user },
|
|
@@ -46,7 +46,7 @@ const counters = [
|
|
|
46
46
|
}
|
|
47
47
|
]
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
export default {
|
|
50
50
|
clientKeys,
|
|
51
51
|
patterns,
|
|
52
52
|
counters
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import session from '@live-change/session-service'
|
|
2
|
+
import user from '@live-change/user-service'
|
|
3
|
+
import email from '@live-change/email-service'
|
|
4
|
+
import passwordAuthentication from '@live-change/password-authentication-service'
|
|
5
|
+
import userIdentification from '@live-change/user-identification-service'
|
|
6
|
+
import identicon from '@live-change/identicon-service'
|
|
7
|
+
import accessControl from '@live-change/access-control-service'
|
|
8
|
+
import acceessControl from '@live-change/access-control-service'
|
|
9
|
+
import security from '@live-change/security-service'
|
|
10
|
+
import notification from '@live-change/notification-service'
|
|
11
|
+
import upload from '@live-change/upload-service'
|
|
12
|
+
import image from '@live-change/image-service'
|
|
13
|
+
import secretCode from '@live-change/secret-code-service'
|
|
14
|
+
import secretLink from '@live-change/secret-link-service'
|
|
15
|
+
import messageAuthentication from '@live-change/message-authentication-service'
|
|
16
|
+
import url from '@live-change/url-service'
|
|
17
|
+
import prosemirror from '@live-change/prosemirror-service'
|
|
18
|
+
import content from '@live-change/content-service'
|
|
19
|
+
import backup from '@live-change/backup-server'
|
|
20
|
+
import init from './init.js'
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
session,
|
|
24
|
+
user,
|
|
25
|
+
email,
|
|
26
|
+
passwordAuthentication,
|
|
27
|
+
userIdentification,
|
|
28
|
+
identicon,
|
|
29
|
+
accessControl,
|
|
30
|
+
acceessControl,
|
|
31
|
+
security,
|
|
32
|
+
notification,
|
|
33
|
+
upload,
|
|
34
|
+
image,
|
|
35
|
+
secretCode,
|
|
36
|
+
secretLink,
|
|
37
|
+
messageAuthentication,
|
|
38
|
+
url,
|
|
39
|
+
prosemirror,
|
|
40
|
+
content,
|
|
41
|
+
backup,
|
|
42
|
+
init
|
|
43
|
+
}
|
package/server/start.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import appConfig from './app.config.js'
|
|
2
|
+
|
|
3
|
+
import * as services from './services.list.js'
|
|
4
|
+
for(const serviceConfig of appConfig.services) {
|
|
5
|
+
serviceConfig.module = services[serviceConfig.name]
|
|
6
|
+
}
|
|
7
|
+
appConfig.init = services['init']
|
|
8
|
+
|
|
9
|
+
import { starter } from '@live-change/cli'
|
|
10
|
+
|
|
11
|
+
starter(appConfig)
|
package/locales/en.json
DELETED