renamed to tibi-svelte-starter
This commit is contained in:
parent
66d8313316
commit
5843680e14
@ -49,11 +49,11 @@ steps:
|
||||
- name: cache
|
||||
path: /cache
|
||||
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
|
||||
|
||||
- name: wmbasic-api
|
||||
image: registry.webmakers.de/wmbasic/wmbasic-api
|
||||
- name: tibi-server
|
||||
image: registry.webmakers.de/tibi/tibi-server
|
||||
pull: never
|
||||
environment:
|
||||
DB_DIAL: mongodb://mongo
|
||||
@ -72,7 +72,7 @@ steps:
|
||||
CYPRESS_BASE_URL: http://liveserver
|
||||
CYPRESS_CI: "true"
|
||||
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
|
||||
commands:
|
||||
- ln -s /cache/user-cache ~/.cache
|
||||
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -26,9 +26,9 @@
|
||||
"debug.allowBreakpointsEverywhere": true,
|
||||
"html.autoClosingTags": false,
|
||||
"yaml.schemas": {
|
||||
"node_modules/wmbasic-api-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/wmbasic-api-types/schemas/api-config/field.json": "api/collections/fields/*.y*ml"
|
||||
"node_modules/tibi-types/schemas/api-config/config.json": "api/config.y*ml",
|
||||
"node_modules/tibi-types/schemas/api-config/collection.json": "api/collections/*.y*ml",
|
||||
"node_modules/tibi-types/schemas/api-config/field.json": "api/collections/fields/*.y*ml"
|
||||
},
|
||||
"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?
|
||||
|
||||
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.
|
||||
|
||||
@ -25,7 +25,7 @@ yarn start
|
||||
oder mit abweichender API für "/api"-Proxy
|
||||
|
||||
```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)
|
||||
|
@ -15,7 +15,7 @@ var utils = require("../lib/utils")
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {import('wmbasic-api-types').HookResponse} */
|
||||
/** @type {import('tibi-types').HookResponse} */
|
||||
// @ts-ignore
|
||||
var response = null
|
||||
return response
|
||||
|
@ -11,7 +11,7 @@ var utils = require("../lib/utils")
|
||||
(context.data.firstname && context.data.lastname && " ") +
|
||||
(context.data.lastname || "")
|
||||
|
||||
context.mail({
|
||||
context.smtp.sendMail({
|
||||
to: config.operatorEmail,
|
||||
from: emailFrom,
|
||||
fromName: emailFromName,
|
||||
@ -27,7 +27,7 @@ var utils = require("../lib/utils")
|
||||
})
|
||||
}
|
||||
|
||||
/** @type {import('wmbasic-api-types').HookResponse} */
|
||||
/** @type {import('tibi-types').HookResponse} */
|
||||
// @ts-ignore
|
||||
var response = null
|
||||
return response
|
||||
|
@ -22,7 +22,7 @@ function randomToken() {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import('wmbasic-api-types').HookContext} c
|
||||
* @param {import('tibi-types').HookContext} c
|
||||
* @returns {boolean}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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
|
||||
* @returns {string}
|
||||
*/
|
||||
|
@ -2,10 +2,10 @@
|
||||
"baseUrl": "http://localhost:3000",
|
||||
"env": {
|
||||
"mongodbUri": "mongodb://localhost",
|
||||
"wmbasicApiUrl": "http://localhost:8080/api/v1",
|
||||
"wmbasicDbPrefix": "wmbasic",
|
||||
"wmbasicUsername": "admin",
|
||||
"wmbasicPassword": "admin",
|
||||
"tibiApiUrl": "http://localhost:8080/api/v1",
|
||||
"tibiDbPrefix": "tibi",
|
||||
"tibiUsername": "admin",
|
||||
"tibiPassword": "admin",
|
||||
"projectApiConfig": "./api/config.yml",
|
||||
"projectApiNamespace": "cypress_test"
|
||||
}
|
||||
|
@ -53,32 +53,32 @@ module.exports = (on, config) => {
|
||||
// is continous integration test run, so initialize database
|
||||
console.log("CI RUN: init database")
|
||||
|
||||
const wmbasicDbPrefix = config.env.wmbasicDbPrefix
|
||||
const tibiDbPrefix = config.env.tibiDbPrefix
|
||||
const projectNamespace = config.env.projectApiNamespace
|
||||
|
||||
// drop database from tests before
|
||||
console.log(" - connecting to mongodb: " + config.env.mongodbUri)
|
||||
const dbClient = new MongoClient(config.env.mongodbUri)
|
||||
await dbClient.connect()
|
||||
console.log(" - removing project from wmbasic db")
|
||||
let db = dbClient.db(wmbasicDbPrefix)
|
||||
console.log(" - removing project from tibi db")
|
||||
let db = dbClient.db(tibiDbPrefix)
|
||||
db.collection("project").deleteMany({ namespace: projectNamespace })
|
||||
|
||||
const dbName = wmbasicDbPrefix + "_" + projectNamespace
|
||||
const dbName = tibiDbPrefix + "_" + projectNamespace
|
||||
console.log(" - dropping database: " + dbName)
|
||||
db = dbClient.db(dbName)
|
||||
await db.dropDatabase()
|
||||
|
||||
// login
|
||||
const apiUrl = config.env.wmbasicApiUrl
|
||||
const apiUrl = config.env.tibiApiUrl
|
||||
const l = await axios.post(apiUrl + "/login", {
|
||||
username: config.env.wmbasicUsername,
|
||||
password: config.env.wmbasicPassword,
|
||||
username: config.env.tibiUsername,
|
||||
password: config.env.tibiPassword,
|
||||
})
|
||||
const wmbasicToken = l.data.token
|
||||
const tibiToken = l.data.token
|
||||
|
||||
// create project
|
||||
console.log(" - creating wmbasic project: " + projectNamespace)
|
||||
console.log(" - creating tibi project: " + projectNamespace)
|
||||
let project
|
||||
try {
|
||||
const p = await axios.post(
|
||||
@ -91,7 +91,7 @@ module.exports = (on, config) => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"X-Auth-Token": wmbasicToken,
|
||||
"X-Auth-Token": tibiToken,
|
||||
},
|
||||
}
|
||||
)
|
||||
@ -105,7 +105,7 @@ module.exports = (on, config) => {
|
||||
try {
|
||||
const p = await axios.get(apiUrl + "/project/" + project.id, {
|
||||
headers: {
|
||||
"X-Auth-Token": wmbasicToken,
|
||||
"X-Auth-Token": tibiToken,
|
||||
},
|
||||
})
|
||||
if (!p.data.api.isOnline) {
|
||||
@ -116,7 +116,7 @@ module.exports = (on, config) => {
|
||||
throw e
|
||||
}
|
||||
|
||||
// TODO fill wmbasic database with test data
|
||||
// TODO fill tibi database with test data
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -18,8 +18,8 @@ services:
|
||||
mongo:
|
||||
image: mongo
|
||||
|
||||
wmbasic-api:
|
||||
image: registry.webmakers.de/wmbasic/wmbasic-api
|
||||
tibi-server:
|
||||
image: registry.webmakers.de/tibi/tibi-server
|
||||
environment:
|
||||
DB_DIAL: mongodb://mongo
|
||||
API_PORT: 8080
|
||||
@ -32,9 +32,9 @@ services:
|
||||
|
||||
liveserver:
|
||||
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:
|
||||
- wmbasic-api
|
||||
- tibi-server
|
||||
volumes:
|
||||
- ./:/workdir
|
||||
working_dir: /workdir
|
||||
@ -47,7 +47,7 @@ services:
|
||||
CYPRESS_BASE_URL: http://liveserver
|
||||
CYPRESS_CI: "true"
|
||||
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
|
||||
DISPLAY: host.docker.internal:0.0
|
||||
LIBGL_ALWAYS_INDIRECT: 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "wmbasic-svelte-starter",
|
||||
"name": "tibi-svelte-starter",
|
||||
"version": "1.0.0",
|
||||
"main": "src/index.js",
|
||||
"author": "Sebastian Frank (Webmakers GmbH)",
|
||||
@ -46,7 +46,7 @@
|
||||
"svelte-scrollto": "^0.2.0",
|
||||
"tslib": "^2.3.1",
|
||||
"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": {
|
||||
"@sentry/browser": "^6.17.3",
|
||||
|
@ -8,6 +8,6 @@ DirectoryIndex noindex
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
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]
|
||||
</ifModule>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
|
||||
"include": ["src/**/*", "types/**/*", "wmbasic-api-types", "api/**/*"],
|
||||
"include": ["src/**/*", "types/**/*", "tibi-types", "api/**/*"],
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"typeRoots": ["./node_modules/@types", "./types"],
|
||||
|
@ -7613,9 +7613,9 @@ which@^2.0.1:
|
||||
dependencies:
|
||||
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"
|
||||
resolved "https://gitbase.de/cms/wmbasic-api-types.git#590f8233cec7c66f9c9844567f5a5dccb81451f3"
|
||||
resolved "https://gitbase.de/cms/tibi-types.git#590f8233cec7c66f9c9844567f5a5dccb81451f3"
|
||||
|
||||
wrap-ansi@^6.2.0:
|
||||
version "6.2.0"
|
||||
|
Loading…
Reference in New Issue
Block a user