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 = runCommand model input =
case input of case input of
Ok { command, args } -> Ok { command, args } ->
case command of (case command of
Help -> Help ->
( runHelp model args, Cmd.none ) runHelp
Clear -> Clear ->
( runClear model args, Cmd.none ) runClear
Cookies -> Cookies ->
runCookies model args runCookies
FontCommand -> FontCommand ->
runFont model args runFont
Hello -> Hello ->
runHello model args runHello
PromptCommand -> PromptCommand ->
runPrompt model args runPrompt
Theme -> Theme ->
runTheme model args runTheme
Todo -> Todo ->
( runTodo model args, Cmd.none ) runTodo
)
model
args
Err "" -> Err "" ->
( model, Cmd.none ) ( model, Cmd.none )
@ -302,9 +305,13 @@ runCommand model input =
-- COMMANDS -- COMMANDS
runHelp : Model -> List String -> Model type alias CommandRunner =
Model -> List String -> ( Model, Cmd Msg )
runHelp : CommandRunner
runHelp model args = runHelp model args =
{ model ( { model
| content = | content =
model.content model.content
++ (if List.length args < 2 then ++ (if List.length args < 2 then
@ -383,20 +390,24 @@ runHelp model args =
else else
wrongArgs Help 1 args wrongArgs Help 1 args
) )
} }
, Cmd.none
)
runClear : Model -> List String -> Model runClear : CommandRunner
runClear model args = runClear model args =
case List.head args of ( case List.head args of
Nothing -> Nothing ->
{ model | content = [] } { model | content = [] }
Just string -> Just string ->
{ model | content = model.content ++ wrongArgs Clear 0 args } { model | content = model.content ++ wrongArgs Clear 0 args }
, Cmd.none
)
runCookies : Model -> List String -> ( Model, Cmd Msg ) runCookies : CommandRunner
runCookies model args = runCookies model args =
case List.head args of case List.head args of
Nothing -> Nothing ->
@ -482,7 +493,7 @@ runCookies model args =
( { model | content = model.content ++ wrongArgs Cookies 1 args }, Cmd.none ) ( { model | content = model.content ++ wrongArgs Cookies 1 args }, Cmd.none )
runHello : Model -> List String -> ( Model, Cmd Msg ) runHello : CommandRunner
runHello model args = runHello model args =
case List.head args of case List.head args of
Nothing -> Nothing ->
@ -492,7 +503,7 @@ runHello model args =
( { model | content = model.content ++ wrongArgs Hello 0 args }, Cmd.none ) ( { model | content = model.content ++ wrongArgs Hello 0 args }, Cmd.none )
runFont : Model -> List String -> ( Model, Cmd Msg ) runFont : CommandRunner
runFont model args = runFont model args =
case List.head args of case List.head args of
Nothing -> Nothing ->
@ -588,7 +599,7 @@ runFont model args =
( { model | content = model.content ++ wrongArgs FontCommand 1 args }, Cmd.none ) ( { model | content = model.content ++ wrongArgs FontCommand 1 args }, Cmd.none )
runPrompt : Model -> List String -> ( Model, Cmd Msg ) runPrompt : CommandRunner
runPrompt model args = runPrompt model args =
case List.head args of case List.head args of
Nothing -> Nothing ->
@ -602,7 +613,7 @@ runPrompt model args =
saveModel { model | prompt = { oldPrompt | prompt = string } } saveModel { model | prompt = { oldPrompt | prompt = string } }
runTheme : Model -> List String -> ( Model, Cmd Msg ) runTheme : CommandRunner
runTheme model args = runTheme model args =
case List.head args of case List.head args of
Nothing -> Nothing ->
@ -645,27 +656,34 @@ runTheme model args =
( { model | content = model.content ++ wrongArgs Theme 1 args }, Cmd.none ) ( { model | content = model.content ++ wrongArgs Theme 1 args }, Cmd.none )
runTodo : Model -> List String -> Model runTodo : CommandRunner
runTodo model args = runTodo model args =
case List.head args of ( case List.head args of
Nothing -> Nothing ->
{ model { model
| content = | content =
model.content model.content
++ [ text <| ++ [ text <|
"\n--Frontend" "\nIn no particular order:"
++ "\n- Implement colors throughout existing methods" ++ "\n- Implement colors throughout existing methods"
++ "\n- Implement something like neofetch" ++ "\n- Something like Neofetch"
++ "\n--Glue"
++ "\n--Backend"
++ "\n- Collect and store feedback in a database" ++ "\n- Collect and store feedback in a database"
++ "\n- Get an SSL certificate" ++ "\n- Create a style guide for programs involving console colors"
++ "\n- Support https" ++ "\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 _ -> Just _ ->
{ model | content = model.content ++ wrongArgs Todo 0 args } { 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 = [ haskellInputs = [
pkgs.stack pkgs.stack
]; ];
buildTools = [
pkgs.just
];
cliTools = [ cliTools = [
pkgs.httpie pkgs.httpie
pkgs.ungoogled-chromium pkgs.ungoogled-chromium
@ -16,6 +19,7 @@ in
nativeBuildInputs = [ nativeBuildInputs = [
elmInputs elmInputs
haskellInputs haskellInputs
buildTools
cliTools cliTools
]; ];
} }