build with just, upd. todo

This commit is contained in:
mtgmonkey 2025-04-25 20:56:10 -04:00
parent deef7c5839
commit 9dede341e8
6 changed files with 84 additions and 9767 deletions

View file

@ -1,25 +0,0 @@
all: frontend backend
produce: frontend-produce backend
echo REMEMBER to RESTART elmskell.service TO UPDATE SITE IN PLACE
run:
stack exec ~/.local/bin/hs-server-exe
backend:
cd backend && stack install
frontend: frontend-format
cd frontend && elm make src/Main.elm --output=../assets/js/main.js
rm -rf frontend/elm-stuff
frontend-produce: frontend-format
cd frontend && elm make src/Main.elm --optimize --output=../assets/js/tmp.js
rm -rf frontend/elm-stuff
esbuild assets/js/tmp.js --minify --target=es5 --outfile=assets/js/main.js
rm assets/js/tmp.js
frontend-format:
elm-format frontend/src/Main.elm --yes
.PHONY: all produce run start backend frontend frontend-produce frontend-format clean

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -262,30 +262,33 @@ runCommand : Model -> Result String Input -> ( Model, Cmd Msg )
runCommand model input =
case input of
Ok { command, args } ->
case command of
(case command of
Help ->
( runHelp model args, Cmd.none )
runHelp
Clear ->
( runClear model args, Cmd.none )
runClear
Cookies ->
runCookies model args
runCookies
FontCommand ->
runFont model args
runFont
Hello ->
runHello model args
runHello
PromptCommand ->
runPrompt model args
runPrompt
Theme ->
runTheme model args
runTheme
Todo ->
( runTodo model args, Cmd.none )
runTodo
)
model
args
Err "" ->
( model, Cmd.none )
@ -302,9 +305,13 @@ runCommand model input =
-- COMMANDS
runHelp : Model -> List String -> Model
type alias CommandRunner =
Model -> List String -> ( Model, Cmd Msg )
runHelp : CommandRunner
runHelp model args =
{ model
( { model
| content =
model.content
++ (if List.length args < 2 then
@ -383,20 +390,24 @@ runHelp model args =
else
wrongArgs Help 1 args
)
}
}
, Cmd.none
)
runClear : Model -> List String -> Model
runClear : CommandRunner
runClear model args =
case List.head args of
( case List.head args of
Nothing ->
{ model | content = [] }
Just string ->
{ model | content = model.content ++ wrongArgs Clear 0 args }
, Cmd.none
)
runCookies : Model -> List String -> ( Model, Cmd Msg )
runCookies : CommandRunner
runCookies model args =
case List.head args of
Nothing ->
@ -482,7 +493,7 @@ runCookies model args =
( { model | content = model.content ++ wrongArgs Cookies 1 args }, Cmd.none )
runHello : Model -> List String -> ( Model, Cmd Msg )
runHello : CommandRunner
runHello model args =
case List.head args of
Nothing ->
@ -492,7 +503,7 @@ runHello model args =
( { model | content = model.content ++ wrongArgs Hello 0 args }, Cmd.none )
runFont : Model -> List String -> ( Model, Cmd Msg )
runFont : CommandRunner
runFont model args =
case List.head args of
Nothing ->
@ -588,7 +599,7 @@ runFont model args =
( { model | content = model.content ++ wrongArgs FontCommand 1 args }, Cmd.none )
runPrompt : Model -> List String -> ( Model, Cmd Msg )
runPrompt : CommandRunner
runPrompt model args =
case List.head args of
Nothing ->
@ -602,7 +613,7 @@ runPrompt model args =
saveModel { model | prompt = { oldPrompt | prompt = string } }
runTheme : Model -> List String -> ( Model, Cmd Msg )
runTheme : CommandRunner
runTheme model args =
case List.head args of
Nothing ->
@ -645,27 +656,34 @@ runTheme model args =
( { model | content = model.content ++ wrongArgs Theme 1 args }, Cmd.none )
runTodo : Model -> List String -> Model
runTodo : CommandRunner
runTodo model args =
case List.head args of
( case List.head args of
Nothing ->
{ model
| content =
model.content
++ [ text <|
"\n--Frontend"
"\nIn no particular order:"
++ "\n- Implement colors throughout existing methods"
++ "\n- Implement something like neofetch"
++ "\n--Glue"
++ "\n--Backend"
++ "\n- Something like Neofetch"
++ "\n- Collect and store feedback in a database"
++ "\n- Get an SSL certificate"
++ "\n- Support https"
++ "\n- Create a style guide for programs involving console colors"
++ "\n"
++ "\nUpcoming commands to look forward to:"
++ "\nfunfetch"
++ "\ncolors test"
++ "\ncolors set <color> <value>"
++ "\ntheme save <name>"
++ "\ntheme load <name>"
++ "\nfeedback <bug|request|good> <content>"
]
}
Just _ ->
{ model | content = model.content ++ wrongArgs Todo 0 args }
, Cmd.none
)

34
justfile Normal file
View file

@ -0,0 +1,34 @@
help:
echo compile builds both ends
echo produce builds, minifies, optimises both ends
echo run produces before executing the result
echo elm builds the elm
echo haskell builds the haskell
echo format-elm formats the elm
echo produce-elm builds, minifies, optimises the elm
compile: elm haskell
produce: produce-elm haskell
echo REMEMBER to RESTART elmskell.service TO UPDATE SITE IN PLACE
run: produce
stack exec ~/.local/bin/hs-server-exe
haskell:
cd backend && stack install
elm:
cd frontend && elm make src/Main.elm --output=../assets/js/main.js
rm -rf frontend/elm-stuff
produce-elm:
cd frontend && elm make src/Main.elm --optimize --output=tmp.js
mv frontend/tmp.js assets/js/tmp.js
rm -rf frontend/elm-stuff
rm assets/js/main.js
esbuild assets/js/tmp.js --minify --target=es5 --outfile=assets/js/main.js
rm assets/js/tmp.js
format-elm:
elm-format frontend/src/Main.elm --yes

View file

@ -7,6 +7,9 @@
haskellInputs = [
pkgs.stack
];
buildTools = [
pkgs.just
];
cliTools = [
pkgs.httpie
pkgs.ungoogled-chromium
@ -16,6 +19,7 @@ in
nativeBuildInputs = [
elmInputs
haskellInputs
buildTools
cliTools
];
}