forked from cms/tibi-svelte-starter
renamed to tibi-svelte-starter
This commit is contained in:
parent
66d8313316
commit
5843680e14
@ -49,11 +49,11 @@ steps:
|
|||||||
- name: cache
|
- name: cache
|
||||||
path: /cache
|
path: /cache
|
||||||
commands:
|
commands:
|
||||||
- yarn run -- live-server --no-browser --port=80 --ignore='*' --entry-file=spa.html --no-css-inject --proxy=/api:http://wmbasic-api:8080/api/v1/_/__NAMESPACE__ dist
|
- yarn run -- live-server --no-browser --port=80 --ignore='*' --entry-file=spa.html --no-css-inject --proxy=/api:http://tibi-server:8080/api/v1/_/__NAMESPACE__ dist
|
||||||
detach: true
|
detach: true
|
||||||
|
|
||||||
- name: wmbasic-api
|
- name: tibi-server
|
||||||
image: registry.webmakers.de/wmbasic/wmbasic-api
|
image: registry.webmakers.de/tibi/tibi-server
|
||||||
pull: never
|
pull: never
|
||||||
environment:
|
environment:
|
||||||
DB_DIAL: mongodb://mongo
|
DB_DIAL: mongodb://mongo
|
||||||
@ -72,7 +72,7 @@ steps:
|
|||||||
CYPRESS_BASE_URL: http://liveserver
|
CYPRESS_BASE_URL: http://liveserver
|
||||||
CYPRESS_CI: "true"
|
CYPRESS_CI: "true"
|
||||||
CYPRESS_mongodbUri: mongodb://mongo
|
CYPRESS_mongodbUri: mongodb://mongo
|
||||||
CYPRESS_wmbasicApiUrl: http://wmbasic-api:8080/api/v1
|
CYPRESS_tibiApiUrl: http://tibi-server:8080/api/v1
|
||||||
CYPRESS_projectApiConfig: /drone/workdir/api/config.yml
|
CYPRESS_projectApiConfig: /drone/workdir/api/config.yml
|
||||||
commands:
|
commands:
|
||||||
- ln -s /cache/user-cache ~/.cache
|
- ln -s /cache/user-cache ~/.cache
|
||||||
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -26,9 +26,9 @@
|
|||||||
"debug.allowBreakpointsEverywhere": true,
|
"debug.allowBreakpointsEverywhere": true,
|
||||||
"html.autoClosingTags": false,
|
"html.autoClosingTags": false,
|
||||||
"yaml.schemas": {
|
"yaml.schemas": {
|
||||||
"node_modules/wmbasic-api-types/schemas/api-config/config.json": "api/config.y*ml",
|
"node_modules/tibi-types/schemas/api-config/config.json": "api/config.y*ml",
|
||||||
"node_modules/wmbasic-api-types/schemas/api-config/collection.json": "api/collections/*.y*ml",
|
"node_modules/tibi-types/schemas/api-config/collection.json": "api/collections/*.y*ml",
|
||||||
"node_modules/wmbasic-api-types/schemas/api-config/field.json": "api/collections/fields/*.y*ml"
|
"node_modules/tibi-types/schemas/api-config/field.json": "api/collections/fields/*.y*ml"
|
||||||
},
|
},
|
||||||
"yaml.customTags": ["!include scalar"]
|
"yaml.customTags": ["!include scalar"]
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# wmbasic-svelte-starter
|
# tibi-starter
|
||||||
|
|
||||||
Starter Kit für SPAs(s) `;)` mit Svelte und WMBasic-Backend ink. SSR
|
Starter Kit für SPAs(s) `;)` mit Svelte und TibiCMS inkl. SSR
|
||||||
|
|
||||||
## Wozu?
|
## Wozu?
|
||||||
|
|
||||||
Via Svelte wird eine SPA (Single-Page-App) programmiert. Dazu wird der Code einmal für den Browser aufgebreitet und außerdem für den Server kompiliert und transpiliert. Der Server-Code wird in einem WMBasic-API SSR-Hook (server side renering) eingebunden und generiert dort fertiges HTML anhand der aktuelle Route für SEO und optimierte Ladezeiten.
|
Via Svelte wird eine SPA (Single-Page-App) programmiert. Dazu wird der Code einmal für den Browser aufgebreitet und außerdem für den Server kompiliert und transpiliert. Der Server-Code wird in einem tibi-server SSR-Hook (server side rendering) eingebunden und generiert dort fertiges HTML anhand der aktuelle Route für SEO und optimierte Ladezeiten.
|
||||||
|
|
||||||
Die Navigation innerhalb der APP im Browser löst dagegen nur API-Aufrufe aus ohne jedesmal einen SSR-Prozess anzustoßen.
|
Die Navigation innerhalb der APP im Browser löst dagegen nur API-Aufrufe aus ohne jedesmal einen SSR-Prozess anzustoßen.
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ yarn start
|
|||||||
oder mit abweichender API für "/api"-Proxy
|
oder mit abweichender API für "/api"-Proxy
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
API_BASE=https://login.wmbasic.de/api/v1_/__NAMESPACE__ yarn start
|
API_BASE=https://login.tibicms.de/api/v1_/__NAMESPACE__ yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
### Entwickeln mit externem Webserver (z.B. vscode live server)
|
### Entwickeln mit externem Webserver (z.B. vscode live server)
|
||||||
|
@ -15,7 +15,7 @@ var utils = require("../lib/utils")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {import('wmbasic-api-types').HookResponse} */
|
/** @type {import('tibi-types').HookResponse} */
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
var response = null
|
var response = null
|
||||||
return response
|
return response
|
||||||
|
@ -11,7 +11,7 @@ var utils = require("../lib/utils")
|
|||||||
(context.data.firstname && context.data.lastname && " ") +
|
(context.data.firstname && context.data.lastname && " ") +
|
||||||
(context.data.lastname || "")
|
(context.data.lastname || "")
|
||||||
|
|
||||||
context.mail({
|
context.smtp.sendMail({
|
||||||
to: config.operatorEmail,
|
to: config.operatorEmail,
|
||||||
from: emailFrom,
|
from: emailFrom,
|
||||||
fromName: emailFromName,
|
fromName: emailFromName,
|
||||||
@ -27,7 +27,7 @@ var utils = require("../lib/utils")
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {import('wmbasic-api-types').HookResponse} */
|
/** @type {import('tibi-types').HookResponse} */
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
var response = null
|
var response = null
|
||||||
return response
|
return response
|
||||||
|
@ -22,7 +22,7 @@ function randomToken() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('wmbasic-api-types').HookContext} c
|
* @param {import('tibi-types').HookContext} c
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isPublicToken(c) {
|
function isPublicToken(c) {
|
||||||
@ -34,7 +34,7 @@ function isPublicToken(c) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('wmbasic-api-types').HookContext} c
|
* @param {import('tibi-types').HookContext} c
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isSsrToken(c) {
|
function isSsrToken(c) {
|
||||||
@ -46,7 +46,7 @@ function isSsrToken(c) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import('wmbasic-api-types').HookContext} c
|
* @param {import('tibi-types').HookContext} c
|
||||||
* @param {string} filename
|
* @param {string} filename
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
"baseUrl": "http://localhost:3000",
|
"baseUrl": "http://localhost:3000",
|
||||||
"env": {
|
"env": {
|
||||||
"mongodbUri": "mongodb://localhost",
|
"mongodbUri": "mongodb://localhost",
|
||||||
"wmbasicApiUrl": "http://localhost:8080/api/v1",
|
"tibiApiUrl": "http://localhost:8080/api/v1",
|
||||||
"wmbasicDbPrefix": "wmbasic",
|
"tibiDbPrefix": "tibi",
|
||||||
"wmbasicUsername": "admin",
|
"tibiUsername": "admin",
|
||||||
"wmbasicPassword": "admin",
|
"tibiPassword": "admin",
|
||||||
"projectApiConfig": "./api/config.yml",
|
"projectApiConfig": "./api/config.yml",
|
||||||
"projectApiNamespace": "cypress_test"
|
"projectApiNamespace": "cypress_test"
|
||||||
}
|
}
|
||||||
|
@ -53,32 +53,32 @@ module.exports = (on, config) => {
|
|||||||
// is continous integration test run, so initialize database
|
// is continous integration test run, so initialize database
|
||||||
console.log("CI RUN: init database")
|
console.log("CI RUN: init database")
|
||||||
|
|
||||||
const wmbasicDbPrefix = config.env.wmbasicDbPrefix
|
const tibiDbPrefix = config.env.tibiDbPrefix
|
||||||
const projectNamespace = config.env.projectApiNamespace
|
const projectNamespace = config.env.projectApiNamespace
|
||||||
|
|
||||||
// drop database from tests before
|
// drop database from tests before
|
||||||
console.log(" - connecting to mongodb: " + config.env.mongodbUri)
|
console.log(" - connecting to mongodb: " + config.env.mongodbUri)
|
||||||
const dbClient = new MongoClient(config.env.mongodbUri)
|
const dbClient = new MongoClient(config.env.mongodbUri)
|
||||||
await dbClient.connect()
|
await dbClient.connect()
|
||||||
console.log(" - removing project from wmbasic db")
|
console.log(" - removing project from tibi db")
|
||||||
let db = dbClient.db(wmbasicDbPrefix)
|
let db = dbClient.db(tibiDbPrefix)
|
||||||
db.collection("project").deleteMany({ namespace: projectNamespace })
|
db.collection("project").deleteMany({ namespace: projectNamespace })
|
||||||
|
|
||||||
const dbName = wmbasicDbPrefix + "_" + projectNamespace
|
const dbName = tibiDbPrefix + "_" + projectNamespace
|
||||||
console.log(" - dropping database: " + dbName)
|
console.log(" - dropping database: " + dbName)
|
||||||
db = dbClient.db(dbName)
|
db = dbClient.db(dbName)
|
||||||
await db.dropDatabase()
|
await db.dropDatabase()
|
||||||
|
|
||||||
// login
|
// login
|
||||||
const apiUrl = config.env.wmbasicApiUrl
|
const apiUrl = config.env.tibiApiUrl
|
||||||
const l = await axios.post(apiUrl + "/login", {
|
const l = await axios.post(apiUrl + "/login", {
|
||||||
username: config.env.wmbasicUsername,
|
username: config.env.tibiUsername,
|
||||||
password: config.env.wmbasicPassword,
|
password: config.env.tibiPassword,
|
||||||
})
|
})
|
||||||
const wmbasicToken = l.data.token
|
const tibiToken = l.data.token
|
||||||
|
|
||||||
// create project
|
// create project
|
||||||
console.log(" - creating wmbasic project: " + projectNamespace)
|
console.log(" - creating tibi project: " + projectNamespace)
|
||||||
let project
|
let project
|
||||||
try {
|
try {
|
||||||
const p = await axios.post(
|
const p = await axios.post(
|
||||||
@ -91,7 +91,7 @@ module.exports = (on, config) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
"X-Auth-Token": wmbasicToken,
|
"X-Auth-Token": tibiToken,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -105,7 +105,7 @@ module.exports = (on, config) => {
|
|||||||
try {
|
try {
|
||||||
const p = await axios.get(apiUrl + "/project/" + project.id, {
|
const p = await axios.get(apiUrl + "/project/" + project.id, {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Auth-Token": wmbasicToken,
|
"X-Auth-Token": tibiToken,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (!p.data.api.isOnline) {
|
if (!p.data.api.isOnline) {
|
||||||
@ -116,7 +116,7 @@ module.exports = (on, config) => {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO fill wmbasic database with test data
|
// TODO fill tibi database with test data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ services:
|
|||||||
mongo:
|
mongo:
|
||||||
image: mongo
|
image: mongo
|
||||||
|
|
||||||
wmbasic-api:
|
tibi-server:
|
||||||
image: registry.webmakers.de/wmbasic/wmbasic-api
|
image: registry.webmakers.de/tibi/tibi-server
|
||||||
environment:
|
environment:
|
||||||
DB_DIAL: mongodb://mongo
|
DB_DIAL: mongodb://mongo
|
||||||
API_PORT: 8080
|
API_PORT: 8080
|
||||||
@ -32,9 +32,9 @@ services:
|
|||||||
|
|
||||||
liveserver:
|
liveserver:
|
||||||
image: node
|
image: node
|
||||||
command: yarn run -- live-server --no-browser --port=80 --ignore='*' --entry-file=spa.html --no-css-inject --proxy=/api:http://wmbasic-api:8080/api/v1/_/einfo_test dist
|
command: yarn run -- live-server --no-browser --port=80 --ignore='*' --entry-file=spa.html --no-css-inject --proxy=/api:http://tibi-server:8080/api/v1/_/einfo_test dist
|
||||||
depends_on:
|
depends_on:
|
||||||
- wmbasic-api
|
- tibi-server
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/workdir
|
- ./:/workdir
|
||||||
working_dir: /workdir
|
working_dir: /workdir
|
||||||
@ -47,7 +47,7 @@ services:
|
|||||||
CYPRESS_BASE_URL: http://liveserver
|
CYPRESS_BASE_URL: http://liveserver
|
||||||
CYPRESS_CI: "true"
|
CYPRESS_CI: "true"
|
||||||
CYPRESS_mongodbUri: mongodb://mongo
|
CYPRESS_mongodbUri: mongodb://mongo
|
||||||
CYPRESS_wmbasicApiUrl: http://wmbasic-api:8080/api/v1
|
CYPRESS_tibiApiUrl: http://tibi-server:8080/api/v1
|
||||||
CYPRESS_projectApiConfig: /workdir/api/config.yml
|
CYPRESS_projectApiConfig: /workdir/api/config.yml
|
||||||
DISPLAY: host.docker.internal:0.0
|
DISPLAY: host.docker.internal:0.0
|
||||||
LIBGL_ALWAYS_INDIRECT: 1
|
LIBGL_ALWAYS_INDIRECT: 1
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "wmbasic-svelte-starter",
|
"name": "tibi-svelte-starter",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Sebastian Frank (Webmakers GmbH)",
|
"author": "Sebastian Frank (Webmakers GmbH)",
|
||||||
@ -46,7 +46,7 @@
|
|||||||
"svelte-scrollto": "^0.2.0",
|
"svelte-scrollto": "^0.2.0",
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.5.5",
|
||||||
"wmbasic-api-types": "https://gitbase.de/cms/wmbasic-api-types.git"
|
"tibi-types": "https://gitbase.de/cms/tibi-types.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sentry/browser": "^6.17.3",
|
"@sentry/browser": "^6.17.3",
|
||||||
|
@ -8,6 +8,6 @@ DirectoryIndex noindex
|
|||||||
RewriteBase /
|
RewriteBase /
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^/?(.*)$ http://wmbasic_api:8080/api/v1/_/__NAMESPACE__/ssr?token=__SSR_TOKEN__&url=/$1 [P,QSA,L]
|
RewriteRule ^/?(.*)$ http://tibi-server:8080/api/v1/_/__NAMESPACE__/ssr?token=__SSR_TOKEN__&url=/$1 [P,QSA,L]
|
||||||
#RewriteRule (.*) /spa.html [QSA,L]
|
#RewriteRule (.*) /spa.html [QSA,L]
|
||||||
</ifModule>
|
</ifModule>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||||
|
|
||||||
"include": ["src/**/*", "types/**/*", "wmbasic-api-types", "api/**/*"],
|
"include": ["src/**/*", "types/**/*", "tibi-types", "api/**/*"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"typeRoots": ["./node_modules/@types", "./types"],
|
"typeRoots": ["./node_modules/@types", "./types"],
|
||||||
|
@ -7613,9 +7613,9 @@ which@^2.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
isexe "^2.0.0"
|
isexe "^2.0.0"
|
||||||
|
|
||||||
"wmbasic-api-types@https://gitbase.de/cms/wmbasic-api-types.git":
|
"tibi-types@https://gitbase.de/cms/tibi-types.git":
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://gitbase.de/cms/wmbasic-api-types.git#590f8233cec7c66f9c9844567f5a5dccb81451f3"
|
resolved "https://gitbase.de/cms/tibi-types.git#590f8233cec7c66f9c9844567f5a5dccb81451f3"
|
||||||
|
|
||||||
wrap-ansi@^6.2.0:
|
wrap-ansi@^6.2.0:
|
||||||
version "6.2.0"
|
version "6.2.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user