diff --git a/.forgejo/issue_template/pull_request_template.md b/.forgejo/issue_template/pull_request_template.md new file mode 100644 index 0000000..024cca0 --- /dev/null +++ b/.forgejo/issue_template/pull_request_template.md @@ -0,0 +1,4 @@ +## Checklist + +- [ ] Code has been tested locally. +- [ ] Documentation has been updated. diff --git a/.forgejo/workflows/nix-flake.yaml b/.forgejo/workflows/nix-flake.yaml new file mode 100644 index 0000000..cef6447 --- /dev/null +++ b/.forgejo/workflows/nix-flake.yaml @@ -0,0 +1,26 @@ +--- +name: nix-flake + +on: + push: + branches: + - main + pull_request: + paths: + - '**/*.nix' + +env: + NIX_CONFIG: 'experimental-features = nix-command flakes' + +jobs: + test: + runs-on: nixos-unstable + steps: + - name: prepare nix container + run: nix-env -iA nixpkgs.nodejs + + - name: checkout repository + uses: actions/checkout@v4 + + - name: flake check + run: nix flake check -L diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..784cb8a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +flake.lock binary diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md deleted file mode 100644 index 3166085..0000000 --- a/.gitlab/merge_request_templates/Default.md +++ /dev/null @@ -1,5 +0,0 @@ -### Title: type// - -#### Checklist: -- [ ] Code has been tested locally. -- [ ] Documentation has been updated. \ No newline at end of file diff --git a/README.md b/README.md index f9ae1d4..d937e4d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Authors -- Matthias Hofmarcher +- Matthias Hofmarcher - Moritz Kepplinger - Christoph Heiss - Mathias Trapl @@ -16,5 +16,5 @@ Distributed under the AGPL-3.0-or-later license ([LICENSE](LICENSE) or https://s ### Contribution Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the work by you shall be licensed by AGPL-3.0-or-later license +for inclusion in the work by you shall be licensed by AGPL-3.0-or-later license as above, without any additional terms or conditions. diff --git a/e2e/cypress/support/index.d.ts b/e2e/cypress/support/index.d.ts index 9011da0..54e5c4a 100644 --- a/e2e/cypress/support/index.d.ts +++ b/e2e/cypress/support/index.d.ts @@ -33,8 +33,8 @@ declare namespace Cypress { fillTournamentCreateFormWithInvalidData(): void; /** - * Calls the specified `testFn` with the current clipboard contents. - */ + * Calls the specified `testFn` with the current clipboard contents. + */ withClipboardContents(testFn: (content: string) => void): void; } } diff --git a/e2e/package-lock.json b/e2e/package-lock.json index 9af78cf..2f8e490 100644 --- a/e2e/package-lock.json +++ b/e2e/package-lock.json @@ -17,7 +17,7 @@ }, "devDependencies": { "nyc": "^17.0.0", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "puppeteer": "^22.11.2", "typescript": "^5.4.5" } @@ -6081,9 +6081,9 @@ } }, "node_modules/prettier": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", - "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/e2e/package.json b/e2e/package.json index 4de666c..2955c02 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -13,7 +13,7 @@ }, "devDependencies": { "nyc": "^17.0.0", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "puppeteer": "^22.11.2", "typescript": "^5.4.5" }, diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f628cb9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1724300212, + "narHash": "sha256-x3jl6OWTs+L9C7EtscuWZmGZWI0iSBDafvg3X7JMa1A=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4de4818c1ffa76d57787af936e8a23648bda6be4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724338379, + "narHash": "sha256-kKJtaiU5Ou+e/0Qs7SICXF22DLx4V/WhG1P6+k4yeOE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "070f834771efa715f3e74cd8ab93ecc96fabc951", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..eae9b1b --- /dev/null +++ b/flake.nix @@ -0,0 +1,63 @@ +{ + description = "BeerBrawl"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, treefmt-nix, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + inherit (pkgs) lib; + + treefmt = treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs = { + nixfmt = { + enable = true; + package = pkgs.nixfmt-classic; + }; + statix.enable = true; + deadnix.enable = true; + prettier = { + enable = true; + excludes = [ "backend/**" "frontend/openapi-generated/**" ]; + }; + }; + }; + + devShell = pkgs.mkShell { + inputsFrom = [ treefmt.config.build.devShell ]; + nativeBuildInputs = with pkgs; [ + jdk21 + kotlin-language-server + maven + nodePackages.prettier + nodePackages.typescript-language-server + nodejs + (java-language-server.overrideAttrs (oldAttrs: { + patches = (oldAttrs.patches or [ ]) ++ [ + (pkgs.fetchpatch { + url = + "https://github.com/georgewfraser/java-language-server/commit/801e5d233dff22627a8e2655288acffb9bd939c0.patch"; + hash = "sha256-9bPRMFPWjuIw1fbeFIzrFf9shrctT4OYnJSl2J4CwBE="; + }) + ]; + })) + ]; + }; + in { + checks.formatting = treefmt.config.build.check self; + + formatter = treefmt.config.build.wrapper; + + packages.default = devShell; + devShells.default = devShell; + }); +} diff --git a/frontend/README.md b/frontend/README.md index cd8702a..110c4de 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -2,7 +2,7 @@ ## First Steps -Navigate to the root folder of the project and execute `npm install`. Based on the *package.json* file, npm will download all required node_modules to run an Angular application. +Navigate to the root folder of the project and execute `npm install`. Based on the _package.json_ file, npm will download all required node_modules to run an Angular application. Afterwards, execute `npm install -g @angular/cli` to install the Angular CLI globally. ## Development diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ba21457..bb8576c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -63,7 +63,7 @@ "karma-jasmine": "5.1.0", "karma-jasmine-html-reporter": "2.1.0", "nyc": "^17.0.0", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "puppeteer": "^22.11.2", "ts-node": "10.9.2", "typescript": "5.4.5" @@ -15585,9 +15585,9 @@ } }, "node_modules/prettier": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", - "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/frontend/package.json b/frontend/package.json index 5bffca7..c042bfc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -71,7 +71,7 @@ "karma-jasmine": "5.1.0", "karma-jasmine-html-reporter": "2.1.0", "nyc": "^17.0.0", - "prettier": "^3.3.2", + "prettier": "^3.3.3", "puppeteer": "^22.11.2", "ts-node": "10.9.2", "typescript": "5.4.5" diff --git a/frontend/src/app/components/infoscreen-knockout-phase-tree/infoscreen-knockout-phase-tree.component.ts b/frontend/src/app/components/infoscreen-knockout-phase-tree/infoscreen-knockout-phase-tree.component.ts index e810b7b..27ab15f 100644 --- a/frontend/src/app/components/infoscreen-knockout-phase-tree/infoscreen-knockout-phase-tree.component.ts +++ b/frontend/src/app/components/infoscreen-knockout-phase-tree/infoscreen-knockout-phase-tree.component.ts @@ -80,7 +80,7 @@ export class InfoscreenKnockoutPhaseTreeComponent implements OnInit { ? ['winner'] : node.id === matchId && parentTeam && node.team && parentTeam.id !== node.team.id ? ['loser'] - : node.preceedingStandings?.flatMap(n => findNodeById(n, node.team)) ?? ['loser']; + : (node.preceedingStandings?.flatMap(n => findNodeById(n, node.team)) ?? ['loser']); const [targetNode] = findNodeById(this.tree); @@ -99,7 +99,7 @@ export class InfoscreenKnockoutPhaseTreeComponent implements OnInit { findNode = (node: KoStandingDto, matchId: number): KoStandingDto[] => node.id === matchId ? [node] - : node.preceedingStandings?.flatMap(n => this.findNode(n, matchId)) ?? []; + : (node.preceedingStandings?.flatMap(n => this.findNode(n, matchId)) ?? []); isBeginnerNode(preceedingStandings: KoStandingDto[] | undefined): boolean { return !preceedingStandings || preceedingStandings.length === 0; diff --git a/frontend/src/app/components/tournament/edit-knockout-phase-tree/edit-knockout-phase-tree.component.ts b/frontend/src/app/components/tournament/edit-knockout-phase-tree/edit-knockout-phase-tree.component.ts index 184fc40..bb3cf56 100644 --- a/frontend/src/app/components/tournament/edit-knockout-phase-tree/edit-knockout-phase-tree.component.ts +++ b/frontend/src/app/components/tournament/edit-knockout-phase-tree/edit-knockout-phase-tree.component.ts @@ -55,7 +55,7 @@ export class EditKnockoutPhaseTreeComponent implements OnInit { const getTeamsFromTree = (node: KoStandingDto): TeamDto[] => node.team ? [node.team, ...(node.preceedingStandings?.flatMap(getTeamsFromTree) ?? [])] - : node.preceedingStandings?.flatMap(getTeamsFromTree) ?? []; + : (node.preceedingStandings?.flatMap(getTeamsFromTree) ?? []); const map = new Map(); for (const team of getTeamsFromTree(this.tree)) { @@ -174,12 +174,12 @@ export class EditKnockoutPhaseTreeComponent implements OnInit { findNode = (node: KoStandingDto, matchId: number): KoStandingDto[] => node.id === matchId ? [node] - : node.preceedingStandings?.flatMap(n => this.findNode(n, matchId)) ?? []; + : (node.preceedingStandings?.flatMap(n => this.findNode(n, matchId)) ?? []); findParentNode = (node: KoStandingDto, matchId: number): KoStandingDto[] => node.preceedingStandings?.some(n => n.id === matchId) ? [node] - : node.preceedingStandings?.flatMap(n => this.findParentNode(n, matchId)) ?? []; + : (node.preceedingStandings?.flatMap(n => this.findParentNode(n, matchId)) ?? []); canSelectMatchWinner = (matchId: number) => { if (!this.tree) { diff --git a/frontend/src/karma.conf.local.js b/frontend/src/karma.conf.local.js index 7765860..108dae6 100644 --- a/frontend/src/karma.conf.local.js +++ b/frontend/src/karma.conf.local.js @@ -9,15 +9,15 @@ module.exports = function (config) { require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') + require('@angular-devkit/build-angular/plugins/karma'), ], client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser + clearContext: false, // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: require('path').join(__dirname, '../coverage'), reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true + fixWebpackSourcePaths: true, }, reporters: ['progress', 'kjhtml'], port: 9876, @@ -25,6 +25,6 @@ module.exports = function (config) { logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], - singleRun: false + singleRun: false, }); };