https://github.com/healeycodes/project-mood
Node.js API for generating GitHub badges depending on a repository's mood πΈπ΅βοΈπ
https://github.com/healeycodes/project-mood
badge github-badge nodejs
Last synced: 3 months ago
JSON representation
Node.js API for generating GitHub badges depending on a repository's mood πΈπ΅βοΈπ
- Host: GitHub
- URL: https://github.com/healeycodes/project-mood
- Owner: healeycodes
- Created: 2019-03-10T16:09:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-07T11:56:08.000Z (over 1 year ago)
- Last Synced: 2024-10-05T17:43:19.579Z (over 1 year ago)
- Topics: badge, github-badge, nodejs
- Language: JavaScript
- Homepage:
- Size: 69.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/healeycodes/project-mood)
## Project Mood
Create a badge by pointing an image markup tag to `/:owner/:repo.svg` e.g. `/healeycodes/project-mood.svg`. The API works with any public repository.
Git commits are scanned using the GitHub API to create a dynamic badge based off average commit time.
SVGs will have the average commit time as hover text via the inner-SVG tag ``.
|  |  |  | 
| - | - | - | -
### Roadmap π
If I continue working on this, these are the things that will need to be addressed:
- Caching:
- Repositories should be scanned infrequently rather than per request.
- We can store the most recently requested SVGs in memory.
- Basically, don't generate the SVG for every request (which is used for the prototype).
- Blended colors depending on average time rather than fixed colors.
### Install
`npm i`
### Authentication
For running and testing, set `GHTOKEN` to your GitHub [personal access token](https://github.com/settings/tokens), and `USERAGENT` to a custom user-agent (required by GitHub).
### Run
(Optional) set a port via `PORT` -- `8080` by default.
`npm start`
### Test
This repo uses Travis CI which currently builds and tests for commits/branches/PRs
The test framework is Mocha/SuperTest.
Set `NODE_ENV` to `test`.
`npm test`
```
GET /healeycodes/project-mood
β responds with an SVG (586ms)
GET /healeycodes/missing-or-mispelled-project
β responds with the default errored SVG (395ms)
```