mirror of
https://codeberg.org/beerbrawl/beerbrawl.git
synced 2024-09-22 21:20:52 +02:00
Merge pull request 'provide a nix-based dev shell' (#10) from nix/flake into main
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
commit
6e2eaf5c21
4
.forgejo/issue_template/pull_request_template.md
Normal file
4
.forgejo/issue_template/pull_request_template.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
## Checklist
|
||||
|
||||
- [ ] Code has been tested locally.
|
||||
- [ ] Documentation has been updated.
|
26
.forgejo/workflows/nix-flake.yaml
Normal file
26
.forgejo/workflows/nix-flake.yaml
Normal file
|
@ -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
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
flake.lock binary
|
|
@ -1,5 +0,0 @@
|
|||
### Title: type/<issue-id>/<subject>
|
||||
|
||||
#### Checklist:
|
||||
- [ ] Code has been tested locally.
|
||||
- [ ] Documentation has been updated.
|
|
@ -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.
|
||||
|
|
4
e2e/cypress/support/index.d.ts
vendored
4
e2e/cypress/support/index.d.ts
vendored
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
8
e2e/package-lock.json
generated
8
e2e/package-lock.json
generated
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
},
|
||||
|
|
82
flake.lock
Normal file
82
flake.lock
Normal file
|
@ -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
|
||||
}
|
63
flake.nix
Normal file
63
flake.nix
Normal file
|
@ -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;
|
||||
});
|
||||
}
|
|
@ -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
|
||||
|
|
8
frontend/package-lock.json
generated
8
frontend/package-lock.json
generated
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<number, TeamDto>();
|
||||
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) {
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue