Compare commits

..

1 commit

Author SHA1 Message Date
Mary Guillemard
f685f31730 Switch to NPM lock files and rewrite nixpkg
This prepare for flake rewrite

Signed-off-by: Mary Guillemard <mary@mary.zone>
2024-01-01 15:34:03 +00:00
10 changed files with 334 additions and 542 deletions

View file

@ -4,18 +4,4 @@ module.exports = {
parser: '@typescript-eslint/parser', parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'], plugins: ['@typescript-eslint'],
root: true, root: true,
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
}
}; };

View file

@ -15,7 +15,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "npm" cache: "npm"
@ -31,7 +31,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "npm" cache: "npm"
@ -47,7 +47,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "npm" cache: "npm"

View file

@ -19,7 +19,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "npm" cache: "npm"
@ -54,7 +54,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v3
with: with:
node-version-file: ".nvmrc" node-version-file: ".nvmrc"
cache: "npm" cache: "npm"

View file

@ -1,4 +1,28 @@
(import (fetchTarball { pkgs ? (import <nixpkgs> {})}:
"https://github.com/edolstra/flake-compat/archive/master.tar.gz") { with pkgs;
src = builtins.fetchGit ./.; let
}).defaultNix
package = buildNpmPackage {
pname = "ryujinx-ldn-website";
version = "1.0.0";
#linkDevDependencies = true;
src = ./.;
npmBuildScript = "release";
npmBuildFlags = [ "--" "--outDir" "dist" ];
installPhase = ''
runHook preInstall
cp -r dist $out/
cp -r public package.json package-lock.json node_modules $out/
makeWrapper '${nodejs}/bin/node' "$out/bin/ryujinx-ldn-website" --add-flags "$out/index.js"
runHook postInstall
'';
npmDepsHash = "sha256-Wo4dGsUAZwXbkuWwTKNA5kv4ZUnekdKm/TagP4Q4Ds8=";
};
in package

View file

@ -1,61 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1709126324,
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1709677081,
"narHash": "sha256-tix36Y7u0rkn6mTm0lA45b45oab2cFLqAzDbJxeXS+c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "880992dcc006a5e00dd0591446fdf723e6a51a64",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,45 +0,0 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
};
outputs = { self, nixpkgs, flake-utils }:
let
wesbite_overlay = final: prev: {
ryujinx-ldn-website = with final;
buildNpmPackage {
pname = "ryujinx-ldn-website";
version = "1.0.0";
src = ./.;
installPhase = ''
runHook preInstall
cp -r dist $out/
cp -r public package.json package-lock.json node_modules $out/
makeWrapper '${nodejs}/bin/node' "$out/bin/ryujinx-ldn-website" --add-flags "$out/index.js"
runHook postInstall
'';
npmDepsHash = "sha256-fqvUE5/M2VyIL5CyDEuUGye27e9fJJImMYL1wwZNFPg=";
};
};
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays."${system}" ];
};
in {
packages = {
default = self.packages.${system}.ryujinx-ldn-website;
ryujinx-ldn-website = pkgs.ryujinx-ldn-website;
};
overlays = wesbite_overlay;
formatter = pkgs.nixfmt;
});
}

677
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,30 +13,31 @@
"format": "prettier -w .", "format": "prettier -w .",
"lint": "eslint --fix .", "lint": "eslint --fix .",
"build": "tsc", "build": "tsc",
"prestart": "npm run build", "prestart": "npm build",
"start": "node .", "start": "node .",
"dev": "npm run build && npm run start", "dev": "npm build && npm start",
"serve": "nodemon", "serve": "nodemon",
"prepack": "npm run build" "prepack": "npm build",
"release": "tsc"
}, },
"dependencies": { "dependencies": {
"ejs": "^3.1.9", "ejs": "^3.1.9",
"express": "~4.18.2", "express": "~4.18.2",
"express-actuator": "^1.8.4", "express-actuator": "^1.8.4",
"redis": "^4.6.13", "redis": "^4.6.9",
"winston": "^3.12.0" "winston": "^3.10.0"
}, },
"devDependencies": { "devDependencies": {
"@tsconfig/recommended": "^1.0.3", "@tsconfig/recommended": "^1.0.3",
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/express-actuator": "^1.8.0", "@types/express-actuator": "^1.8.0",
"@types/node": "^18.16.1", "@types/node": "^18.16.1",
"@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^7.1.0", "@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.57.0", "eslint": "^8.49.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.0.0",
"nodemon": "^3.1.0", "nodemon": "^3.0.1",
"prettier": "3.2.5", "prettier": "3.0.3",
"typescript": "^5.4.0" "typescript": "^5.2.2"
} }
} }

View file

@ -3,7 +3,7 @@ import { redisClient } from "./app";
const router = Router(); const router = Router();
router.get("/", async (_req, res, _next) => { router.get("/", async (req, res, next) => {
if (!redisClient.isOpen) { if (!redisClient.isOpen) {
await redisClient.connect(); await redisClient.connect();
} }
@ -17,7 +17,7 @@ router.get("/", async (_req, res, _next) => {
return res.send(result); return res.send(result);
}); });
router.get("/public_games", async (req, res, _next) => { router.get("/public_games", async (req, res, next) => {
let gameFilter = ""; let gameFilter = "";
if (req.query.titleid != null && (req.query.titleid as string)?.length > 0) { if (req.query.titleid != null && (req.query.titleid as string)?.length > 0) {

View file

@ -2,11 +2,7 @@ import { Request, Response, NextFunction } from "express";
import { logger } from "./app"; import { logger } from "./app";
import { loggerDefaultMetadata } from "./utils"; import { loggerDefaultMetadata } from "./utils";
export function requestLogger( export function requestLogger(req: Request, res: Response, next: NextFunction) {
req: Request,
_res: Response,
next: NextFunction
) {
logger.debug("Incoming request.", loggerDefaultMetadata(req)); logger.debug("Incoming request.", loggerDefaultMetadata(req));
next(); next();
} }
@ -14,7 +10,7 @@ export function requestLogger(
export function errorLogger( export function errorLogger(
err: Error, err: Error,
req: Request, req: Request,
_res: Response, res: Response,
next: NextFunction next: NextFunction
) { ) {
logger.error(err.message, { logger.error(err.message, {