Show a message in the log with `postinstall` script

Hi all,
I would like to display a message in the log after installation using the postinstall script but it seems that this is not natively possible (see [BUG] npm install does not run postinstall nor does it show name & version of installed pkg · Issue #3647 · npm/cli · GitHub).

@knolleary would it be possible to add the following flags to the installer (registry)?

  • --foreground-scripts
  • --loglevel=warn: to avoid spamming the log (or maybe info level)

Thanks

Lately I was digging intensively in the details of installer.
May I ask what kind of "spamming the log" you experienced? I'm not aware of any (generated by npm)...

You're right, after several tests the loglevel is not necessary. I don't really have any spam except for audits. (because I forgot to put the flag :man_facepalming: ).
I hadn't checked but by default it's on notice which is higher than info.
I had defined the loglevel to avoid logs like debug but it will not be useful :sweat_smile:

1 Like

What do you think @knolleary about enabling logs during pre/post install scripts?

I don't know if it will be useful to many but I would like to use it to notify the user that they have an action to do. (Knowing very well that not everyone looks at the logs...)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.