Update readme and die on unhandled promises rejections

This commit is contained in:
lowlighter
2020-09-18 09:54:25 +02:00
parent dfeb468b82
commit a6ffa0ffd2
11 changed files with 17 additions and 7 deletions

View File

@@ -15,9 +15,9 @@ A GitHub Action which is run periodically at your convenience which generates an
Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below : Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below :
```markdown ```markdown
![GitHub metrics](https://github.com/my-github-user/my-github-user/blob/master/github-metrics.svg) ![GitHub metrics](https://github.com/my-github-user/my-github-user/blob/master/github-metrics.svg)
# Or with a redirection :
[![GitHub metrics](https://github.com/my-github-user/my-github-user/blob/master/github-metrics.svg)](https://github.com/my-github-user/my-github-user)
``` ```
Or with HTML :
```html ```html
<img src="github-metrics.svg" alt="My GitHub metrics"> <img src="github-metrics.svg" alt="My GitHub metrics">
``` ```
@@ -25,6 +25,16 @@ Assuming your username is `my-github-user`, you can embed your metrics in your p
<details> <details>
<summary>💬 How to setup ?</summary> <summary>💬 How to setup ?</summary>
#### 0. Prepare your personal repository
If you don't know yet or haven't done it yet, create a repository with the same name as your GitHub username.
![Personal repository](https://github.com/lowlighter/metrics/blob/master/docs/imgs/personal_repo.png)
The `README.md` of this repository will be displayed on your GitHub user profile like below !
![GitHub Profile](https://github.com/lowlighter/metrics/blob/master/docs/imgs/github_profile.png)
#### 1. Create a GitHub token #### 1. Create a GitHub token
In your account settings, go to `Developer settings` and select `Personal access tokens` to create a new token. In your account settings, go to `Developer settings` and select `Personal access tokens` to create a new token.
@@ -113,8 +123,6 @@ For conveniency, you can use the shared instance available at [metrics.lecoq.io]
Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below : Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below :
```markdown ```markdown
![GitHub metrics](https://metrics.lecoq.io/my-github-user) ![GitHub metrics](https://metrics.lecoq.io/my-github-user)
# Or with a redirection :
[![GitHub metrics](https://metrics.lecoq.io/my-github-user)](https://github.com/my-github-user/my-github-user)
``` ```
<details> <details>
@@ -326,7 +334,7 @@ These can provide more informations into your generated metrics, but it could al
The *pagespeed* plugin allows you to add your website performances. The *pagespeed* plugin allows you to add your website performances.
![Pagespeed plugin](https://github.com/lowlighter/metrics/blob/master/docs/imgs/plugin_pagespeed.jpg) ![Pagespeed plugin](https://github.com/lowlighter/metrics/blob/master/docs/imgs/plugin_pagespeed.png)
These are computed through [Google's pagespeed API](https://developers.google.com/speed/docs/insights/v5/get-started), which returns the same results as [web.dev](https://web.dev). These are computed through [Google's pagespeed API](https://developers.google.com/speed/docs/insights/v5/get-started), which returns the same results as [web.dev](https://web.dev).
@@ -354,7 +362,7 @@ Add the following to your workflow :
The *lines* plugin allows you to add the number of lines of code you added and removed across your repositories. The *lines* plugin allows you to add the number of lines of code you added and removed across your repositories.
![Lines plugin](https://github.com/lowlighter/metrics/blob/master/docs/imgs/plugin_lines.jpg) ![Lines plugin](https://github.com/lowlighter/metrics/blob/master/docs/imgs/plugin_lines.png)
It will consume an additional GitHub request per repository. It will consume an additional GitHub request per repository.
@@ -376,7 +384,7 @@ Add the following to your workflow :
The *traffic* plugin allows you to add the number of pages views across your repositories. The *traffic* plugin allows you to add the number of pages views across your repositories.
![Traffic plugin](https://github.com/lowlighter/metrics/blob/master/docs/imgs/plugin_traffic.jpg) ![Traffic plugin](https://github.com/lowlighter/metrics/blob/master/docs/imgs/plugin_traffic.png)
It will consume an additional GitHub request per repository. It will consume an additional GitHub request per repository.

View File

@@ -28,6 +28,7 @@ __webpack_require__.r(__webpack_exports__);
//Initialization //Initialization
console.log(`GitHub metrics as SVG image`) console.log(`GitHub metrics as SVG image`)
console.log(`========================================================`) console.log(`========================================================`)
process.on("unhandledRejection", error => { throw error })
//Load svg template, style and query //Load svg template, style and query
const template = `<svg xmlns="http://www.w3.org/2000/svg" width="480" height="\${480 + (computed.plugins.pagespeed ? 100 : 0)}"> const template = `<svg xmlns="http://www.w3.org/2000/svg" width="480" height="\${480 + (computed.plugins.pagespeed ? 100 : 0)}">

View File

@@ -13,6 +13,7 @@
//Initialization //Initialization
console.log(`GitHub metrics as SVG image`) console.log(`GitHub metrics as SVG image`)
console.log(`========================================================`) console.log(`========================================================`)
process.on("unhandledRejection", error => { throw error })
//Load svg template, style and query //Load svg template, style and query
const template = `<#include template.svg>`, style = `<#include style.css>`, query = `<#include query.graphql>` const template = `<#include template.svg>`, style = `<#include style.css>`, query = `<#include query.graphql>`

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

BIN
docs/imgs/personal_repo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

BIN
docs/imgs/plugin_lines.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB