Skip to content

Commit feb88e5

Browse files
authored
Merge pull request #280 from wolfadex/update-elm-pages
Update elm-pages
2 parents e7aedb6 + 9fa89d0 commit feb88e5

4 files changed

Lines changed: 16 additions & 67 deletions

File tree

‎bun.lock‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cli/elm.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"direct": {
1010
"MaybeJustJames/yaml": "2.1.7",
1111
"dillonkearns/elm-cli-options-parser": "4.0.0",
12-
"dillonkearns/elm-pages": "11.0.0",
12+
"dillonkearns/elm-pages": "12.0.2",
1313
"elm/bytes": "1.0.8",
1414
"elm/core": "1.0.5",
1515
"elm/json": "1.1.4",
@@ -19,7 +19,7 @@
1919
"json-tools/json-schema": "1.0.2",
2020
"json-tools/json-value": "1.0.1",
2121
"mdgriffith/elm-codegen": "6.0.1",
22-
"miniBill/elm-fast-dict": "1.2.4",
22+
"miniBill/elm-fast-dict": "1.2.5",
2323
"robinheghan/murmur3": "1.0.0",
2424
"the-sett/elm-pretty-printer": "3.3.0",
2525
"wolfadex/elm-ansi": "3.0.1",
@@ -29,7 +29,6 @@
2929
"Chadtech/elm-bool-extra": "2.4.2",
3030
"NoRedInk/elm-json-decode-pipeline": "1.0.1",
3131
"avh4/elm-color": "1.0.0",
32-
"danfishgold/base64-bytes": "1.1.0",
3332
"danyx23/elm-mimetype": "4.0.1",
3433
"dillonkearns/elm-bcp47-language-tag": "2.0.0",
3534
"dillonkearns/elm-date-or-date-time": "2.0.0",

‎cli/src/Cli.elm‎

Lines changed: 9 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import Ansi
44
import Ansi.Color
55
import Ansi.Font
66
import BackendTask exposing (BackendTask)
7-
import BackendTask.Custom
8-
import BackendTask.Env
97
import BackendTask.Extra
108
import BackendTask.File
119
import BackendTask.Http
@@ -398,25 +396,16 @@ parseCliOptions cliOptions =
398396

399397

400398
type alias Step a =
401-
( Pages.Script.Spinner.Steps FatalError a
402-
, BackendTask FatalError a
403-
)
399+
Pages.Script.Spinner.Steps FatalError a
404400

405401

406402
withStep :
407403
String
408404
-> (a -> BackendTask FatalError b)
409405
-> Step a
410406
-> Step b
411-
withStep label toTask ( steps, task ) =
412-
( Pages.Script.Spinner.withStep label toTask steps
413-
, task
414-
|> BackendTask.andThen
415-
(\input ->
416-
Pages.Script.log label
417-
|> BackendTask.andThen (\() -> toTask input)
418-
)
419-
)
407+
withStep label toTask steps =
408+
Pages.Script.Spinner.withStep label toTask steps
420409

421410

422411
withInnerStep :
@@ -426,7 +415,7 @@ withInnerStep :
426415
-> (a -> BackendTask FatalError b)
427416
-> Step ( a, c, d )
428417
-> Step ( b, c, d )
429-
withInnerStep index total label toTask ( steps, task ) =
418+
withInnerStep index total label toTask steps =
430419
let
431420
fullLabel : String
432421
fullLabel =
@@ -436,16 +425,9 @@ withInnerStep index total label toTask ( steps, task ) =
436425
combinedTask ( input, acc1, acc2 ) =
437426
toTask input |> BackendTask.map (\result -> ( result, acc1, acc2 ))
438427
in
439-
( Pages.Script.Spinner.withStep fullLabel
428+
Pages.Script.Spinner.withStep fullLabel
440429
combinedTask
441430
steps
442-
, task
443-
|> BackendTask.andThen
444-
(\( input, acc1, acc2 ) ->
445-
Pages.Script.log fullLabel
446-
|> BackendTask.andThen (\() -> combinedTask ( input, acc1, acc2 ))
447-
)
448-
)
449431

450432

451433
withConfig : OpenApi.Config.Config -> BackendTask FatalError ()
@@ -527,10 +509,8 @@ withConfig config =
527509
)
528510
)
529511
( 1
530-
, ( Pages.Script.Spinner.steps
531-
|> Pages.Script.Spinner.withStep "Collecting configuration" (\_ -> BackendTask.succeed ( (), [], [] ))
532-
, Pages.Script.log "Collecting configuration" |> BackendTask.map (\() -> ( (), [], [] ))
533-
)
512+
, Pages.Script.Spinner.steps
513+
|> Pages.Script.Spinner.withStep "Collecting configuration" (\_ -> BackendTask.succeed ( (), [], [] ))
534514
)
535515
(OpenApi.Config.inputs config)
536516
|> Tuple.second
@@ -546,31 +526,11 @@ withConfig config =
546526
withStep "Format with elm-format" (onFirst attemptToFormat)
547527
)
548528
|> withStep "Write to disk" (onFirst (writeSdkToDisk (OpenApi.Config.outputDirectory config)))
549-
|> (\( steps, task ) ->
550-
terminalInfo
551-
|> BackendTask.andThen
552-
(\{ isTTY, noColor } ->
553-
if isTTY && not noColor then
554-
Pages.Script.Spinner.runSteps steps
555-
556-
else
557-
task
558-
)
559-
)
529+
|> Pages.Script.Spinner.runSteps
560530
|> BackendTask.map convertElmCodegenWarnings
561531
|> BackendTask.andThen printSuccessMessageAndWarnings
562532

563533

564-
terminalInfo : BackendTask FatalError { isTTY : Bool, noColor : Bool }
565-
terminalInfo =
566-
BackendTask.map2 (\isTTY noColor -> { isTTY = isTTY, noColor = noColor })
567-
(BackendTask.Custom.run "isTTY" Json.Encode.null Json.Decode.bool
568-
|> BackendTask.allowFatal
569-
|> BackendTask.quiet
570-
)
571-
(BackendTask.Env.get "NO_COLOR" |> BackendTask.map (\nc -> nc /= Nothing && nc /= Just ""))
572-
573-
574534
convertElmCodegenWarnings :
575535
( List ( String, List { declaration : String, warning : String } )
576536
, { warnings : List OpenApi.Generate.Message, requiredPackages : FastSet.Set String }
@@ -806,17 +766,7 @@ convertToSwaggerAndThenDecode config input value =
806766
parseOriginal input swagger
807767
|> BackendTask.andThen mergeOverrides
808768
)
809-
|> (\task ->
810-
terminalInfo
811-
|> BackendTask.andThen
812-
(\{ isTTY, noColor } ->
813-
if isTTY && not noColor then
814-
Pages.Script.Spinner.runTask "Convert Swagger to Open API" task
815-
816-
else
817-
task
818-
)
819-
)
769+
|> Pages.Script.Spinner.runTask "Convert Swagger to Open API"
820770
|> BackendTask.andThen (\converted -> decodeOpenApiSpecOrFail { hasAttemptedToConvertFromSwagger = True } config input converted)
821771

822772

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"elm-codegen": "^0.6.3",
2727
"elm-format": "0.8.7",
2828
"elm-optimize-level-2": "0.3.5",
29-
"elm-pages": "^3.1.1",
29+
"elm-pages": "^3.2.0",
3030
"elm-review": "^2.13.5",
3131
"elm-test": "^0.19.1-revision17",
3232
"lamdera": "^0.19.1-1.4.0",

0 commit comments

Comments
 (0)