Foldende Konstanten können bzw. müssen in der Datei .env im Root-Verzeichnis dieser App gesetzt werden:
Alle Daten werden in der lokalen Postgres-Datenbank gespeichert. Die Umgebungsvariable ist entsprechend - siehe oben - auf localhost gesetzt.
Für die Web-Version der App müssen die Daten manuell in die unter NeonDB gehosteten Datenbank importiert werden. Die benötigte Url steht ebenfalls in der env-Datei (auskommentiert).
Es ist zu empfehlen, regelmäßig manuell ein Backup der Datenbank zu erstellen bzw. die Tabellen nach csv zu exportieren. Vor allem nach einem abgeschlossenen Spieltag sollte das gemacht werden. Anleitung siehe weiter unten.
Die App läuft normalerweise unter localhost:5173. Ein entsprechender Service ist eingerichtet.
Sollte sie nicht laufen, kann sie aus dem Entwicklungsverzeichnis 'flip4fun-svelte' heraus durch das Kommando 'npm run' gestartet werden.
Svelte: https://svelte.dev/docs/svelte/overview
Svelte Kit: https://svelte.dev/docs/kit/introduction
Flowbite Svelte: https://flowbite-svelte.com/docs/pages/introduction
Tailwind CSS: https://tailwindcss.com/docs/styling-with-utility-classes
Markdown: https://www.markdownguide.org/cheat-sheet/#overview
Diese Informationen wurden für die Entwicklung mit Svelte 4 zusammengestellt.
Da das Projekt inzwischen auf Svelte 5 umgestellt wurde, sind die Informationen u. U. teilweise nicht mehr aktuell.
Everything you need to build a Svelte project, powered by create-svelte
.
If you're seeing this, you've probably already done this step. Congrats!
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
Once you've created a project and installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview
.
To deploy your app, you may need to install an adapter for your target environment.
npm run test
npm install prisma --save-dev
npx prisma init --datasource-provider postgresql
Create an .env file in the root folder of your project, if it does not yet exist.
Add an DATABASE_URL variable and set it to a valid connection string, e.g.
DATABASE_URL="postgresql://xxxxx:yyyyy-little-credit-30716388.eu-central-1.aws.neon.tech/IsarAmper?sslmode=require"
npx prisma db pull
npx prisma db push
You may use this command to preserve migration history.
I wouldn't recommend it when you work with different target databases, e.g. using development environments, or push to local and remote database.
npx prisma migrate dev --name=..comment..
npx prisma generate
Good for remote database.
Would prefer pgadmin for local database.
npx prisma studio
This information may be outdated as it was performed with Svelte 4, but currently used version is Svelte 5.
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Add the following statements to svelte.config.js:
import { vitePreprocess } from '@sveltejs/kit/vite';
const config = {
...
preprocess: vitePreprocess()
};
Add the following statement to tailwind.config.js:
export default {
content: [
'./src/**/*.{html,js,svelte,ts}',
...
],
...
}
Add the following statements to app.css:
@tailwind base;
@tailwind components;
@tailwind utilities;
Add the following statement to your layout file:
import "../app.css";
npm install flowbite flowbite-svelte tailwind-merge @popperjs/core
Laden von
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
Dann Datenbank anlegen via
pgadmin
Dann Datenbank-Tabellen pushen via:
npx prisma db push
Um Daten von einer Datenbank in eine andere Datenbank zu bringen, z. B. von lokal nach remote, folgendermaßen vorgehen:
\copy (SELECT * FROM pin) to '..\pin.csv' WITH CSV DELIMITER '|' QUOTE '^' HEADER ENCODING 'UTF8'
\copy (SELECT * FROM player) to '..\player.csv' WITH CSV DELIMITER '|' QUOTE '^' HEADER ENCODING 'UTF8'
\copy (SELECT * FROM tourney) to '..\tourney.csv' WITH CSV DELIMITER '|' QUOTE '^' HEADER ENCODING 'UTF8'
\copy (SELECT * FROM round) to '..\round.csv' WITH CSV DELIMITER '|' QUOTE '^' HEADER ENCODING 'UTF8'
\copy (SELECT * FROM match) to '..\match.csv' WITH CSV DELIMITER '|' QUOTE '^' HEADER ENCODING 'UTF8'
Dabei folgendes beachten:
Als Delimiter immer ein Zeichen angeben, das in den Daten mit Sicherheit nicht benutzt wird. Am besten '|'. Auf keinen Fall ',' verwenden, da es in JSON-Elemente vorkommt.
Als Quote ebenfalls ein Zeichen wählen, das in den Daten nicht vorkommt, z. B '^'.
UTF8-Encoding verwenden, weil sonst Umlaute nicht korrekt importiert werden.
HEADER-Option verwenden, um die csv-Datei mit Header zu erstellen.
Tabellen- und Spaltennamen, die nicht vollständig lowercase sind, müssen immer in Anführungszeichen eingeschlossen werden. In diesem Projekt ist alles lowercase.
Zielsystem: Tabelleninhalte löschen, falls notwendig
DELETE FROM pin;
DELETE FROM player;
DELETE FROM tourney;
DELETE FROM round;
DELETE FROM match;
\copy pin FROM '..\pin.csv' DELIMITER '|' QUOTE '^' CSV HEADER ENCODING 'UTF8'
\copy player FROM '..\player.csv' DELIMITER '|' QUOTE '^' CSV HEADER ENCODING 'UTF8'
\copy tourney FROM '..\tourney.csv' DELIMITER '|' QUOTE '^' CSV HEADER ENCODING 'UTF8'
\copy round FROM '..\round.csv' DELIMITER '|' QUOTE '^' CSV HEADER ENCODING 'UTF8'
\copy match FROM '..\match.csv' DELIMITER '|' QUOTE '^' CSV HEADER ENCODING 'UTF8'
Dabei folgendes beachten:
tournament.settings
baseline
: Basispunkte für jeden Spieler zu SaisonbeginnchallengeSame
: Wie oft darf der gleiche Gegner je Saison gefordert werdenmatchBonus
: Bonuspunkt(e) für jedes absolvierte MatchmatchPenalty
: Strafpunkt(e) für Fehlmatches pro Spieltag (neu)minMatchesRound
: Wie viele Matches muss ein Spieler pro Spieltag spielen?penaltyFirstRound
: Ab welcher Runde erfolgen Punktabzüge?tournament.settings
numFinalists
: Wieviele Spieler sollen in die Finalebene aufrückenpinTypes
: Welche Art von Flipper sollen beim Double-Match gewählt werden
(0 = beliebig, 1 = 1xDMD, 1xEarly, 2 = mindestens 1xDMD)round.settings.rankInit
bonus
: Bonuspunkte zu Spieltagbeginnplayer
: player IDpoints
: Punkte zu Spieltagbeginnmatches
: Anzahl Matches zu Spieltagbeginnmismatch
: Anzahl der fehldenden Spielepenalty
: Strafpunkte zu Spieltagbeginnstrength
: Spielstärke zu Spieltagbeginnround.results.rankFinal
bonus
: Bonuspunkte Gesamt nach Spieltagplayer
: player ID,points
: Gesamtpunkte nach Spieltagmatches
: Gesamtanzahl Matches nach Spieltagmismatch
: Anzahl der fehldenden Spielepenalty
: Strafpunkte Gesamt nach SpieltagrankChange
: Rangänderung nach Spieltag