Skip to content
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

Show changelog after install npm package #98

Open
egoist opened this issue Jul 8, 2017 · 13 comments
Open

Show changelog after install npm package #98

egoist opened this issue Jul 8, 2017 · 13 comments

Comments

@egoist
Copy link

egoist commented Jul 8, 2017

Just searched npm and didn't find an exiting solution.

Basically you can call this module inside postinstall hook to display changelog for the new version.

{
  "scripts": {
    "postinstall": "show-changelog",
    // or maybe log level
    "postinstall": "show-changelog --level breaking"
  }
}
@Qix-
Copy link
Collaborator

Qix- commented Jul 9, 2017

Well the postinstall hook is going to be running in the root of the module directory, so just open the package.json in that directory and look at the name (I would guess). :)

@parro-it
Copy link

@prattheev , @Qix-, if you are sure you always call the module as an npm script, you can access the env variables defined by npm itself.

The one you need is npm_package_name

@Qix-
Copy link
Collaborator

Qix- commented Jul 21, 2017

TIL, thanks @parro-it :)

@parro-it
Copy link

You're welcome @Qix- 🙂

@Richienb
Copy link

@egoist I'll start working on this.

@CanRau
Copy link

CanRau commented Feb 25, 2020

That sounds useful 😃 maybe messy depending on how it's showing all the changelogs 😄

@Richienb
Copy link

@CanRau The package is probably only going to show the changelog of the current version to keep it tidy.

@vladimyr
Copy link

What's the value of showing changelog paths/contents on the first install? 🤔It is a fresh start and don't we expect they'll go and check the documentation for the version they are installing anyway?

Where should that script live? Should it be part of package/dependency scripts or consumer/application scripts?

The only useful scenario I could imagine is having already initialized project with a particular version of dependency and then bumping it to a newer one with appropriate changelog being presented. But that is pretty much what npm-check does.

Also, @prattheev actually did something: https://github.com/prattheev/whatsnew

@Richienb
Copy link

Richienb commented Feb 25, 2020

@vladimyr My perspective on the request is that it's bundled as a dependency for a package and is run on install to show the changelog.

@Richienb
Copy link

Minor roadblock: There isn't a complete standard for writing CHANGELOG.md files so parsing them will be very hard.

@vladimyr
Copy link

This is exactly why you shouldn't try to parse and render them in the terminal but show links to them instead.
Also, I would advise you against showing stuff on every install because people tend to have pretty strong and negative feelings to nonessential and unrequested stuff popping up in their terminals.

@Richienb
Copy link

@vladimyr In that case, we can probably detect for when the module is updated and only show it then.

@theoludwig
Copy link

I think it would be better if it is something that npm could handle itself behind a flag option, rather than a npm package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants