-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Standard way to write a message after package install #6971
Comments
Yep, I agree. I actually opened a thread on OpenCollective some time ago to tell them that they shouldn't do this, but didn't get answers back then. The problem with these kind of features is that it requires adoption otherwise it's pointless, and at the moment I'm already a bit spread thin in terms of advocating for new features. |
@arcanis Thank you for taking the initiative to open the issue on the OpenCollective repo.
If The other issue that would need to be resolved as part of this effort is for postinstall output to not be suppressed. |
My ideas so far are based on the following items:
In this context, I don't think using the postinstall scripts to print messages is a good idea. Packages will compete for attention, and even if we make it slightly easier for package managers to optimize things around I'm not sure the ecosystem will be in a better spot in the end. So I was considering a new field in the {"awareness": "... some message left to the user ..."} Then, when running Additionally, when running This feature would only be available to packages that do not list postinstall scripts (it's a bit tricky because they could workaround this by depending on another package that would have a postinstall script, but I can likely figure out a way to prevent that). Some discussion would have to be made regarding whether transitive dependencies should be taken into consideration. How does that sound? I can make a formal RFC post-v2 (around the end of the year) and include authors of packages that do similar things (@zloirock comes to mind, I might be interested myself at some point). |
@arcanis This proposal sounds perfect. Note: npm is also working on something similar. Would be great if the |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
There are more and more packages that add a
postinstall
script to write some message after installing a package, usually suggesting to support package's author. There are few issues with this:Yarn collapses scripts' stdout, so these messages don't get displayed at all (related to Postinstall script is not being executed #5476)
Since there are no any guidelines, instead of simply logging message it might do web requests, require huge dependencies, or write a lot of text, seriously slowing install process
Since usually modules don't have any scripts I remember all these modules, so noticing a new module makes me check what exactly is being executed. If more modules would adopt that practice, a new module appearing there won't be a surprise, but it actually might be a malicious script
What is the expected behavior?
Provide a new field in
package.json
(for exampleinstallMessage
) to specify a message that would be printed after installing a module. Additionally, it may add a limit to the length of logged message and add a config option to opt-out of it.Thread on npm community
The text was updated successfully, but these errors were encountered: