Compare commits

..

No commits in common. "ffc3de9bbbee1a4270c514c36ce48b8f089e167c" and "62dfd6ff17d11c17f7b3636c16fdefbc66a937cf" have entirely different histories.

11 changed files with 796 additions and 911 deletions

View file

@ -38,7 +38,7 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-pnpm-store- ${{ runner.os }}-pnpm-store-
- uses: jiro4989/setup-nim-action@v2 - uses: jiro4989/setup-nim-action@v1
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
@ -47,8 +47,8 @@ jobs:
- name: Build Website - name: Build Website
run: | run: |
nimble setup -l nimble install -Y 'https://github.com/nim-lang/atlas.git@#f7ade65f'
nimble install -d -Y nim setup
nim build nim build
- name: Upload artifact - name: Upload artifact

3
.gitignore vendored
View file

@ -140,6 +140,3 @@ src/*.js
# for debugging # for debugging
site/nimpkgs.json site/nimpkgs.json
# nimble.develop
nimble.paths
nimbledeps

View file

@ -1,5 +1,9 @@
switch("backend","js") switch("backend","js")
task setup, "run atlas init":
exec "atlas init --deps=.workspace"
exec "atlas install"
task build, "build": task build, "build":
selfExec "js -o:site/app.js -d:release src/app.nim" selfExec "js -o:site/app.js -d:release src/app.nim"
exec "pnpm run build" exec "pnpm run build"
@ -11,8 +15,3 @@ task watch, "rebuild on change":
"nim js -d:packagesHash:master -o:site/app.js src/app.nim" "nim js -d:packagesHash:master -o:site/app.js src/app.nim"
) )
# begin Nimble config (version 2)
--noNimblePath
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
# end Nimble config

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1723703277, "lastModified": 1707205916,
"narHash": "sha256-nk0RaUB5f68BwtXAYy3WAjqFhVKqIl9Z89RGycTa2vk=", "narHash": "sha256-fmRJilYGlB7VCt3XsdYxrA0u8e/K84O5xYucerUY0iM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8b908192e64224420e2d59dfd9b2e4309e154c5d", "rev": "8cc79aa39bbc6eaedaf286ae655b224c71e02907",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -4,9 +4,9 @@
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
}; };
outputs = { outputs = inputs @ {
self,
nixpkgs, nixpkgs,
...
}: let }: let
inherit (nixpkgs.lib) genAttrs; inherit (nixpkgs.lib) genAttrs;
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
@ -16,7 +16,7 @@
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
nim nim
nimble nim-atlas
watchexec watchexec
nodePackages.pnpm nodePackages.pnpm
]; ];

View file

@ -1,49 +0,0 @@
{
"version": 2,
"packages": {
"dotenv": {
"version": "2.0.2",
"vcsRevision": "a3c6726147276ea1447dee292fd27bb036242b78",
"url": "https://github.com/euantorano/dotenv.nim",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "1e70fc63c286ca3da7592d61dbe501fcea35bc72"
}
},
"jsony": {
"version": "1.1.5",
"vcsRevision": "ea811bec7fa50f5abd3088ba94cda74285e93f18",
"url": "https://github.com/treeform/jsony",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "6aeb83e7481ca8686396a568096054bc668294df"
}
},
"ws": {
"version": "0.5.0",
"vcsRevision": "9536bf99ddf5948db221ccb7bb3663aa238a8e21",
"url": "https://github.com/treeform/ws",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "ae4daf4ae302d0431f3c2d385ae9d2fe767a3246"
}
},
"karax": {
"version": "1.3.3",
"vcsRevision": "d86349c63d8ece330d749eb037a9fa5ffca87c79",
"url": "https://github.com/karaxnim/karax/",
"downloadMethod": "git",
"dependencies": [
"ws",
"dotenv"
],
"checksums": {
"sha1": "6683189b4456437c2809be72e3404adde77f5c34"
}
}
},
"tasks": {}
}

View file

@ -11,16 +11,16 @@
"author": "Daylin Morgan", "author": "Daylin Morgan",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@catppuccin/palette": "^1.2.0", "@catppuccin/palette": "^1.1.0",
"@iconify-json/mdi": "^1.1.68", "@iconify-json/mdi": "^1.1.64",
"@iconify-json/simple-icons": "^1.1.113", "@iconify-json/simple-icons": "^1.1.92",
"@types/promise-fs": "^2.1.5", "@types/promise-fs": "^2.1.5",
"@unocss/cli": "^0.62.2", "@unocss/cli": "^0.58.5",
"@unocss/preset-icons": "^0.62.2", "@unocss/preset-icons": "^0.58.5",
"@unocss/reset": "^0.62.2", "@unocss/reset": "^0.58.5",
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"esbuild": "^0.23.1", "esbuild": "^0.20.1",
"http-server": "^14.1.1", "http-server": "^14.1.1",
"unocss": "^0.62.2" "unocss": "^0.58.5"
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
import std/[strutils, uri] import std/[strutils, sequtils, dom, uri]
import karax/[kbase, karax, karaxdsl, vdom, jstrutils] import karax/[kbase, karax, karaxdsl, vdom, jstrutils, kdom]
import ../[packages, style, context] import ../[packages, style, context]
# import ../components/package # import ../components/package
@ -33,26 +33,21 @@ proc parseQuery*(s: kstring): Query =
else: else:
result.all &= part result.all &= part
proc toLowerAscii(ks: kstring): kstring {.inline.} = ($ks).toLowerAscii().kstring
proc genericSearchString(p: NimPackage): kstring =
(@[p.url, p.name, p.description, p.tags.join(" ").kstring].join(" ").kstring).toLowerAscii()
proc `~=`(q: Query, pkg: NimPackage): bool =
let searchStr = pkg.genericSearchString()
if (q.name notin pkg.name) or (q.license notin pkg.license) or
(q.tag != "".kstring and (q.tag notin pkg.tags)):
return
if q.all.toLowerAscii() in searchStr:
return true
proc searchPackages*(q: Query): seq[NimPackage] = proc searchPackages*(q: Query): seq[NimPackage] =
if q == Query(): return nimpkgsList() if q == Query():
result = ctx.nimpkgs.packages.values.toSeq()
return
collect: for name, pkg in ctx.nimpkgs.packages:
for _, pkg in ctx.nimpkgs.packages: let searchStr = ((pkg.url & " " & pkg.name & " " & pkg.description & " " & (
if q ~= pkg: pkg pkg.tags).join(" ").kstring))
if (q.name notin pkg.name) or
(q.license notin pkg.license) or
(q.tag != "".kstring and (q.tag notin pkg.tags)): continue
if q.all in searchStr:
result.add pkg
proc getSearchFromUri*(): kstring = proc getSearchFromUri*(): kstring =
var url = currentUri() var url = currentUri()

View file

@ -1,5 +1,5 @@
import std/[ import std/[
asyncjs, jsconsole, jsfetch, sequtils, sugar, tables asyncjs, jsconsole, jsfetch, sugar, tables
] ]
import karax/[kbase, karax] import karax/[kbase, karax]
@ -14,8 +14,6 @@ type
nimpkgs*: NimPkgs nimpkgs*: NimPkgs
loaded*: bool loaded*: bool
var ctx* = Context()
let nimpkgsUrl = let nimpkgsUrl =
when defined(debug): "http://localhost:8080/nimpkgs.json" when defined(debug): "http://localhost:8080/nimpkgs.json"
else: "https://raw.githubusercontent.com/nimpkgs/nimpkgs/main/nimpkgs.json" else: "https://raw.githubusercontent.com/nimpkgs/nimpkgs/main/nimpkgs.json"
@ -31,8 +29,5 @@ proc fetchPackages*(ctx: var Context){.async.} =
) )
.catch((err: Error) => console.log err .catch((err: Error) => console.log err
) )
var ctx* = Context()
discard ctx.fetchPackages discard ctx.fetchPackages
proc nimpkgsList*(): seq[NimPackage] {.inline.} =
ctx.nimpkgs.packages.values.toSeq()

View file

@ -90,7 +90,7 @@ proc filteredPackagesDom(): VNode =
pkg.card pkg.card
proc update(pgCtx: var PageContext) = proc update(pgCtx: var PageContext) =
pgCtx.filteredPackages = nimpkgsList() pgCtx.filteredPackages = ctx.nimpkgs.packages.values().toSeq()
pgCtx.search = getSearchFromUri() pgCtx.search = getSearchFromUri()
pgCtx.filteredPackages = searchPackages(parseQuery(pgCtx.search)) pgCtx.filteredPackages = searchPackages(parseQuery(pgCtx.search))