rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Feature Request: npm update : output summary of packages updated and (if available) changelog url

Open aavmurphy opened this issue 2 years ago • 11 comments

npm update doesn't output what it's updated so you have to do npm outdated first, then google each package for changelog or changes or blog posts

it would be nice, for each package updated, it would output a 'changes/changelog/change delta' file

for this to really work, each package would need a changelog file with a 'delta' of changes, e.g. a version-number-tag, followed by changes since the previous release. i'm sure if you specified a 'changelog' standard, they (the package maintainers) would come to the party. perl, nothing to do with npm/js, does it a different way with a 'perldelta[version-number]' file with changes since the previous release

but just a npm update --verbose, listing packages updated with from/to versions, would help

and thanks for npm, appreciated! andrew

aavmurphy avatar Mar 15 '22 08:03 aavmurphy

I think it makes sense for npm update to summarize what's updated. I do not think it makes sense for npm to be in the business of detecting and parsing changelogs.

ljharb avatar Mar 15 '22 17:03 ljharb

@ljharb fair enough. how about package.json having a changelog-url entry, summarise & display the changelog url if there

aavmurphy avatar Mar 15 '22 20:03 aavmurphy

@aavmurphy that covers detection, but not parsing, since there's thousands of changelog formats. Also, not everyone has a changelog file; some projects use github releases, some put changelog entries in the git tag commit message, etc.

ljharb avatar Mar 15 '22 20:03 ljharb

@ljharb Sorry, meant fair enough to drop parsing as too much faffing. Just display from/to version and changelog url if there is one. Something like babeljs 4.5.1 to 4.5.7 www.babeljs.com/changelog

aavmurphy avatar Mar 15 '22 21:03 aavmurphy

I think it makes sense for npm update to summarize what's updated. I do not think it makes sense for npm to be in the business of detecting and parsing changelogs.

if you really want to, you can do changelog info yourself with npm already:

npm diff --diff=pkgName@version --diff=pkgName@latest CHANGELOG.md

if a package doesn't check in their changelog but you want npm to be able to spit out information about it, you might want to ask them to do so - or start publishing it as a package on the registry.

bnb avatar Mar 22 '22 23:03 bnb

@bnb neat! Problem is that some have changes.md, some changelog.md, some blog posts, some nothing. Rather than parsing, just display a link to it. Would need a "changelog" entry in package.json to work.

aavmurphy avatar Mar 24 '22 15:03 aavmurphy

So maybe the first step is trying to popularize, and add to npm init and npm's docs etc, a "changelog" field and a conventional default filename for it?

Once a critical mass of packages are using it (or match the default, which we'd obviously pick to maximize the chances of), then it seems like it'd be much more effective to use npm diff for it.

ljharb avatar Mar 24 '22 16:03 ljharb

Agree.

  1. decide on a changelog name, how about "changes" - simple, and easier for English-not-a-first-language people. Can be a filename or external URL
  2. add (e.g.) babeljs updated from 1.1 to 1.5 {changelog filename-or-url} to the current output And then, as you say wait for it to become popular, before reconsidering an auto-diff option.

aavmurphy avatar Mar 24 '22 16:03 aavmurphy

Given that the most common filename is “changelog.md”, i think probably that’s a better term to use - it’s also more googleable since it’s not an English word.

ljharb avatar Mar 24 '22 17:03 ljharb

Are we talking about a field name in package.json, or are you suggesting a "hardcoded" filename like package.json, in which case it doesn't need an entry.

Some packages, e.g. babeljs, have a changes webpage https://babeljs.io/blog but a complex directory structure with no CHANGELOG.md. However, terser has exactly what you suggest.

{
  "name": "my-great-package",
  "description": "do something clever",
  "changes": "CHANGELOG.md",
....
}

aavmurphy avatar Mar 24 '22 18:03 aavmurphy

Field name. “Changes” is confusing to me (as is the very obscure filename “CHANGES.md”); “changelog” actually describes what it should be.

ljharb avatar Mar 24 '22 18:03 ljharb