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

chore(release): update contributors when publishing a release #3552

Merged
merged 1 commit into from Sep 2, 2020

Conversation

devoto13
Copy link
Collaborator

@devoto13 devoto13 commented Sep 1, 2020

Grunt release publishing used to update contributors in package.json, but this feature has been lost during the migration to semantic-release. This PR restores the same logic in semantic-release plugin.

I considered using semantic-release-contributors first, but it has couple of issues:

  • it only adds contributors since last release, so can not restore contributors, who were missed while semantic-release was used for publishing
  • it parses author data from commit and then serializes it back, which in some cases produces wrong results (e.g. David Jensen <david@frode.(none)> becomes an empty string, because parsing silently fails)

Because of the above issues I've re-implemented logic from the Grunt plugin as a semantic-release plugin and applied changes produced by it.

There are a many changes to existing contributors, because current logic sorts them by the amount of commits. I'm open for feedback what is the best approach here: sort alphabetically, historically or something else?

Maybe get rid of this field altogether as contributors are visible in GitHub and NPM does not seem to display them anywhere on the website? I've checked couple of packages from my project and they don't seem to include this field:

  • @auth0/auth0-spa-js - only has "author": "Auth0"
  • @angular/core - only has "author": "angular"
  • @angular/cli - only has "author": "Angular Authors"
  • @ng-bootstrap/ng-bootstrap - points to GitHub: "author": "https://github.com/ng-bootstrap/ng-bootstrap/graphs/contributors"

I actually like the last option as it still gives credit to contributors without having to maintain the list in two places. WDYT?

Grunt release publishing [used to](https://github.com/karma-runner/karma/blob/master/gruntfile.js#L103) update `contributors` in `package.json`, but this feature has been lost during the migration to `semantic-release`. This PR restores the same logic in `semantic-release` plugin.

I considered using [semantic-release-contributors](https://www.npmjs.com/package/semantic-release-contributors) first, but it has couple of issues:
- it only adds contributors since last release, so can not restore contributors, who were missed while semantic-release was used for publishing
- it parses author data from commit and then serializes it back, which in some cases produces wrong results (e.g. David Jensen <david@frode.(none)> becomes an empty string, because parsing silently fails)

Because of the above issues I've re-implemented logic from the [Grunt plugin](https://github.com/vojtajina/grunt-npm/blob/master/tasks/npm.js#L90) as a semantic-release plugin and applied changes produced by it.

There are a many changes to existing contributors, because current logic sorts them by the amount of commits. I'm open for feedback what is the best approach here: sort alphabetically, historically or something else?

Maybe get rid of this field altogether as contributors are visible in GitHub and NPM does not seem to display them anywhere on the website? I've checked couple of packages from my project and they don't seem to include this field:

- @auth0/auth0-spa-js - only has `"author": "Auth0"`
- @angular/core - only has `"author": "angular"`
- @angular/cli - only has `"author": "Angular Authors"`
- @ng-bootstrap/ng-bootstrap - points to GitHub: `"author": "https://github.com/ng-bootstrap/ng-bootstrap/graphs/contributors"`

I actually like the last option as it still gives credit to contributors without having to maintain the list in two places. WDYT?
@karmarunnerbot
Copy link
Member

Build karma 351 completed (commit 2cb4e423f5 by @devoto13)

@karmarunnerbot
Copy link
Member

Build karma 350 completed (commit 2cb4e423f5 by @devoto13)

Copy link
Contributor

@johnjbarton johnjbarton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placing this code in karma-runner/karma could be an issue if we want leverage it for karma-runner/karma-jasmine and similar subprojects.

The last part of the commit message confuses me. "Maybe get rid of this field..." ? The rest of the description and the commit itself is about the contributors field in the package.json. What is the last bit about?

@devoto13
Copy link
Collaborator Author

devoto13 commented Sep 2, 2020

@johnjbarton It's just a last minute thought that crossed my mind after I have finished the implementation.

Maybe it is better to remove contributors field from the package.json instead of implementing a plugin to keep it up to date? So an alternative to this PR is to remove contributors from the package.json and set author field to something like: Karma contributors (https://github.com/karma-runner/karma/graphs/contributors). I wonder what do you think about this alternative approach?

I've checked couple of popular projects from my project's dependencies and discovered that they don't have contributors field in their package.json, but rather say in the author field that it was developed by contributors instead of a single person.

@johnjbarton johnjbarton merged commit 4fdef70 into karma-runner:master Sep 2, 2020
@johnjbarton
Copy link
Contributor

Perhaps it's not vital to have the contributors list, but since you fixed it let's let it be for now.

@karmarunnerbot
Copy link
Member

🎉 This PR is included in version 5.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@devoto13 devoto13 deleted the contributors branch December 16, 2020 19:57
anthony-redFox pushed a commit to anthony-redFox/karma that referenced this pull request May 16, 2023
…runner#3552)

Grunt release publishing [used to](https://github.com/karma-runner/karma/blob/master/gruntfile.js#L103) update `contributors` in `package.json`, but this feature has been lost during the migration to `semantic-release`. This PR restores the same logic in `semantic-release` plugin.

I considered using [semantic-release-contributors](https://www.npmjs.com/package/semantic-release-contributors) first, but it has couple of issues:
- it only adds contributors since last release, so can not restore contributors, who were missed while semantic-release was used for publishing
- it parses author data from commit and then serializes it back, which in some cases produces wrong results (e.g. David Jensen <david@frode.(none)> becomes an empty string, because parsing silently fails)

Because of the above issues I've re-implemented logic from the [Grunt plugin](https://github.com/vojtajina/grunt-npm/blob/master/tasks/npm.js#L90) as a semantic-release plugin and applied changes produced by it.

There are a many changes to existing contributors, because current logic sorts them by the amount of commits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants