-
Notifications
You must be signed in to change notification settings - Fork 766
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
refactor tests, update dependencies and Project API #401
Changes from all commits
a8ae05f
f5e6fa3
26fa048
7c1684e
a5e3dbb
cff3973
4f46d10
83292fd
332456b
8b8c4fd
0505bb3
68ef1f6
cda2c42
99c1aeb
0c5546f
be44fd1
c12ad57
308aced
3ec2837
21e50ec
2a0bdf2
ee8af3f
5418512
71a6326
5dd868f
077736b
55db033
068476d
97ac33f
1605b89
a80922c
121066c
9877d9e
45a6ef3
fe146a5
c9de004
e1ae825
fd5d57b
39dc920
ac41f60
e0bbf7e
f998a39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ docs/ | |
dist/ | ||
coverage/ | ||
node_modules/ | ||
|
||
.nyc_output/ | ||
/out/ | ||
.DS_Store | ||
npm-debug.log | ||
sauce.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
docs/ | ||
coverage/ | ||
node_modules/ | ||
|
||
lib/ | ||
.nyc_output/ | ||
.DS_Store | ||
sauce.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,50 +2,19 @@ | |
|
||
[][npm-package] | ||
[][npm-package] | ||
[][gitter] | ||
[][travis-ci] | ||
<!-- [][codecov] --> | ||
[][gitter] | ||
[][travis-ci] | ||
[][codecov] | ||
|
||
Github.js provides a minimal higher-level wrapper around Github's API. It was concieved in the context of | ||
[Prose][prose], a content editor for GitHub. | ||
Github.js provides a minimal higher-level wrapper around Github's API. | ||
|
||
## [Read the docs][docs] | ||
|
||
## Installation | ||
Github.js is available from `npm` or [unpkg][unpkg]. | ||
|
||
```shell | ||
npm install github-api | ||
``` | ||
|
||
```html | ||
<!-- just github-api source (5.3kb) --> | ||
<script src="https://unpkg.com/github-api/dist/GitHub.min.js"></script> | ||
|
||
<!-- standalone (20.3kb) --> | ||
<script src="https://unpkg.com/github-api/dist/GitHub.bundle.min.js"></script> | ||
``` | ||
|
||
## Compatibility | ||
Github.js is tested on Node: | ||
* 6.x | ||
* 5.x | ||
* 4.x | ||
* 0.12 | ||
|
||
## GitHub Tools | ||
|
||
The team behind Github.js has created a whole organization, called [GitHub Tools](https://github.com/github-tools), | ||
dedicated to GitHub and its API. In the near future this repository could be moved under the GitHub Tools organization | ||
as well. In the meantime, we recommend you to take a look at other projects of the organization. | ||
|
||
## Samples | ||
## Usage | ||
|
||
```javascript | ||
/* | ||
Data can be retrieved from the API either using callbacks (as in versions < 1.0) | ||
or using a new promise-based API. For now the promise-based API just returns the | ||
raw HTTP request promise; this might change in the next version. | ||
or using a new promise-based API. The promise-based API returns the raw Axios | ||
request promise. | ||
*/ | ||
import GitHub from 'github-api'; | ||
|
||
|
@@ -62,57 +31,66 @@ gist.create({ | |
} | ||
}).then(function({data}) { | ||
// Promises! | ||
let gistJson = data; | ||
gist.read(function(err, gist, xhr) { | ||
// if no error occurred then err == null | ||
|
||
// gistJson === httpResponse.data | ||
|
||
// xhr === httpResponse | ||
}); | ||
let createdGist = data; | ||
return gist.read(); | ||
}).then(function({data}) { | ||
let retrievedGist = data; | ||
// do interesting things | ||
}); | ||
``` | ||
|
||
```javascript | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the thought behind removing all this documentation? Are you proposing we drop the link to the generated Docs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not removed, it's rearranged to fit https://github.com/noffle/art-of-readme |
||
import GitHub from 'github-api'; | ||
var GitHub = require('github-api'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why downgrade from ECMA2015? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hum, because for people who are not using babel/ES6, it's an additional cognitive load which can be avoided. For people using ES6, I'm quite sure they know how to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My opinion is that ECMA2015 is spec now, so there's no need to downgrade. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My idea was, and hope is, that we can have at least one example of each of: That being said I think that perhaps that means most of our examples are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That might be a solution. Feel free to commit on directly here |
||
|
||
// basic auth | ||
const gh = new GitHub({ | ||
var gh = new GitHub({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again downgrading from ECMA2015? |
||
username: 'FOO', | ||
password: 'NotFoo' | ||
/* also acceptable: | ||
token: 'MY_OAUTH_TOKEN' | ||
*/ | ||
}); | ||
|
||
const me = gh.getUser(); | ||
var me = gh.getUser(); // no user specified defaults to the user for whom credentials were provided | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another downgrade from ECMA2015, I'll stop mentioning all the ones I see now. |
||
me.listNotifications(function(err, notifications) { | ||
// do some stuff | ||
}); | ||
|
||
const clayreimann = gh.getUser('clayreimann'); | ||
clayreimann.listStarredRepos() | ||
.then(function({data: reposJson}) { | ||
// do stuff with reposJson | ||
}); | ||
var clayreimann = gh.getUser('clayreimann'); | ||
clayreimann.listStarredRepos(function(err, repos) { | ||
// look at all the starred repos! | ||
}); | ||
``` | ||
|
||
```javascript | ||
var GitHub = require('github-api'); | ||
## API Documentation | ||
|
||
// token auth | ||
var gh = new GitHub({ | ||
token: 'MY_OAUTH_TOKEN' | ||
}); | ||
[API documentation][docs] is hosted on github pages, and is generated from JSDoc; any contributions | ||
should include updated JSDoc. | ||
|
||
## Installation | ||
Github.js is available from `npm` or [unpkg][unpkg]. | ||
|
||
var yahoo = gh.getOrganization('yahoo'); | ||
yahoo.listRepos(function(err, repos) { | ||
// look at all the repos! | ||
}) | ||
```shell | ||
npm install github-api | ||
``` | ||
|
||
[codecov]: https://codecov.io/github/michael/github?branch=master | ||
```html | ||
<!-- just github-api source (5.3kb) --> | ||
<script src="https://unpkg.com/github-api/dist/GitHub.min.js"></script> | ||
|
||
<!-- standalone (20.3kb) --> | ||
<script src="https://unpkg.com/github-api/dist/GitHub.bundle.min.js"></script> | ||
``` | ||
|
||
## Compatibility | ||
`Github.js` is tested on Node.js: | ||
* 6.x | ||
|
||
Note: `Github.js` uses Promise, hence it will not work in Node.js < 4 without polyfill. | ||
|
||
[codecov]: https://codecov.io/github/github-tools/github?branch=master | ||
[docs]: http://github-tools.github.io/github/ | ||
[gitter]: https://gitter.im/michael/github | ||
[gitter]: https://gitter.im/github-tools/github | ||
[npm-package]: https://www.npmjs.com/package/github-api/ | ||
[unpkg]: https://unpkg.com/github-api/ | ||
[prose]: http://prose.io | ||
[travis-ci]: https://travis-ci.org/michael/github | ||
[xhr-link]: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx | ||
[travis-ci]: https://travis-ci.org/github-tools/github |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much longer is node4 supported? Maybe we don't drop support for
node4
just yet.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not dropping the support for node4, just node 0.12 and earlier. I removed it from the test cause there were some issues with running the test 3 times in parallel. But maybe we should test on node4 only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be solved by running them serially: https://docs.travis-ci.com/user/customizing-the-build#Limiting-Concurrent-Builds