diff --git a/.github/workflows/image.yml b/.github/workflows/release.yml similarity index 100% rename from .github/workflows/image.yml rename to .github/workflows/release.yml diff --git a/README.md b/README.md index d27c2a87..e69959ca 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/action.yml b/action.yml index 3d531c00..8f10025d 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/package.json b/package.json index c703f156..e23756c3 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/action/index.mjs b/source/app/action/index.mjs similarity index 99% rename from action/index.mjs rename to source/app/action/index.mjs index 305c9974..2493eb2c 100644 --- a/action/index.mjs +++ b/source/app/action/index.mjs @@ -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 diff --git a/src/metrics.mjs b/source/app/metrics.mjs similarity index 100% rename from src/metrics.mjs rename to source/app/metrics.mjs index 3d3adfd1..0fd37c88 100644 --- a/src/metrics.mjs +++ b/source/app/metrics.mjs @@ -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}) { diff --git a/src/mocks.mjs b/source/app/mocks.mjs similarity index 100% rename from src/mocks.mjs rename to source/app/mocks.mjs diff --git a/src/setup.mjs b/source/app/setup.mjs similarity index 94% rename from src/setup.mjs rename to source/app/setup.mjs index e4f2bdb5..42f8d70b 100644 --- a/src/setup.mjs +++ b/source/app/setup.mjs @@ -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 diff --git a/index.mjs b/source/app/web/index.mjs similarity index 66% rename from index.mjs rename to source/app/web/index.mjs index 4a3d4f60..3d9e1b7e 100644 --- a/index.mjs +++ b/source/app/web/index.mjs @@ -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}) \ No newline at end of file diff --git a/src/app.mjs b/source/app/web/instance.mjs similarity index 98% rename from src/app.mjs rename to source/app/web/instance.mjs index 79286f48..e83415e9 100644 --- a/src/app.mjs +++ b/source/app/web/instance.mjs @@ -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} = {}) { diff --git a/src/html/app.js b/source/app/web/statics/app.js similarity index 100% rename from src/html/app.js rename to source/app/web/statics/app.js diff --git a/src/html/index.html b/source/app/web/statics/index.html similarity index 100% rename from src/html/index.html rename to source/app/web/statics/index.html diff --git a/src/html/style.css b/source/app/web/statics/style.css similarity index 100% rename from src/html/style.css rename to source/app/web/statics/style.css diff --git a/src/plugins/followup/index.mjs b/source/plugins/followup/index.mjs similarity index 100% rename from src/plugins/followup/index.mjs rename to source/plugins/followup/index.mjs diff --git a/src/plugins/gists/index.mjs b/source/plugins/gists/index.mjs similarity index 100% rename from src/plugins/gists/index.mjs rename to source/plugins/gists/index.mjs diff --git a/src/plugins/habits/index.mjs b/source/plugins/habits/index.mjs similarity index 100% rename from src/plugins/habits/index.mjs rename to source/plugins/habits/index.mjs diff --git a/src/plugins/isocalendar/index.mjs b/source/plugins/isocalendar/index.mjs similarity index 100% rename from src/plugins/isocalendar/index.mjs rename to source/plugins/isocalendar/index.mjs diff --git a/src/plugins/languages/index.mjs b/source/plugins/languages/index.mjs similarity index 100% rename from src/plugins/languages/index.mjs rename to source/plugins/languages/index.mjs diff --git a/src/plugins/lines/index.mjs b/source/plugins/lines/index.mjs similarity index 100% rename from src/plugins/lines/index.mjs rename to source/plugins/lines/index.mjs diff --git a/src/plugins/music/index.mjs b/source/plugins/music/index.mjs similarity index 100% rename from src/plugins/music/index.mjs rename to source/plugins/music/index.mjs diff --git a/src/plugins/pagespeed/index.mjs b/source/plugins/pagespeed/index.mjs similarity index 100% rename from src/plugins/pagespeed/index.mjs rename to source/plugins/pagespeed/index.mjs diff --git a/src/plugins/posts/index.mjs b/source/plugins/posts/index.mjs similarity index 100% rename from src/plugins/posts/index.mjs rename to source/plugins/posts/index.mjs diff --git a/src/plugins/projects/index.mjs b/source/plugins/projects/index.mjs similarity index 100% rename from src/plugins/projects/index.mjs rename to source/plugins/projects/index.mjs diff --git a/src/plugins/topics/index.mjs b/source/plugins/topics/index.mjs similarity index 100% rename from src/plugins/topics/index.mjs rename to source/plugins/topics/index.mjs diff --git a/src/plugins/traffic/index.mjs b/source/plugins/traffic/index.mjs similarity index 100% rename from src/plugins/traffic/index.mjs rename to source/plugins/traffic/index.mjs diff --git a/src/plugins/tweets/index.mjs b/source/plugins/tweets/index.mjs similarity index 100% rename from src/plugins/tweets/index.mjs rename to source/plugins/tweets/index.mjs diff --git a/src/queries/calendar.graphql b/source/queries/calendar.graphql similarity index 100% rename from src/queries/calendar.graphql rename to source/queries/calendar.graphql diff --git a/src/queries/common.graphql b/source/queries/common.graphql similarity index 100% rename from src/queries/common.graphql rename to source/queries/common.graphql diff --git a/src/queries/gists.graphql b/source/queries/gists.graphql similarity index 100% rename from src/queries/gists.graphql rename to source/queries/gists.graphql diff --git a/src/queries/projects.graphql b/source/queries/projects.graphql similarity index 100% rename from src/queries/projects.graphql rename to source/queries/projects.graphql diff --git a/src/queries/projects.repository.graphql b/source/queries/projects.repository.graphql similarity index 100% rename from src/queries/projects.repository.graphql rename to source/queries/projects.repository.graphql diff --git a/src/queries/repositories.graphql b/source/queries/repositories.graphql similarity index 100% rename from src/queries/repositories.graphql rename to source/queries/repositories.graphql diff --git a/src/queries/repository.graphql b/source/queries/repository.graphql similarity index 100% rename from src/queries/repository.graphql rename to source/queries/repository.graphql diff --git a/src/templates/classic/fonts.css b/source/templates/classic/fonts.css similarity index 100% rename from src/templates/classic/fonts.css rename to source/templates/classic/fonts.css diff --git a/src/templates/classic/image.svg b/source/templates/classic/image.svg similarity index 100% rename from src/templates/classic/image.svg rename to source/templates/classic/image.svg diff --git a/src/templates/classic/style.css b/source/templates/classic/style.css similarity index 100% rename from src/templates/classic/style.css rename to source/templates/classic/style.css diff --git a/src/templates/classic/template.mjs b/source/templates/classic/template.mjs similarity index 100% rename from src/templates/classic/template.mjs rename to source/templates/classic/template.mjs diff --git a/src/templates/common.mjs b/source/templates/common.mjs similarity index 100% rename from src/templates/common.mjs rename to source/templates/common.mjs diff --git a/src/templates/repository/image.svg b/source/templates/repository/image.svg similarity index 100% rename from src/templates/repository/image.svg rename to source/templates/repository/image.svg diff --git a/src/templates/repository/template.mjs b/source/templates/repository/template.mjs similarity index 100% rename from src/templates/repository/template.mjs rename to source/templates/repository/template.mjs diff --git a/src/templates/terminal/fonts.css b/source/templates/terminal/fonts.css similarity index 100% rename from src/templates/terminal/fonts.css rename to source/templates/terminal/fonts.css diff --git a/src/templates/terminal/image.svg b/source/templates/terminal/image.svg similarity index 100% rename from src/templates/terminal/image.svg rename to source/templates/terminal/image.svg diff --git a/src/templates/terminal/style.css b/source/templates/terminal/style.css similarity index 100% rename from src/templates/terminal/style.css rename to source/templates/terminal/style.css diff --git a/src/templates/terminal/template.mjs b/source/templates/terminal/template.mjs similarity index 100% rename from src/templates/terminal/template.mjs rename to source/templates/terminal/template.mjs diff --git a/tests/metrics.test.js b/tests/metrics.test.js index cf573ee2..8e513c8a 100644 --- a/tests/metrics.test.js +++ b/tests/metrics.test.js @@ -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}`)) }))