mirror of
https://github.com/daylinmorgan/nimpkgs.git
synced 2024-12-23 19:40:45 -06:00
Compare commits
6 commits
62dfd6ff17
...
ffc3de9bbb
Author | SHA1 | Date | |
---|---|---|---|
ffc3de9bbb | |||
297e9037b2 | |||
8cf765129b | |||
a3d31ad8b1 | |||
97134d4ea8 | |||
52b78b8f60 |
11 changed files with 940 additions and 825 deletions
6
.github/workflows/docs.yml
vendored
6
.github/workflows/docs.yml
vendored
|
@ -38,7 +38,7 @@ jobs:
|
|||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- uses: jiro4989/setup-nim-action@v1
|
||||
- uses: jiro4989/setup-nim-action@v2
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
@ -47,8 +47,8 @@ jobs:
|
|||
|
||||
- name: Build Website
|
||||
run: |
|
||||
nimble install -Y 'https://github.com/nim-lang/atlas.git@#f7ade65f'
|
||||
nim setup
|
||||
nimble setup -l
|
||||
nimble install -d -Y
|
||||
nim build
|
||||
|
||||
- name: Upload artifact
|
||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -140,3 +140,6 @@ src/*.js
|
|||
|
||||
# for debugging
|
||||
site/nimpkgs.json
|
||||
# nimble.develop
|
||||
nimble.paths
|
||||
nimbledeps
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
switch("backend","js")
|
||||
|
||||
task setup, "run atlas init":
|
||||
exec "atlas init --deps=.workspace"
|
||||
exec "atlas install"
|
||||
|
||||
task build, "build":
|
||||
selfExec "js -o:site/app.js -d:release src/app.nim"
|
||||
exec "pnpm run build"
|
||||
|
@ -15,3 +11,8 @@ task watch, "rebuild on change":
|
|||
"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
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1707205916,
|
||||
"narHash": "sha256-fmRJilYGlB7VCt3XsdYxrA0u8e/K84O5xYucerUY0iM=",
|
||||
"lastModified": 1723703277,
|
||||
"narHash": "sha256-nk0RaUB5f68BwtXAYy3WAjqFhVKqIl9Z89RGycTa2vk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8cc79aa39bbc6eaedaf286ae655b224c71e02907",
|
||||
"rev": "8b908192e64224420e2d59dfd9b2e4309e154c5d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (nixpkgs.lib) genAttrs;
|
||||
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
|
||||
|
@ -16,7 +16,7 @@
|
|||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
nim
|
||||
nim-atlas
|
||||
nimble
|
||||
watchexec
|
||||
nodePackages.pnpm
|
||||
];
|
||||
|
|
49
nimble.lock
Normal file
49
nimble.lock
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"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": {}
|
||||
}
|
16
package.json
16
package.json
|
@ -11,16 +11,16 @@
|
|||
"author": "Daylin Morgan",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@catppuccin/palette": "^1.1.0",
|
||||
"@iconify-json/mdi": "^1.1.64",
|
||||
"@iconify-json/simple-icons": "^1.1.92",
|
||||
"@catppuccin/palette": "^1.2.0",
|
||||
"@iconify-json/mdi": "^1.1.68",
|
||||
"@iconify-json/simple-icons": "^1.1.113",
|
||||
"@types/promise-fs": "^2.1.5",
|
||||
"@unocss/cli": "^0.58.5",
|
||||
"@unocss/preset-icons": "^0.58.5",
|
||||
"@unocss/reset": "^0.58.5",
|
||||
"@unocss/cli": "^0.62.2",
|
||||
"@unocss/preset-icons": "^0.62.2",
|
||||
"@unocss/reset": "^0.62.2",
|
||||
"concurrently": "^8.2.2",
|
||||
"esbuild": "^0.20.1",
|
||||
"esbuild": "^0.23.1",
|
||||
"http-server": "^14.1.1",
|
||||
"unocss": "^0.58.5"
|
||||
"unocss": "^0.62.2"
|
||||
}
|
||||
}
|
||||
|
|
1614
pnpm-lock.yaml
1614
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
import std/[strutils, sequtils, dom, uri]
|
||||
import std/[strutils, uri]
|
||||
|
||||
import karax/[kbase, karax, karaxdsl, vdom, jstrutils, kdom]
|
||||
import karax/[kbase, karax, karaxdsl, vdom, jstrutils]
|
||||
|
||||
import ../[packages, style, context]
|
||||
# import ../components/package
|
||||
|
@ -33,21 +33,26 @@ proc parseQuery*(s: kstring): Query =
|
|||
else:
|
||||
result.all &= part
|
||||
|
||||
proc toLowerAscii(ks: kstring): kstring {.inline.} = ($ks).toLowerAscii().kstring
|
||||
|
||||
proc searchPackages*(q: Query): seq[NimPackage] =
|
||||
if q == Query():
|
||||
result = ctx.nimpkgs.packages.values.toSeq()
|
||||
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
|
||||
|
||||
for name, pkg in ctx.nimpkgs.packages:
|
||||
let searchStr = ((pkg.url & " " & pkg.name & " " & pkg.description & " " & (
|
||||
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.toLowerAscii() in searchStr:
|
||||
return true
|
||||
|
||||
if q.all in searchStr:
|
||||
result.add pkg
|
||||
proc searchPackages*(q: Query): seq[NimPackage] =
|
||||
if q == Query(): return nimpkgsList()
|
||||
|
||||
collect:
|
||||
for _, pkg in ctx.nimpkgs.packages:
|
||||
if q ~= pkg: pkg
|
||||
|
||||
proc getSearchFromUri*(): kstring =
|
||||
var url = currentUri()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import std/[
|
||||
asyncjs, jsconsole, jsfetch, sugar, tables
|
||||
asyncjs, jsconsole, jsfetch, sequtils, sugar, tables
|
||||
]
|
||||
|
||||
import karax/[kbase, karax]
|
||||
|
@ -14,6 +14,8 @@ type
|
|||
nimpkgs*: NimPkgs
|
||||
loaded*: bool
|
||||
|
||||
var ctx* = Context()
|
||||
|
||||
let nimpkgsUrl =
|
||||
when defined(debug): "http://localhost:8080/nimpkgs.json"
|
||||
else: "https://raw.githubusercontent.com/nimpkgs/nimpkgs/main/nimpkgs.json"
|
||||
|
@ -29,5 +31,8 @@ proc fetchPackages*(ctx: var Context){.async.} =
|
|||
)
|
||||
.catch((err: Error) => console.log err
|
||||
)
|
||||
var ctx* = Context()
|
||||
|
||||
discard ctx.fetchPackages
|
||||
|
||||
proc nimpkgsList*(): seq[NimPackage] {.inline.} =
|
||||
ctx.nimpkgs.packages.values.toSeq()
|
||||
|
|
|
@ -90,7 +90,7 @@ proc filteredPackagesDom(): VNode =
|
|||
pkg.card
|
||||
|
||||
proc update(pgCtx: var PageContext) =
|
||||
pgCtx.filteredPackages = ctx.nimpkgs.packages.values().toSeq()
|
||||
pgCtx.filteredPackages = nimpkgsList()
|
||||
pgCtx.search = getSearchFromUri()
|
||||
pgCtx.filteredPackages = searchPackages(parseQuery(pgCtx.search))
|
||||
|
||||
|
|
Loading…
Reference in a new issue