Giter Club home page Giter Club logo

updater-contributors's Introduction

updater-contributors NPM version NPM downloads

Update the contributors array in package.json with the contributors returned by the GitHub API.

Install

Install globally with npm

$ npm install --global updater-contributors

Usage

$ update contributors

Help

Common update commands.

Usage: update <command> [options]

Command: updater or tasks to run

Options:

  --config, -c      Save a configuration value to the `update` object in package.json
  --cwd             Set or display the current working directory
  --help, -h        Display this help menu
  --init, -i        Prompts you to specify default updaters to run
  --run             Force updaters/tasks to run regardless of other flags used
  --silent, -S      Silence all tasks and updaters in the terminal
  --version, -V     Display the current version of update
  --verbose, -v     Display all verbose logging messages

If this is the first time you've used update, run the following command to add this updater to your default updaters:

$ update init

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016, Jon Schlinkert. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.30, on September 10, 2016.

updater-contributors's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

updater-contributors's Issues

fails for Mocha

Wanted to get this into our publishing workflow, but ran into varied difficulties.

First problem is that there's something weird going on in either repo-utils, expand-pkg, or parse-git-config. Was trying to fix this, but once parse-git-config giving me problems, I crawled back out of the rabbit hole.

To reproduce badness:

  1. execute npm install -g update update-contributors
  2. execute update init, choose contributors
  3. execute update in mocha working copy
  4. result:
boneskull@lectroid /Volumes/alien/mochajs/mocha                                               [21:19:53]
> $ update                                                                           ⬡ 7.1.0 [±master ✓]
[21:19:59] using file ~/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/lib/updatefile.js
[21:19:59] starting update.contributors
[21:19:59] starting update.contributors:default task
[21:19:59] ✔ running: contributors
[21:19:59] starting update.contributors:authenticate task
[21:19:59] finished update.contributors:authenticate task 3ms
TypeError: Cannot read property 'split' of undefined
    at Object.repo.expandUrl (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/repo-utils/index.js:432:24)
    at Schema.module.exports (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/expand-pkg/lib/expanders/git.js:9:36)
    at Schema.normalizeField (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/map-schema/index.js:557:16)
    at Schema.update (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/map-schema/index.js:246:8)
    at Schema.module.exports (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/expand-pkg/lib/expanders/owner.js:14:10)
    at Schema.normalizeField (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/map-schema/index.js:557:16)
    at Schema.normalize (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/map-schema/index.js:497:27)
    at Config.expand (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/expand-pkg/index.js:103:22)
    at Pkg.<anonymous> (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/update/node_modules/base-pkg/index.js:55:27)
    at Task.fn (/Users/boneskull/.nvm/versions/node/v7.1.0/lib/node_modules/updater-contributors/updatefile.js:23:24)

Mocha's package.json has a string homepage value and an object repository value.

I tracked the problem to the weirdness happening in lib/expanders/git.js of expand-pkg:

module.exports = function(val, key, config, schema) {
  if (utils.isString(config.repository)) {
    utils.merge(config, utils.repo.expandUrl(config.homepage, config));
  }
  // snip
};

I'm not sure why we're looking at config.repository and then expanding config.homepage. The intent of this function is unclear. To convince myself I was sane, I created a failing test:

 it('should use the given homepage if repository.url is present', function() {
   var pkg = {
     homepage: 'https://github.com/jonschlinkert/test-project',
     repository: 'git://github.com/jonschlinkert/test-project.git'
   };
   var res = config.expand(pkg);
   assert(res.homepage);
   assert(res.homepage, 'https://github.com/jonschlinkert/test-project');
});

Anyhow, there were a bunch of other failing tests here, because of problems in parse-git-config and its ilk. Here are some:

  1) expand-pkg (no git repository) owner should get owner from the git url:

      AssertionError: 'Christopher%20Hiller' == 'Christopher Hiller'
      + expected - actual

      -Christopher%20Hiller
      +Christopher Hiller

      at Context.<anonymous> (test/test-no-git.js:271:14)

  2) expand (no package.json) homepage should add a homepage from git repository:

      AssertionError: 'https://github.com/Christopher%20Hiller/project-no-package' == 'https://github.com/jonschlinkert/project-no-package'
      + expected - actual

      -https://github.com/Christopher%20Hiller/project-no-package
      +https://github.com/jonschlinkert/project-no-package

      at Context.<anonymous> (test/test-no-package.js:275:14)
      at test/test-no-package.js:256:9
      at node_modules/gitty/lib/repository.js:529:5
      at ChildProcess.exithandler (child_process.js:202:7)
      at maybeClose (internal/child_process.js:885:16)
      at Socket.<anonymous> (internal/child_process.js:334:11)
      at Pipe._handle.close [as _onclose] (net.js:501:12)

  3) expand (no package.json) homepage should add repository when setting hompage:

      AssertionError: 'Christopher%20Hiller/project-no-package' == 'jonschlinkert/project-no-package'
      + expected - actual

      -Christopher%20Hiller/project-no-package
      +jonschlinkert/project-no-package

      at Context.<anonymous> (test/test-no-package.js:281:14)
      at test/test-no-package.js:256:9
      at node_modules/gitty/lib/repository.js:529:5
      at ChildProcess.exithandler (child_process.js:202:7)
      at maybeClose (internal/child_process.js:885:16)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

FWIW, this is my .gitconfig. If the format is invalid, Git is not complaining about it.

This is where I gave up and decided to tell you about it. 😄

Anyway, once I disabled the weirdness caused by expand-pkg's lib/expanders/git.js, I got some contributors:

{
  "contributors": [
    "TJ Holowaychuk <[email protected]> (http://tjholowaychuk.com)",
    "Christopher Hiller <[email protected]> (https://boneskull.com)",
    "Travis Jeffery <[email protected]> (https://twitter.com/travisjeffery)",
    "Daniel St. Jules <[email protected]> (http://danielstjules.com)",
    "David da Silva <[email protected]> (http://dasilvacont.in)",
    "Guillermo Rauch <[email protected]> (http://twitter.com/rauchg)",
    "Ariel Mashraki <[email protected]> (https://twitter.com/arielmashraki)",
    "Attila Domokos (http://www.adomokos.com)",
    "John Firebaugh (https://github.com/jfirebaugh)",
    "Nathan Houle <[email protected]> (http://nathanhoule.com)",
    "Jo Liss <[email protected]> (https://twitter.com/jo_liss)",
    "(https://github.com/jugglinmike)",
    "Nathan Rajlich <[email protected]> (http://n8.io)",
    "Brendan Nee <[email protected]> (http://blinktag.com)",
    "Glen Mailer <[email protected]> (http://stainlessed.co.uk)",
    "James Carr <[email protected]> (http://blog.james-carr.org)",
    "Domenic Denicola <[email protected]> (https://domenic.me)",
    "Scott Santucci <[email protected]> (https://ScottFreeCode.github.io)",
    "Aaron Heckmann <[email protected]> (http://twitter.com/aaronheckmann)",
    "Mislav Marohnić <[email protected]> (http://mislav.net)",
    "Peter Müller <[email protected]> (https://mntr.dk)",
    "Ryunosuke Sato <[email protected]> (http://tricknotes.hateblo.jp)",
    "Kazuhito Hokamura (http://webtech-walker.com)",
    "Forbes Lindesay (http://www.forbeslindesay.co.uk)",
    "jongleberry <[email protected]> (twitter.com/jongleberry)",
    "Joshua Krall <[email protected]> (https://github.com/jkrall)",
    "Maximilian Antoni <[email protected]> (http://maxantoni.de)",
    "Jake Verbaten <[email protected]> (http://github.com/Raynos)",
    "Xavier Antoviaque <[email protected]> (http://antoviaque.org)",
    "Andreas Lind <[email protected]> (https://github.com/papandreou)",
    "Ben Bradley (https://github.com/ben-bradley/resume)",
    "Benjie Gillam (http://www.benjiegillam.com)",
    "Cory Thomas (https://github.com/dump247)",
    "Fredrik Enestad <[email protected]> (http://soundtrackyourbrand.com)",
    "(https://github.com/jldailey)",
    "Merrick Christensen <[email protected]> (http://www.merrickchristensen.com)",
    "Michael Demmer (https://github.com/demmer)",
    "Nathan Bowser <[email protected]> (nathanbowser.com)",
    "Paul Miller <[email protected]> (paulmillr.com)",
    "Rico Sta. Cruz <[email protected]> (http://ricostacruz.com)",
    "Sindre Sorhus <[email protected]> (https://twitter.com/sindresorhus)",
    "Sune Simonsen <[email protected]> (https://github.com/sunesimonsen)",
    "Tyson Mote <[email protected]> (http://stovepipestudios.com)",
    "Valentin Agachi (http://agachi.name)",
    "Wil Moore III <[email protected]> (http://wilmoore.com)",
    "eiji.ienaga (http://friendfeed.com/haru01)",
    "Zhouxuan Yang <[email protected]> (http://fool2fish.cn)",
    "Adam Gruber (https://github.com/adamgruber)",
    "Alex Early (http://aeflash.com)",
    "Arian Stolwijk <[email protected]> (http://www.aryweb.nl)",
    "Avi Vahl (https://github.com/AviVahl)",
    "",
    "Brian Beck <[email protected]> (http://brianbeck.com)",
    "Buck Doyle (https://github.com/backspace)",
    "Christian (http://www.rndm.de)",
    "",
    "",
    "Ian Storm Taylor (http://ianstormtaylor.com)",
    "",
    "Jacob Wejendorp (http://dorp.io)",
    "James Nylen <[email protected]> (https://about.me/jnylen)",
    "John Reeves (http://jonnyreeves.co.uk)",
    "",
    "",
    "Konstantin Käfer <[email protected]> (https://kkaefer.com)",
    "Long Ho <[email protected]> (https://medium.com/@longho)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Simon Gaeremynck (http://www.gaeremynck.com)",
    "",
    "",
    "",
    "",
    "Xavier Damman <[email protected]> (http://xdamman.com)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "(https://github.com/aaroncrows)",
    "",
    "",
    "",
    "",
    "Andrew Nesbitt <[email protected]> (http://nesbitt.io)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Benoit Larroque (https://github.com/zetaben)",
    "",
    "",
    "Berker Peksag <[email protected]> (http://berkerpeksag.com)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Charles Lowell <[email protected]> (http://frontside.io)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Dominic Barnes <[email protected]> (http://dbarnes.info)",
    "Douglas Wilson <[email protected]> (https://github.com/dougwilson)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Greg Perkins <[email protected]> (https://twitter.com/gregrperkins)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "James Lal <[email protected]> (http://blog.lightsofapollo.com)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Jeremy Martin (https://twitter.com/jmar777)",
    "",
    "João Moreno (http://resume.joaomoreno.com)",
    "Joey Cozza <[email protected]> (https://github.com/joeycozza)",
    "John Doty <[email protected]> (https://github.com/jrhdoty)",
    "",
    "Jonas Dohse (https://github.com/dohse)",
    "(https://github.com/jcreamer898)",
    "",
    "",
    "Jordan Sexton <[email protected]> (http://jordansexton.com)",
    "Josh Eversmann (https://github.com/jeversmann)",
    "Josh Lory (https://github.com/joshlory)",
    "Julien Wajsberg (http://everlong.org)",
    "",
    "",
    "",
    "Keith Cirkel (https://www.keithcirkel.co.uk)",
    "Kent C. Dodds <[email protected]> (https://kentcdodds.com)",
    "Kevin Burke <[email protected]> (https://kev.inburke.com)",
    "Kevin Conway <[email protected]> (https://github.com/kevinconway)",
    "Kevin Kirsche <[email protected]> (https://kevinkirsche.com)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "Mal Graty (https://github.com/mal)",
    "Marc Kuo <[email protected]> (https://routific.com)",
    "Marcello Bastéa-Forte <[email protected]> (http://marcello.cellosoft.com)",
    "",
    "",
    "",
    "",
    "",
    "Matthew Shanley <[email protected]> (http://littlesecretsrecords.com)",
    "(https://github.com/mattias-lw)",
    "Michael Jackson <[email protected]> (http://mjackson.me)",
    "Mike Olson (http://mwolson.org)",
    "",
    "",
    "Michal Charemza (http://charemza.name)",
    "Mick Brooks (http://sinking.in/blog)",
    "Nathan Black <[email protected]> (http://nathanblack.org)",
    "",
    "",
    "olegtsyba <[email protected]> (https://github.com/olegabyst)",
    "",
    "",
    "Pete Hawkins (http://phawk.co.uk)",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    "",
    ""
  ]
}

You can see the current values here.

  1. The contributors should be sorted alphabetically instead of by contribution, which should eliminate most (not all) modifications to this value, and instead only generate additions.
  2. The homepage should fallback to the user's GitHub profile.
  3. The GitHub profile name should be used in lieu of a real name.

AUTHORS file

per this issue update/update#9, from @jamen.

We can add a task that generates the AUTHORS file using the array of authors returned from the GitHub API, and/or directly from package.json authors.

Not updating package.json

I just tried this out on a new repo, and it doesn't seem to do anything, while the output looks ok:

[15:44:34] using file ~/home/basti/.node_modules/lib/node_modules/update/lib/updatefile.js
[15:44:35] starting update.contributors
[15:44:35] starting update.contributors:default task
[15:44:35] ✔ running: contributors
[15:44:35] starting update.contributors:authenticate task
[15:44:35] finished update.contributors:authenticate task 2ms
[15:44:36] finished update.contributors:default task 1s
[15:44:36] finished update.contributors ✔ 1s

Here's the repo (which has one contributor atm): https://github.com/67P/kosmos-schemas

auth

@doowb I know you've done a lot of stuff with the github API recently, I just pushed this up based on the conversation in update/update#10, but there should probably be an auth task that runs before the default task. Maybe even a prompt-auth task as well.

cc @jamen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.