mirror of
https://github.com/daylinmorgan/nimpkgs.git
synced 2024-11-12 14:53:15 -06:00
21 lines
768 B
Text
21 lines
768 B
Text
|
import std/[strutils, strformat]
|
||
|
|
||
|
proc getCommitInfo*(): (string, string) =
|
||
|
if not dirExists "src/packages":
|
||
|
echo "cloning nim-lang/packages"
|
||
|
discard staticExec "git clone https://github.com/nim-lang/packages.git src/packages"
|
||
|
let output = (staticExec "git -C src/packages show -q --format='%h %H'").split()
|
||
|
return (output[0], output[1])
|
||
|
|
||
|
task setup, "run atlas init":
|
||
|
exec "atlas init --deps=.workspace"
|
||
|
exec "atlas install"
|
||
|
|
||
|
task build, "build":
|
||
|
let (short,long) = getCommitInfo()
|
||
|
selfExec fmt"js -o:site/nimpkgs.js -d:packagesHash:{long} -d:packagesHashAbbr:{short} -d:release src/nimpkgs.nim"
|
||
|
exec "pnpm run build"
|
||
|
|
||
|
task watch, "rebuild on change":
|
||
|
exec "watchexec -w src nim js -d:packagesHash:master -o:site/nimpkgs.js src/nimpkgs.nim"
|