Skip to content

Stop printing package management updates when compiling to stdout #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/Main.gren
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,20 @@ parseUserArgs model compilerPath =
|> Task.perform RunCmd

CliParser.Make flags ->
resolveProject model
let
determineOutputStreamForResolve =
when flags.output is
Just Compiler.Backend.StdOut ->
-- We only want to print the actual generated JS
-- in this case, ignoring everything else
Terminal.Help.getNullStream
|> Task.map Stream.writable

_ ->
Task.succeed model.stdout
in
determineOutputStreamForResolve
|> Task.andThen (\output -> resolveProject { model | stdout = output })
|> Task.andThen (verifyMakeFlags model.fsPermission flags.entryPoints flags.output)
|> Task.map
(\resolved ->
Expand Down Expand Up @@ -534,7 +547,20 @@ parseUserArgs model compilerPath =
|> Task.perform RunCmd

CliParser.Docs flags ->
resolveProject model
let
determineOutputStreamForResolve =
when flags.output is
Just Compiler.Backend.DocsStdOut ->
-- We only want to print the actual generated JS
-- in this case, ignoring everything else
Terminal.Help.getNullStream
|> Task.map Stream.writable

_ ->
Task.succeed model.stdout
in
determineOutputStreamForResolve
|> Task.andThen (\output -> resolveProject { model | stdout = output })
|> Task.map
(\resolved ->
Compiler.Backend.run
Expand Down
8 changes: 8 additions & 0 deletions src/Terminal/Help.gren
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Terminal.Help exposing
, prettyPrint
, report
, makeLink
, getNullStream
)

import CLI.PrettyPrinter as PP
Expand Down Expand Up @@ -124,3 +125,10 @@ makeNakedLink filename =
, PP.text (SemanticVersion.toString Meta.version)
, PP.text ("/hints/" ++ filename ++ ".md")
]


getNullStream : Task x (Stream.Transformation Bytes Bytes)
getNullStream =
Stream.customTransformation
(\state _ -> Stream.UpdateState state)
Bytes.empty
9 changes: 1 addition & 8 deletions src/Terminal/Run.gren
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ makeProject config projectOutline =
, onComplete = config.onCompiled outputPath
}
in
getNullStream
Help.getNullStream
|> Task.andThen installPackages
|> Task.map backendCommand
|> Task.map compile
Expand Down Expand Up @@ -227,13 +227,6 @@ run config =
-- HELPERS


getNullStream : Task x (Stream.Transformation Bytes Bytes)
getNullStream =
Stream.customTransformation
(\state _ -> Stream.UpdateState state)
Bytes.empty


getProjectOutline : FileSystem.Permission -> Path -> Task Error Outline
getProjectOutline fsPermission path =
path
Expand Down