Improved buildtime with esbuild
This commit is contained in:
parent
23f7160a5d
commit
89934be8d6
9 changed files with 9761 additions and 134 deletions
|
@ -133,7 +133,6 @@ type Msg
|
|||
| UrlChanged Url.Url
|
||||
| TakeInput String
|
||||
| NoInitFocus
|
||||
| ReceivedTest (Result D.Error Test)
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
|
@ -178,14 +177,6 @@ update msg model =
|
|||
NoInitFocus ->
|
||||
( model, Cmd.none )
|
||||
|
||||
ReceivedTest result ->
|
||||
case result of
|
||||
Ok test ->
|
||||
( { model | content = model.content ++ [ text "\nData got successfully" ] }, Cmd.none )
|
||||
|
||||
Err err ->
|
||||
( { model | content = model.content ++ [ text <| "\n" ++ D.errorToString err ] }, Cmd.none )
|
||||
|
||||
|
||||
|
||||
-- COMMANDS
|
||||
|
@ -199,6 +190,7 @@ type Command
|
|||
| Hello
|
||||
| PromptCommand
|
||||
| Theme
|
||||
| Todo
|
||||
|
||||
|
||||
type alias Input =
|
||||
|
@ -236,6 +228,9 @@ parseInput input =
|
|||
Just "theme" ->
|
||||
Ok Theme
|
||||
|
||||
Just "todo" ->
|
||||
Ok Todo
|
||||
|
||||
Just trimput ->
|
||||
Err trimput
|
||||
|
||||
|
@ -289,6 +284,9 @@ runCommand model input =
|
|||
Theme ->
|
||||
runTheme model args
|
||||
|
||||
Todo ->
|
||||
( runTodo model args, Cmd.none )
|
||||
|
||||
Err "" ->
|
||||
( model, Cmd.none )
|
||||
|
||||
|
@ -323,6 +321,7 @@ runHelp model args =
|
|||
++ "\nfont manages font"
|
||||
++ "\nprompt [UNFINISHED] manages prompt"
|
||||
++ "\ntheme manages theme"
|
||||
++ "\ntodo prints aspirations for the site"
|
||||
]
|
||||
|
||||
Just "help" ->
|
||||
|
@ -375,6 +374,9 @@ runHelp model args =
|
|||
++ "\n pit - nearly black like the bottom of a pit"
|
||||
]
|
||||
|
||||
Just "todo" ->
|
||||
[ text "\ntodo prints aspirations for the site" ]
|
||||
|
||||
Just string ->
|
||||
wrongArgs Help 1 args
|
||||
|
||||
|
@ -600,16 +602,6 @@ runPrompt model args =
|
|||
saveModel { model | prompt = { oldPrompt | prompt = string } }
|
||||
|
||||
|
||||
runReset : Model -> List String -> ( Model, Cmd Msg )
|
||||
runReset model args =
|
||||
case List.head args of
|
||||
Nothing ->
|
||||
( model, Cmd.none )
|
||||
|
||||
Just _ ->
|
||||
( model, Cmd.none )
|
||||
|
||||
|
||||
runTheme : Model -> List String -> ( Model, Cmd Msg )
|
||||
runTheme model args =
|
||||
case List.head args of
|
||||
|
@ -653,6 +645,29 @@ runTheme model args =
|
|||
( { model | content = model.content ++ wrongArgs Theme 1 args }, Cmd.none )
|
||||
|
||||
|
||||
runTodo : Model -> List String -> Model
|
||||
runTodo model args =
|
||||
case List.head args of
|
||||
Nothing ->
|
||||
{ model
|
||||
| content =
|
||||
model.content
|
||||
++ [ text <|
|
||||
"\n--Frontend"
|
||||
++ "\n- Implement colors throughout existing methods"
|
||||
++ "\n- Implement something like neofetch"
|
||||
++ "\n--Glue"
|
||||
++ "\n--Backend"
|
||||
++ "\n- Collect and store feedback in a database"
|
||||
++ "\n- Get an SSL certificate"
|
||||
++ "\n- Support https"
|
||||
]
|
||||
}
|
||||
|
||||
Just _ ->
|
||||
{ model | content = model.content ++ wrongArgs Todo 0 args }
|
||||
|
||||
|
||||
|
||||
-- COMMAND ABSTRACTIONS
|
||||
|
||||
|
@ -691,6 +706,9 @@ wrongArgs command expected args =
|
|||
|
||||
Theme ->
|
||||
"theme"
|
||||
|
||||
Todo ->
|
||||
"todo"
|
||||
in
|
||||
[ text
|
||||
((if expected > List.length args then
|
||||
|
@ -728,6 +746,8 @@ cookiesKeptToString : CookiesKept -> String
|
|||
cookiesKeptToString cookiesKept =
|
||||
"{ keepFont = "
|
||||
++ boolToString cookiesKept.keepFont
|
||||
++ "\n, keepPrompt = "
|
||||
++ boolToString cookiesKept.keepPrompt
|
||||
++ "\n, keepTheme = "
|
||||
++ boolToString cookiesKept.keepTheme
|
||||
++ "\n}"
|
||||
|
@ -747,20 +767,6 @@ port setStorage : E.Value -> Cmd a
|
|||
|
||||
|
||||
|
||||
-- gets from server and everything
|
||||
|
||||
|
||||
port refresh : () -> Cmd a
|
||||
|
||||
|
||||
|
||||
-- for testing purposes: test.json on server
|
||||
|
||||
|
||||
port receiveTestFromServer : (E.Value -> msg) -> Sub msg
|
||||
|
||||
|
||||
|
||||
-- JSON
|
||||
|
||||
|
||||
|
@ -848,26 +854,13 @@ promptDecoder =
|
|||
(D.at [ "prompt", "prompt" ] D.string)
|
||||
|
||||
|
||||
type alias Test =
|
||||
{ message0 : String
|
||||
, message1 : String
|
||||
}
|
||||
|
||||
|
||||
testDecoder : D.Decoder Test
|
||||
testDecoder =
|
||||
D.map2 Test
|
||||
(D.field "message0" D.string)
|
||||
(D.field "message1" D.string)
|
||||
|
||||
|
||||
|
||||
-- SUBSCRIPTIONS
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
receiveTestFromServer (D.decodeValue testDecoder >> ReceivedTest)
|
||||
subscriptions _ =
|
||||
Sub.none
|
||||
|
||||
|
||||
|
||||
|
@ -876,7 +869,7 @@ subscriptions model =
|
|||
|
||||
view : Model -> Browser.Document Msg
|
||||
view model =
|
||||
Browser.Document "andrew.r3tic.net"
|
||||
Browser.Document "elmskell"
|
||||
[ toUnstyled <| viewBody model ]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue