-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9a1aebc
Showing
7 changed files
with
280 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.swp | ||
*.swo | ||
*~ | ||
*.log | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# :eight_spoked_asterisk: :stars: :sparkles: :dizzy: :star2: :star2: :sparkles: :dizzy: :star2: :star2: Contributing :star: :star2: :dizzy: :sparkles: :star: :star2: :dizzy: :sparkles: :stars: :eight_spoked_asterisk: | ||
|
||
So, you want to contribute to this project! That's awesome. However, before | ||
doing so, please read the following simple steps how to contribute. This will | ||
make the life easier and will avoid wasting time on things which are not | ||
requested. :sparkles: | ||
|
||
## Discuss the changes before doing them | ||
- First of all, open an issue in the repository, using the [bug tracker][1], | ||
describing the contribution you would like to make, the bug you found or any | ||
other ideas you have. This will help us to get you started on the right | ||
foot. | ||
|
||
- If it makes sense, add the platform and software information (e.g. operating | ||
system, Node.JS version etc.), screenshots (so we can see what you are | ||
seeing). | ||
|
||
- It is recommended to wait for feedback before continuing to next steps. | ||
However, if the issue is clear (e.g. a typo) and the fix is simple, you can | ||
continue and fix it. | ||
|
||
## Fixing issues | ||
- Fork the project in your account and create a branch with your fix: | ||
`some-great-feature` or `some-issue-fix`. | ||
|
||
- Commit your changes in that branch, writing the code following the | ||
[code style][2]. If the project contains tests (generally, the `test` | ||
directory), you are encouraged to add a test as well. :memo: | ||
|
||
- If the project contains a `package.json` or a `bower.json` file add yourself | ||
in the `contributors` array (or `authors` in the case of `bower.json`; | ||
if the array does not exist, create it): | ||
|
||
```json | ||
{ | ||
"contributors": [ | ||
"Your Name <[email protected]> (http://your.website)" | ||
] | ||
} | ||
``` | ||
|
||
## Creating a pull request | ||
|
||
- Open a pull request, and reference the initial issue in the pull request | ||
message (e.g. *fixes #<your-issue-number>*). Write a good description and | ||
title, so everybody will know what is fixed/improved. | ||
|
||
- If it makes sense, add screenshots, gifs etc., so it is easier to see what | ||
is going on. | ||
|
||
## Wait for feedback | ||
Before accepting your contributions, we will review them. You may get feedback | ||
about what should be fixed in your modified code. If so, just keep committing | ||
in your branch and the pull request will be updated automatically. | ||
|
||
## Everyone is happy! | ||
Finally, your contributions will be merged, and everyone will be happy! :smile: | ||
Contributions are more than welcome! | ||
|
||
Thanks! :sweat_smile: | ||
|
||
[1]: https://github.com/IonicaBizau/gh-repos/issues | ||
|
||
[2]: https://github.com/IonicaBizau/code-style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Ionică Bizău <[email protected]> (http://ionicabizau.net) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# gh-repos [][paypal-donations] [](https://www.npmjs.com/package/gh-repos) [](https://www.npmjs.com/package/gh-repos) [](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github) | ||
|
||
> Get one or all the owner repositories from GitHub. | ||
## Installation | ||
|
||
```sh | ||
$ npm i --save gh-repos | ||
``` | ||
|
||
## Example | ||
|
||
```js | ||
const githubRepos = require("gh-repos"); | ||
|
||
// Get a specific repository (the result will be an array containing one element) | ||
githubRepos("IonicaBizau/git-stats", function (err, repos) { | ||
console.log(err || repos); | ||
// [ { id: 30538630, | ||
// name: 'git-stats', | ||
// full_name: 'IonicaBizau/git-stats', | ||
// owner: { login: 'IonicaBizau', ...}, | ||
// private: false, | ||
// ... | ||
// subscribers_count: 52 } ] | ||
}); | ||
|
||
// Get all my repositories | ||
githubRepos("IonicaBizau", function (err, repos) { | ||
console.log(err || repos); | ||
// [ { id: 20149013, | ||
// name: '3x3-equation-solver', | ||
// full_name: 'IonicaBizau/3x3-equation-solver', | ||
// owner: {...}, | ||
// ... | ||
// default_branch: 'master' }, | ||
// { id: 48318047, | ||
// name: 'add-subtract-date', | ||
// full_name: 'IonicaBizau/add-subtract-date', | ||
// owner: {...}, | ||
// ... | ||
// default_branch: 'master' }, | ||
// ... | ||
// { id: 21358670, | ||
// name: 'youtube-topmost', | ||
// full_name: 'IonicaBizau/youtube-topmost', | ||
// owner: {...}, | ||
// ... | ||
// default_branch: 'master' } ] | ||
}); | ||
|
||
// Use a token | ||
githubRepos("IonicaBizau", "your token", function (err, repos) { | ||
// ... | ||
}); | ||
``` | ||
|
||
## Documentation | ||
|
||
### `ghRepos(input, token, cb)` | ||
Get one or all the owner repositories from GitHub. | ||
|
||
#### Params | ||
- **String** `input`: The GitHub owner or repository full name (`owner/repo`). | ||
- **String** `token`: An optional GitHub token. | ||
- **Function** `cb`: The callback function. | ||
|
||
## How to contribute | ||
Have an idea? Found a bug? See [how to contribute][contributing]. | ||
|
||
## Where is this library used? | ||
If you are using this library in one of your projects, add it in this list. :sparkles: | ||
|
||
## License | ||
|
||
[MIT][license] © [Ionică Bizău][website] | ||
|
||
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW | ||
[donate-now]: http://i.imgur.com/6cMbHOC.png | ||
|
||
[license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(http%3A%2F%2Fionicabizau.net)&year=2016#license-mit | ||
[website]: http://ionicabizau.net | ||
[contributing]: /CONTRIBUTING.md | ||
[docs]: /DOCUMENTATION.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const githubRepos = require("../lib"); | ||
|
||
// Get a specific repository (the result will be an array containing one element) | ||
githubRepos("IonicaBizau/git-stats", function (err, repos) { | ||
console.log(err || repos); | ||
// [ { id: 30538630, | ||
// name: 'git-stats', | ||
// full_name: 'IonicaBizau/git-stats', | ||
// owner: { login: 'IonicaBizau', ...}, | ||
// private: false, | ||
// ... | ||
// subscribers_count: 52 } ] | ||
}); | ||
|
||
// Get all my repositories | ||
githubRepos("IonicaBizau", function (err, repos) { | ||
console.log(err || repos); | ||
// [ { id: 20149013, | ||
// name: '3x3-equation-solver', | ||
// full_name: 'IonicaBizau/3x3-equation-solver', | ||
// owner: {...}, | ||
// ... | ||
// default_branch: 'master' }, | ||
// { id: 48318047, | ||
// name: 'add-subtract-date', | ||
// full_name: 'IonicaBizau/add-subtract-date', | ||
// owner: {...}, | ||
// ... | ||
// default_branch: 'master' }, | ||
// ... | ||
// { id: 21358670, | ||
// name: 'youtube-topmost', | ||
// full_name: 'IonicaBizau/youtube-topmost', | ||
// owner: {...}, | ||
// ... | ||
// default_branch: 'master' } ] | ||
}); | ||
|
||
// Use a token | ||
githubRepos("IonicaBizau", "your token", function (err, repos) { | ||
// ... | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use strict"; | ||
|
||
const GitHub = require("gh.js") | ||
, ownerRepo = require("owner-repo") | ||
, typpy = require("typpy") | ||
; | ||
|
||
/** | ||
* ghRepos | ||
* Get one or all the owner repositories from GitHub. | ||
* | ||
* @name ghRepos | ||
* @function | ||
* @param {String} input The GitHub owner or repository full name (`owner/repo`). | ||
* @param {String} token An optional GitHub token. | ||
* @param {Function} cb The callback function. | ||
*/ | ||
module.exports = function ghRepos(input, token, cb) { | ||
if (typeof token === "function") { | ||
cb = token; | ||
token = undefined; | ||
} | ||
let parsed = ownerRepo(input) | ||
, gh = new GitHub({ token: token }) | ||
, done = (err, data) => { | ||
if (data && typpy(data, Object)) { | ||
data = [data]; | ||
} | ||
cb(err, data, gh); | ||
} | ||
; | ||
|
||
parsed.repo | ||
? gh.get(`repos/${parsed.full_name}`, done) | ||
: gh.get(`users/${parsed.full_name}/repos`, { all: true }, done) | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "gh-repos", | ||
"version": "1.0.0", | ||
"description": "Get one or all the owner repositories from GitHub.", | ||
"main": "lib/index.js", | ||
"directories": { | ||
"example": "example" | ||
}, | ||
"dependencies": { | ||
"gh.js": "^2.4.1", | ||
"typpy": "^2.3.1" | ||
}, | ||
"devDependencies": {}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Ionică Bizău <[email protected]> (http://ionicabizau.net)", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]/IonicaBizau/gh-repos.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/IonicaBizau/gh-repos/issues" | ||
}, | ||
"homepage": "https://github.com/IonicaBizau/gh-repos#readme" | ||
} |