diff --git a/.drone.yml b/.drone.yml index 51dc399..4e7e9a5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 diff --git a/.vscode/settings.json b/.vscode/settings.json index 3fedda8..87b755e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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"] } diff --git a/README.md b/README.md index 554c7cb..797c3a4 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/api/hooks/contact_form/post_create.js b/api/hooks/contact_form/post_create.js index b279a19..bd0a89f 100644 --- a/api/hooks/contact_form/post_create.js +++ b/api/hooks/contact_form/post_create.js @@ -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 diff --git a/api/hooks/contact_form/post_return.js b/api/hooks/contact_form/post_return.js index 14c01ce..60f49d1 100644 --- a/api/hooks/contact_form/post_return.js +++ b/api/hooks/contact_form/post_return.js @@ -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 diff --git a/api/hooks/lib/utils.js b/api/hooks/lib/utils.js index 68f6674..6faded3 100644 --- a/api/hooks/lib/utils.js +++ b/api/hooks/lib/utils.js @@ -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} */ diff --git a/cypress.json b/cypress.json index 0ea3c1a..a36957e 100644 --- a/cypress.json +++ b/cypress.json @@ -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" } diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 6cdba11..fe57bd1 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -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 } }) diff --git a/docker-compose.cypress.yml b/docker-compose.cypress.yml index 5f341be..90c9323 100644 --- a/docker-compose.cypress.yml +++ b/docker-compose.cypress.yml @@ -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 diff --git a/package.json b/package.json index 7d107fb..ae9dd03 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/.htaccess b/public/.htaccess index 88b2faf..c6aeead 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -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] diff --git a/tsconfig.json b/tsconfig.json index c68d368..be40ac4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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"], diff --git a/yarn.lock b/yarn.lock index 2170ef6..a0914b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"