Refactor source paths

This commit is contained in:
linguist
2020-12-30 20:05:31 +01:00
parent dd0b3c5626
commit e38614a100
45 changed files with 32 additions and 36 deletions

View File

@@ -596,19 +596,16 @@ For example, to keep only `header` and `repositories` sections, add the followin
base: "header, repositories" # opt-out from "activity", "community" and "metadata"
```
##### Organizations Count
#### 🏦 Organizations memberships
By default, community section, counts organization for which you've made your membership public. You can publicise your membership in an organisation:
By default, the `community` section only counts public organizations memberships.
You can change your membership visibility in the `People` tab of your organization :
1. Go to your team/organisation profile.
2. Click on the 'People' tab (The URL will be similar to: `https://github.com/orgs/{foo}/people`)
3. Go to the line with your profile and change `Private` to `Public`
![Publish organization membership](.github/readme/imgs/setup_public_membership_org.png)
Reference: [New GitHub organization isn't showing on my profile](https://webapps.stackexchange.com/questions/33932/new-github-organization-isnt-showing-on-my-profile)
To include private organizations memberships, you'll need to add the `read:org` scope to your personal token.
To count organization(s) of which you wish to remain as a private member, you need to provide update personal token with `read:org` previledge.
![](https://user-images.githubusercontent.com/22963968/103213806-14f6fc80-490f-11eb-9fa5-087195843efc.png)
![Add read:org scope to personal token](.github/readme/imgs/setup_token_org_read_scope.png)
</details>

View File

@@ -54,7 +54,7 @@ inputs:
default: 100
# Template to use
# See https://github.com/lowlighter/metrics/tree/master/src/templates for supported templates
# See https://github.com/lowlighter/metrics/tree/master/source/templates for supported templates
template:
description: Template to use
default: classic

View File

@@ -4,8 +4,7 @@
"description": "An image generator with 20+ metrics about your GitHub account such as activity, community, repositories, coding habits, website performances, music played, starred topics, etc. that you can put on your profile or elsewhere !",
"main": "index.mjs",
"scripts": {
"start": "node index.mjs",
"build": "node utils/build.mjs",
"start": "node source/app/web/index.mjs",
"test": "npx jest",
"upgrade": "npm install @actions/core@latest @actions/github@latest @octokit/graphql@latest @octokit/rest@latest axios@latest colors@latest compression@latest ejs@latest express@latest express-rate-limit@latest image-to-base64@latest memory-cache@latest prismjs@latest puppeteer@latest svgo@latest vue@latest vue-prism-component@latest jest@latest js-yaml@latest libxmljs@latest"
},

View File

@@ -1,10 +1,10 @@
//Imports
import setup from "./../src/setup.mjs"
import metrics from "./../src/metrics.mjs"
import octokit from "@octokit/graphql"
import core from "@actions/core"
import github from "@actions/github"
import mocks from "./../src/mocks.mjs"
import octokit from "@octokit/graphql"
import setup from "../setup.mjs"
import mocks from "../mocks.mjs"
import metrics from "../metrics.mjs"
;((async function () {
//Yaml boolean converter

View File

@@ -1,15 +1,15 @@
//Imports
import ejs from "ejs"
import SVGO from "svgo"
import imgb64 from "image-to-base64"
import axios from "axios"
import puppeteer from "puppeteer"
import url from "url"
import processes from "child_process"
import fs from "fs/promises"
import os from "os"
import paths from "path"
import util from "util"
import axios from "axios"
import url from "url"
import puppeteer from "puppeteer"
import processes from "child_process"
import ejs from "ejs"
import imgb64 from "image-to-base64"
import SVGO from "svgo"
//Setup
export default async function metrics({login, q, dflags = []}, {graphql, rest, plugins, conf, die = false, verify = false}, {Plugins, Templates}) {

View File

@@ -10,13 +10,13 @@
export default async function ({log = true} = {}) {
//Paths
const __metrics = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "..")
const __templates = path.join(__metrics, "src/templates")
const __plugins = path.join(__metrics, "src/plugins")
const __queries = path.join(__metrics, "src/queries")
const __metrics = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "../..")
const __statics = path.join(__metrics, "source/app/web/statics")
const __templates = path.join(__metrics, "source/templates")
const __plugins = path.join(__metrics, "source/plugins")
const __queries = path.join(__metrics, "source/queries")
const __package = path.join(__metrics, "package.json")
const __settings = path.join(__metrics, "settings.json")
const __statics = path.join(__metrics, "src/web")
const __modules = path.join(__metrics, "node_modules")
//Init

View File

@@ -1,5 +1,5 @@
//Imports
import app from "./src/app.mjs"
import app from "./instance.mjs"
//Start app
await app({mock:process.env.USE_MOCKED_DATA})

View File

@@ -1,14 +1,14 @@
//Imports
import express from "express"
import octokit from "@octokit/graphql"
import OctokitRest from "@octokit/rest"
import cache from "memory-cache"
import express from "express"
import ratelimit from "express-rate-limit"
import compression from "compression"
import cache from "memory-cache"
import util from "util"
import setup from "./setup.mjs"
import metrics from "./metrics.mjs"
import mocks from "./mocks.mjs"
import setup from "../setup.mjs"
import mocks from "../mocks.mjs"
import metrics from "../metrics.mjs"
/** App */
export default async function ({mock = false} = {}) {

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@@ -17,7 +17,7 @@
action.run = async (vars) => await new Promise((solve, reject) => {
let [stdout, stderr] = ["", ""]
const env = {...process.env, ...action.input(vars), GITHUB_REPOSITORY:"lowlighter/metrics"}
const child = processes.spawn("node", ["action/index.mjs"], {env})
const child = processes.spawn("node", ["source/app/action/index.mjs"], {env})
child.stdout.on("data", data => stdout += data)
child.stderr.on("data", data => stderr += data)
child.on("close", code => {
@@ -33,7 +33,7 @@
web.run = async (vars) => (await axios(`http://localhost:3000/lowlighter?${new url.URLSearchParams(Object.fromEntries(Object.entries(vars).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value])))}`)).status === 200
beforeAll(async () => await new Promise((solve, reject) => {
let stdout = ""
web.instance = processes.spawn("node", ["index.mjs"], {env:{...process.env, USE_MOCKED_DATA:true}})
web.instance = processes.spawn("node", ["source/app/web/index.mjs"], {env:{...process.env, USE_MOCKED_DATA:true}})
web.instance.stdout.on("data", data => (stdout += data, /Server ready !/.test(stdout) ? solve() : null))
web.instance.stderr.on("data", data => console.error(`${data}`))
}))