From 212a9720cfd0b3ba1ddc1c5108a7006071974c80 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Wed, 26 Mar 2025 17:44:06 +0000 Subject: [PATCH] first clean up --- .env | 13 +- babel.config.cypress.json | 5 - cypress.json | 12 -- cypress/fixtures/example.json | 5 - cypress/integration/0-renz-einfo/demo.spec.js | 22 ---- cypress/plugins/index.js | 124 ------------------ cypress/support/commands.js | 25 ---- cypress/support/index.js | 41 ------ cypress/tsconfig.json | 7 - docker-compose-local.yml | 39 +----- docker-compose.cypress.yml | 65 --------- esbuild.config.cypress.js | 6 - scripts/cy-command.docker.sh | 10 -- .../widgets/ContentMediaFile.svelte | 10 -- .../__UNUSED__/widgets/Galleries.svelte | 107 --------------- .../widgets/GeneralMediaImage.svelte | 27 ---- .../__UNUSED__/widgets/GoogleMaps.svelte | 22 ---- .../__UNUSED__/widgets/Modal.svelte | 35 ----- .../__UNUSED__/widgets/details/Default.svelte | 29 ---- .../__UNUSED__/widgets/details/News.svelte | 29 ---- .../__UNUSED__/widgets/details/index.ts | 7 - types/global.d.ts | 12 -- 22 files changed, 9 insertions(+), 643 deletions(-) delete mode 100644 babel.config.cypress.json delete mode 100644 cypress.json delete mode 100644 cypress/fixtures/example.json delete mode 100644 cypress/integration/0-renz-einfo/demo.spec.js delete mode 100644 cypress/plugins/index.js delete mode 100644 cypress/support/commands.js delete mode 100644 cypress/support/index.js delete mode 100644 cypress/tsconfig.json delete mode 100644 docker-compose.cypress.yml delete mode 100644 esbuild.config.cypress.js delete mode 100755 scripts/cy-command.docker.sh delete mode 100644 src/components/__UNUSED__/widgets/ContentMediaFile.svelte delete mode 100644 src/components/__UNUSED__/widgets/Galleries.svelte delete mode 100644 src/components/__UNUSED__/widgets/GeneralMediaImage.svelte delete mode 100644 src/components/__UNUSED__/widgets/GoogleMaps.svelte delete mode 100644 src/components/__UNUSED__/widgets/Modal.svelte delete mode 100644 src/components/__UNUSED__/widgets/details/Default.svelte delete mode 100644 src/components/__UNUSED__/widgets/details/News.svelte delete mode 100644 src/components/__UNUSED__/widgets/details/index.ts diff --git a/.env b/.env index d303b7a..c79eec8 100644 --- a/.env +++ b/.env @@ -1,6 +1,9 @@ -PROJECT_NAME=tibi-svelte-starter +PROJECT_NAME=__PROJECT_NAME__ TIBI_PREFIX=tibi -TIBI_NAMESPACE=__NAMESPACE__ -# code-server user -UID=100 -GID=101 +TIBI_NAMESPACE=__TIBI_NAMESPACE__ +CODER_UID=100 +CODER_GID=101 +SENTRY_URL=https://sentry.basehosts.de +SENTRY_ORG=webmakers +SENTRY_PROJECT= +START_SCRIPT=:ssr diff --git a/babel.config.cypress.json b/babel.config.cypress.json deleted file mode 100644 index c513c68..0000000 --- a/babel.config.cypress.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceMaps": "inline", - "inputSourceMap": true, - "plugins": ["istanbul"] -} diff --git a/cypress.json b/cypress.json deleted file mode 100644 index a36957e..0000000 --- a/cypress.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "baseUrl": "http://localhost:3000", - "env": { - "mongodbUri": "mongodb://localhost", - "tibiApiUrl": "http://localhost:8080/api/v1", - "tibiDbPrefix": "tibi", - "tibiUsername": "admin", - "tibiPassword": "admin", - "projectApiConfig": "./api/config.yml", - "projectApiNamespace": "cypress_test" - } -} diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index 02e4254..0000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/cypress/integration/0-renz-einfo/demo.spec.js b/cypress/integration/0-renz-einfo/demo.spec.js deleted file mode 100644 index 4f8d37c..0000000 --- a/cypress/integration/0-renz-einfo/demo.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -/// - -const { before } = require("../../support") - -// @ts-check - -describe("renz einfo auth", () => { - beforeEach(() => { - before() - }) - - afterEach(function () { - if (this.currentTest.state === "failed") { - cy.setCookie("shouldSkip", "true") - Cypress.runner.stop() - } - }) - - it("can visit homepage", () => { - cy.visit("/") - }) -}) diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js deleted file mode 100644 index fe57bd1..0000000 --- a/cypress/plugins/index.js +++ /dev/null @@ -1,124 +0,0 @@ -/// -// @ts-check - -const { default: axios } = require("axios") -const { MongoClient } = require("mongodb") -const fs = require("fs") -const util = require("util") - -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -function logObj(o) { - console.log(util.inspect(o, false, null, true /* enable colors */)) -} - -/** - * @type {Cypress.PluginConfig} - */ -// eslint-disable-next-line no-unused-vars -module.exports = (on, config) => { - require("cypress-terminal-report/src/installLogsPrinter")(on, { - printLogsToConsole: "always", - includeSuccessfulHookLogs: true, - }) - - const registerCodeCoverageTask = require("@cypress/code-coverage/task") - - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - on("before:run", async (details) => { - /* - if (details.specs && details.browser) { - // details.specs and details.browser will be undefined in interactive mode - console.log( - "Running", - details.specs.length, - "specs in", - details.browser.name - ) - }*/ - - if (config.env.CI) { - // is continous integration test run, so initialize database - console.log("CI RUN: init database") - - 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 tibi db") - let db = dbClient.db(tibiDbPrefix) - db.collection("project").deleteMany({ namespace: projectNamespace }) - - const dbName = tibiDbPrefix + "_" + projectNamespace - console.log(" - dropping database: " + dbName) - db = dbClient.db(dbName) - await db.dropDatabase() - - // login - const apiUrl = config.env.tibiApiUrl - const l = await axios.post(apiUrl + "/login", { - username: config.env.tibiUsername, - password: config.env.tibiPassword, - }) - const tibiToken = l.data.token - - // create project - console.log(" - creating tibi project: " + projectNamespace) - let project - try { - const p = await axios.post( - apiUrl + "/project", - { - configFile: config.env.projectApiConfig, - name: projectNamespace, - namespace: projectNamespace, - description: projectNamespace, - }, - { - headers: { - "X-Auth-Token": tibiToken, - }, - } - ) - project = p.data - } catch (e) { - logObj(e) - throw e - } - - console.log(" - checking project status: " + project.id) - try { - const p = await axios.get(apiUrl + "/project/" + project.id, { - headers: { - "X-Auth-Token": tibiToken, - }, - }) - if (!p.data.api.isOnline) { - throw p.data - } - } catch (e) { - logObj(e) - throw e - } - - // TODO fill tibi database with test data - } - }) - - return registerCodeCoverageTask(on, config) -} diff --git a/cypress/support/commands.js b/cypress/support/commands.js deleted file mode 100644 index 119ab03..0000000 --- a/cypress/support/commands.js +++ /dev/null @@ -1,25 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) diff --git a/cypress/support/index.js b/cypress/support/index.js deleted file mode 100644 index 8421c0f..0000000 --- a/cypress/support/index.js +++ /dev/null @@ -1,41 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import "./commands" - -import installLogsCollector from "cypress-terminal-report/src/installLogsCollector" -installLogsCollector() - -import "@cypress/code-coverage/support" - -// Alternatively you can use CommonJS syntax: -// require('./commands') - -export const before = () => { - if (Cypress.browser.isHeaded) { - cy.clearCookie("shouldSkip") - } else { - cy.getCookie("shouldSkip").then((cookie) => { - if ( - cookie && - typeof cookie === "object" && - cookie.value === "true" - ) { - Cypress.runner.stop() - } - }) - } -} diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json deleted file mode 100644 index b4a6564..0000000 --- a/cypress/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "include": ["**/*"], - "exclude": [], - "compilerOptions": { - "preserveValueImports": false - } -} diff --git a/docker-compose-local.yml b/docker-compose-local.yml index 796c67f..a0b2361 100644 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -1,5 +1,4 @@ -version: "3.8" -name: tibi-svelte-starter-local +name: ${PROJECT_NAME} services: yarnstart: @@ -9,14 +8,8 @@ services: - ./:/data working_dir: /data command: sh -c "yarn install && API_BASE=http://tibiserver:8080/api/v1/_/${TIBI_NAMESPACE} yarn start" - # ports: - # - ${PORT:-3000}:3000 - # - ${BROWSERSYNC_PORT:-4001}:3001 expose: - 3000 - # networks: - # - default - # - traefik_web labels: - traefik.enable=true - online.testversion.code.subdomain=${PROJECT_NAME} @@ -30,7 +23,6 @@ services: volumes: - ./:/data environment: - # DB_DIAL: mongodb://root:root@mongo/admin DB_DIAL: mongodb://mongo DB_PREFIX: ${TIBI_PREFIX} MAIL_HOST: maildev:25 @@ -49,7 +41,6 @@ services: working_dir: /tibi-server environment: GOCACHE: /tmp/ - # DB_DIAL: mongodb://root:root@mongo/admin DB_DIAL: mongodb://mongo DB_PREFIX: ${TIBI_PREFIX} MAIL_HOST: maildev:25 @@ -68,13 +59,8 @@ services: PORT: 80 depends_on: - tibiserver - # ports: - # - ${ADMIN_PORT:-3002}:80 expose: - 80 - # networks: - # - default - # - traefik_web labels: - traefik.enable=true - online.testversion.code.subdomain=${PROJECT_NAME}-tibiadmin @@ -103,15 +89,6 @@ services: user: ${UID}:${GID} volumes: - ./tmp/mongo-data:/data/db - # command: mongod --logpath=/dev/null - # environment: - # MONGO_INITDB_ROOT_USERNAME: root - # MONGO_INITDB_ROOT_PASSWORD: root - - # adminder: - # image: gitbase.de/server/adminer - # ports: - # - ${PORT:-18080}:8080 adminmongo: image: gitbase.de/server/adminmongo @@ -121,13 +98,8 @@ services: # DB_PASSWORD: root DB_HOST: mongo PORT: 1234 - # ports: - # - ${ADMINMONGO_PORT:-3003}:1234 expose: - 1234 - # networks: - # - default - # - traefik_web labels: - traefik.enable=true - online.testversion.code.subdomain=${PROJECT_NAME}-adminmongo @@ -136,21 +108,12 @@ services: maildev: image: maildev/maildev - # restart: always - # ports: - # - ${MAILDEV_PORT:-3004}:80 command: node bin/maildev --web 1080 --smtp 25 -v --hide-extensions=STARTTLS expose: - 1080 - # networks: - # - default - # - traefik_web labels: - traefik.enable=true - online.testversion.code.subdomain=${PROJECT_NAME}-maildev - traefik.http.services.${PROJECT_NAME}-maildev.loadbalancer.server.port=1080 - traefik.http.routers.${PROJECT_NAME}-maildev.middlewares=${PROJECT_NAME}-maildev - traefik.http.middlewares.${PROJECT_NAME}-maildev.basicauth.usersfile=${PWD}/.basic-auth-code -# networks: -# traefik_web: -# external: true diff --git a/docker-compose.cypress.yml b/docker-compose.cypress.yml deleted file mode 100644 index 86a7aeb..0000000 --- a/docker-compose.cypress.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: "3.9" - -services: - maildev: - image: maildev/maildev - command: - [ - node, - bin/maildev, - --web, - "80", - --smtp, - "25", - -v, - --hide-extensions=STARTTLS, - ] - - mongo: - image: mongo - - tibi-server: - image: registry.webmakers.de/tibi/tibi-server - environment: - DB_DIAL: mongodb://mongo - API_PORT: 8080 - MAIL_HOST: maildev:25 - depends_on: - - maildev - - mongo - volumes: - - ./:/workdir - - liveserver: - image: node - 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: - - tibi-server - volumes: - - ./:/workdir - working_dir: /workdir - - cypress: - #image: cypress/base - image: cypress/browsers:node14.17.0-chrome91-ff89 - environment: - FORCE_COLOR: "true" - CYPRESS_BASE_URL: http://liveserver - CYPRESS_CI: "true" - CYPRESS_mongodbUri: mongodb://mongo - CYPRESS_tibiApiUrl: http://tibi-server:8080/api/v1 - CYPRESS_projectApiConfig: /workdir/api/config.yml - #DISPLAY: host.docker.internal:0.0 - DISPLAY: $DISPLAY - LIBGL_ALWAYS_INDIRECT: 1 - command: sh ./scripts/cy-command.docker.sh $CY_COMMAND - #command: yarn cy:$CY_COMMAND - depends_on: - - liveserver - volumes: - - ./:/workdir - - ~/.cache:/home/node/.cache - - $HOME/.Xauthority:$HOME/.Xauthority - - /tmp/.X11-unix:/tmp/.X11-unix - working_dir: /workdir - user: $CURRENT_UID diff --git a/esbuild.config.cypress.js b/esbuild.config.cypress.js deleted file mode 100644 index bcd168f..0000000 --- a/esbuild.config.cypress.js +++ /dev/null @@ -1,6 +0,0 @@ -const config = require("./esbuild.config.js") - -config.options.sourcemap = "inline" -config.options.minify = false - -module.exports = config diff --git a/scripts/cy-command.docker.sh b/scripts/cy-command.docker.sh deleted file mode 100755 index bfac7c2..0000000 --- a/scripts/cy-command.docker.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -#export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0 -#export DISPLAY=host.docker.internal:0.0 -rm -r coverage -rm -r .nyc_output -yarn build:instanbul -echo DISPLAY: $DISPLAY -yarn cy:$1 - diff --git a/src/components/__UNUSED__/widgets/ContentMediaFile.svelte b/src/components/__UNUSED__/widgets/ContentMediaFile.svelte deleted file mode 100644 index 20cc868..0000000 --- a/src/components/__UNUSED__/widgets/ContentMediaFile.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/src/components/__UNUSED__/widgets/Galleries.svelte b/src/components/__UNUSED__/widgets/Galleries.svelte deleted file mode 100644 index 03b0a7b..0000000 --- a/src/components/__UNUSED__/widgets/Galleries.svelte +++ /dev/null @@ -1,107 +0,0 @@ - - - - -
- {#each galleries || [] as gallery} - - {/each} - - {#if selectedGallery && selectedImage} - - - - {/if} -
diff --git a/src/components/__UNUSED__/widgets/GeneralMediaImage.svelte b/src/components/__UNUSED__/widgets/GeneralMediaImage.svelte deleted file mode 100644 index 4e6e956..0000000 --- a/src/components/__UNUSED__/widgets/GeneralMediaImage.svelte +++ /dev/null @@ -1,27 +0,0 @@ - - -{#if id} - {#each $generalInfo?.media?.mediaFiles || [] as mediaFile} - {#if mediaFile.id === id && mediaFile.file} - {#if mediaFile.file.src.includes(";base64,")} - {mediaFile.alternateText ? mediaFile.alternateText + ' - ' : ''} - {:else} - {mediaFile.alternateText ? mediaFile.alternateText : mediaFile.file.path} - {/if} - {/if} - {/each} -{/if} diff --git a/src/components/__UNUSED__/widgets/GoogleMaps.svelte b/src/components/__UNUSED__/widgets/GoogleMaps.svelte deleted file mode 100644 index b6fbb59..0000000 --- a/src/components/__UNUSED__/widgets/GoogleMaps.svelte +++ /dev/null @@ -1,22 +0,0 @@ - - -{#if $ccTags?.includes("googleMaps")} - -{/if} diff --git a/src/components/__UNUSED__/widgets/Modal.svelte b/src/components/__UNUSED__/widgets/Modal.svelte deleted file mode 100644 index 2b4f6dd..0000000 --- a/src/components/__UNUSED__/widgets/Modal.svelte +++ /dev/null @@ -1,35 +0,0 @@ - - - diff --git a/src/components/__UNUSED__/widgets/details/Default.svelte b/src/components/__UNUSED__/widgets/details/Default.svelte deleted file mode 100644 index f613e63..0000000 --- a/src/components/__UNUSED__/widgets/details/Default.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - -{#if entry} -
-
-
-
- {#if entry?.article?.content?.title} -

{@html entry?.article?.content?.title}

- {/if} - - {#if entry?.article?.content?.subtitle} -
{@html entry?.article?.content?.subtitle}
- {/if} - - {#if entry?.article?.content?.types?.teaser} - - {/if} - - {#if entry?.article?.content?.types?.details} -
{@html entry?.article?.content?.types?.details}
- {/if} -
-
-
-
-{/if} diff --git a/src/components/__UNUSED__/widgets/details/News.svelte b/src/components/__UNUSED__/widgets/details/News.svelte deleted file mode 100644 index f613e63..0000000 --- a/src/components/__UNUSED__/widgets/details/News.svelte +++ /dev/null @@ -1,29 +0,0 @@ - - -{#if entry} -
-
-
-
- {#if entry?.article?.content?.title} -

{@html entry?.article?.content?.title}

- {/if} - - {#if entry?.article?.content?.subtitle} -
{@html entry?.article?.content?.subtitle}
- {/if} - - {#if entry?.article?.content?.types?.teaser} - - {/if} - - {#if entry?.article?.content?.types?.details} -
{@html entry?.article?.content?.types?.details}
- {/if} -
-
-
-
-{/if} diff --git a/src/components/__UNUSED__/widgets/details/index.ts b/src/components/__UNUSED__/widgets/details/index.ts deleted file mode 100644 index 83928f7..0000000 --- a/src/components/__UNUSED__/widgets/details/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Default from "./Default.svelte" -import News from "./News.svelte" - -export default { - default: Default, - news: News, -} diff --git a/types/global.d.ts b/types/global.d.ts index e2a32e1..4aa62de 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -131,15 +131,3 @@ interface Locale { key: string title?: string } - -// interface Gallery { -// id: string -// title: string -// variant: string -// items: { -// file: File -// title: string -// descrition: string -// alt: string -// }[] -// }