add flake and move to npm

This commit is contained in:
Joakim Repomaa
2026-02-22 22:23:49 +02:00
parent 9f661e4d57
commit 5ae9386fcd
11 changed files with 6579 additions and 1635 deletions

View File

@@ -6,21 +6,21 @@ This is a SvelteKit 5 project with TypeScript and Tailwind CSS for a router dash
```bash
# Development server
deno run dev
npm run dev
# Build for production
deno run build
npm run build
# Preview production build
deno run preview
npm run preview
# Type checking
deno run check
deno run check:watch
npm run check
npm run check:watch
# Linting and formatting
deno run lint
deno run format
npm run lint
npm run format
```
## Code Style Guidelines

1603
deno.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
{
"packages": ["deno@latest"],
"packages": ["nodejs@latest"],
"shell": {
"init_hook": ["echo 'Welcome to router-dash dev environment!'"],
"scripts": {
"dev": "deno task dev",
"build": "deno task build",
"check": "deno task check",
"lint": "deno task lint",
"format": "deno task format"
"dev": "npm run dev",
"build": "npm run build",
"check": "npm run check",
"lint": "npm run lint",
"format": "npm run format"
}
}
}

View File

@@ -1,57 +1,90 @@
{
"lockfile_version": "1",
"packages": {
"deno@latest": {
"last_modified": "2026-02-15T09:18:18Z",
"resolved": "github:NixOS/nixpkgs/e3cb16bccd9facebae3ba29c6a76a4cc1b73462a#deno",
"github:NixOS/nixpkgs/nixpkgs-unstable": {
"last_modified": "2026-02-11T21:01:36Z",
"resolved": "github:NixOS/nixpkgs/2343bbb58f99267223bc2aac4fc9ea301a155a16?lastModified=1770843696&narHash=sha256-LovWTGDwXhkfCOmbgLVA10bvsi%2FP8eDDpRudgk68HA8%3D"
},
"nodejs@latest": {
"last_modified": "2026-02-15T17:45:47Z",
"plugin_version": "0.0.2",
"resolved": "github:NixOS/nixpkgs/ac055f38c798b0d87695240c7b761b82fc7e5bc2#nodejs_25",
"source": "devbox-search",
"version": "2.6.8",
"version": "25.6.1",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/g1ppl8rayksihnhnzi97xyhzyzdfc8qc-deno-2.6.8",
"path": "/nix/store/vgk6ggp7fpcpmb2bd1cw8fa7y28dg61n-nodejs-25.6.1",
"default": true
},
{
"name": "dev",
"path": "/nix/store/46fvwwp6azfb8jsbgjljkqxwxii965iy-nodejs-25.6.1-dev"
},
{
"name": "libv8",
"path": "/nix/store/yzs2xnyb6ifm1klkmszv7kj52zgsxqaf-nodejs-25.6.1-libv8"
}
],
"store_path": "/nix/store/g1ppl8rayksihnhnzi97xyhzyzdfc8qc-deno-2.6.8"
"store_path": "/nix/store/vgk6ggp7fpcpmb2bd1cw8fa7y28dg61n-nodejs-25.6.1"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/rj9fgwv2frhqmg0v2g64kmanlfayib03-deno-2.6.8",
"path": "/nix/store/20azlpkcakhg9qj3p3f4mx50wwmfpkmr-nodejs-25.6.1",
"default": true
},
{
"name": "dev",
"path": "/nix/store/1w3y5v72hwn4ab6bfwjf6jy7c3mfhsxm-nodejs-25.6.1-dev"
},
{
"name": "libv8",
"path": "/nix/store/rkypcfxqvks4fp62fy3idhn7sb65sxyc-nodejs-25.6.1-libv8"
}
],
"store_path": "/nix/store/rj9fgwv2frhqmg0v2g64kmanlfayib03-deno-2.6.8"
"store_path": "/nix/store/20azlpkcakhg9qj3p3f4mx50wwmfpkmr-nodejs-25.6.1"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/hs3cj286jdbn8ahrqa3h8jvc3wj3a0c0-deno-2.6.8",
"path": "/nix/store/j6q14s986fdwzbrjf5ysv7k44wqblh3k-nodejs-25.6.1",
"default": true
},
{
"name": "dev",
"path": "/nix/store/cfk24mvg8mpwdp2x94avyjplxv9vv1bm-nodejs-25.6.1-dev"
},
{
"name": "libv8",
"path": "/nix/store/4z338draskb9qpnb5w9vzfnilr7lkmg0-nodejs-25.6.1-libv8"
}
],
"store_path": "/nix/store/hs3cj286jdbn8ahrqa3h8jvc3wj3a0c0-deno-2.6.8"
"store_path": "/nix/store/j6q14s986fdwzbrjf5ysv7k44wqblh3k-nodejs-25.6.1"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/61qqy6wi21p9a9a1glwiy80crd0kbr9f-deno-2.6.8",
"path": "/nix/store/6p88z6kk9bkvy0kb994bsc3cri5dwy0w-nodejs-25.6.1",
"default": true
},
{
"name": "dev",
"path": "/nix/store/zg703v0kdlv7ngdirphhjvvbf3lndj4i-nodejs-25.6.1-dev"
},
{
"name": "libv8",
"path": "/nix/store/f4sdxxnkc208az6z8s6jw55xrhzw49wn-nodejs-25.6.1-libv8"
}
],
"store_path": "/nix/store/61qqy6wi21p9a9a1glwiy80crd0kbr9f-deno-2.6.8"
}
}
},
"github:NixOS/nixpkgs/nixpkgs-unstable": {
"last_modified": "2026-02-11T21:01:36Z",
"resolved": "github:NixOS/nixpkgs/2343bbb58f99267223bc2aac4fc9ea301a155a16?lastModified=1770843696&narHash=sha256-LovWTGDwXhkfCOmbgLVA10bvsi%2FP8eDDpRudgk68HA8%3D"
"store_path": "/nix/store/6p88z6kk9bkvy0kb994bsc3cri5dwy0w-nodejs-25.6.1"
}
}
}
}
}

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1771369470,
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0182a361324364ae3f436a63005877674cf45efb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"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
}

64
flake.nix Normal file
View File

@@ -0,0 +1,64 @@
{
description = "Router Dashboard - SvelteKit static site";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.buildNpmPackage {
pname = "router-dash";
version = "0.0.1";
src = ./.;
npmDepsHash = "sha256-2XxcsvKeYp+SVBx6Z2uB/34qUr7AderMxXKjm/kS8F0=";
buildPhase = ''
runHook preBuild
npm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/router-dash
cp -r build/* $out/share/router-dash/
runHook postInstall
'';
meta = with pkgs.lib; {
description = "Router Dashboard - A SvelteKit static web interface";
license = licenses.mit;
platforms = platforms.all;
};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
nodejs
];
shellHook = ''
echo "Router Dash development environment"
echo " npm run dev - Start development server"
echo " npm run build - Build static site"
'';
};
}
);
}

4063
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

1
result Symbolic link
View File

@@ -0,0 +1 @@
/nix/store/rcl4zc0bwlfxa3mphrfm1r4mcmr7znq5-router-dash-0.0.1

2317
src/lib/network-status.json Normal file

File diff suppressed because it is too large Load Diff

1
src/routes/+layout.ts Normal file
View File

@@ -0,0 +1 @@
export const prerender = true

View File

@@ -1,9 +1,16 @@
import type { NetworkStatus } from '$lib/types'
import networkData from '$lib/network-status.json'
import type { PageLoad } from './$types'
export const load: PageLoad = async () => {
export const ssr = false
const API_PORT = import.meta.env.PUBLIC_API_PORT ?? '8080'
export const load: PageLoad = async ({ fetch, url }) => {
const apiUrl = `${url.protocol}//${url.hostname}:${API_PORT}`
const response = await fetch(apiUrl)
const networkStatus: NetworkStatus = await response.json()
return {
networkStatus: networkData as NetworkStatus,
networkStatus,
}
}