22

I forked someone's repo and added functionality. The amount I contributed is just under half of all the functionality it now has.

In the fork in package.json, his name is still in the author field.

Should I change the author field to myself and add him as a contributor to the contributors field? Or should I leave the author field AS-IS and add me as a contributor?

Christiaan Westerbeek
  • 10,619
  • 13
  • 64
  • 89
  • That's a good question. It also happens when you're 2 people, co-authors of one package. Then what? I think the `author` key is not flexible enough. It should accept also an array of authors. In other cases, the `author` is merely the «creator» of the package, but not the author of most of the code. Not even 1%. The code will be totally transformed and won't be distributed in NPM. Example: project starters/generators... Starting a site with Gatsby, it generates a base project with the official boilerplate, but there is already an `author` in package.json. Then what? – juanriqgon Feb 24 '19 at 16:49
  • 1
    `contributors` key (which is not even mentioned in official npm page about package.json) is like: «Hey, this people also did some work here»... but I'm still the main author. It's a difficult matter, I guess. Sorry for this not being an answer, but even more questions, @christiaan-westerbeek. Anyways, in that case, more or less 50% of code, you both should be on `contributors` (but there is the thing that `contributors` is not even parsed by NPM... As example, `eslint` package. List 3 persons (not `authors` key, not `contributors` not https://github.com/eslint/eslint/graphs/contributors). – juanriqgon Feb 24 '19 at 16:59
  • Well, I was wrong. TIL: https://npm.github.io/using-pkgs-docs/package-json/the-package-json-file.html Even a `maintainers` key is mentioned. Maybe that key would be more appropiate for this (seems like it should have the same shape than `contributors` key). – juanriqgon Feb 24 '19 at 17:16

1 Answers1

4

So I just ran into this as well. Going off of @juanriqgon's comment, you could add contributors (in order of who contributed the most - maybe adding a note to the package for that).

{
  "contributors" : [
  {
    "name" : "Barney Rubble",
    "email" : "b@rubble.com",
    "url" : "http://barnyrubble.tumblr.com/"
  },  
  {
    "name" : "Newton Bubble",
    "email" : "n@bubble.com",
    "url" : "http://newtonbubble.tumblr.com/"
  }
 ]
}

source: https://docs.npmjs.com/cli/v7/configuring-npm/package-json#people-fields-author-contributors

hope this helps the community!

Nissal
  • 93
  • 7