purescript / spago

🍝 PureScript package manager and build tool
BSD 3-Clause "New" or "Revised" License
793 stars 132 forks source link

Quiet/Silent option #170

Closed jgoux closed 5 years ago

jgoux commented 5 years ago

Hello,

would it be possible to add a --silent or --quiet option to spago build so we don't have these messages :

File changed, rebuilding: "/home/jgoux/Projects/eurofins/colisage/purescript/server/src/Main.purs"
Compiling Main
Build succeeded.
Success! Waiting for next file change.
Type help for available commands. Press enter to force a rebuild.

My use case is when using the --watch option, I'd like to see the app's output only when the project rebuilds.

f-f commented 5 years ago

Hi @jgoux!

I have some questions:

If we want to just hide the "File changed" then we could emit it only when --verbose is specified. If we want to hide more, then we could add levels to the --verbose flag (as proposed in https://github.com/spacchetti/spago/issues/154#issuecomment-474883921 - so that e.g. --verbose 0 would hide output) or just add the --silent

jgoux commented 5 years ago

Hello @f-f ,

I'd like to be able to hide all the lines I showed.

I'm using nodemon to reload my index.js file when I have a change inside output/**/*.js

So I'd like to see only the output of my app which is what is logged from the app itself :

image

In this example, I'd like to see only the lines with the emoji, which are logged from my app's code.

Here is my package.json scripts :

"scripts": {
    "dev": "run-p dev:*",
    "dev:purescript": "spago build --watch",
    "dev:js": "nodemon -q -w output -w index.js index.js",
    "build": "spago build && ncc build index.js"
  }
f-f commented 5 years ago

Thanks @jgoux, I see now! Some more queries:

jgoux commented 5 years ago

I can live with spago build --watch > /dev/null as long as compile errors are logged to stderr so I can see them. 😄

I was aware of spago run --watch but in the context of wrapping a "purescript core" inside a javascript app, I think I prefer using nodemon so it can restart the app from the outside if that makes sense.

f-f commented 5 years ago

@jgoux yes, compiler warnings and errors are logged to stderr.

I think we'll eventually figure out reasons for implementing this, but if this covers your usecase I'll close this issue 🙂