Commit 88a1fde
Changed files (20)
.github
workflows
badges
src
.github/workflows/pages.yml
@@ -2,7 +2,7 @@ name: Pages
on:
push:
- branches: ["master"]
+ branches: ['master']
workflow_dispatch:
permissions:
@@ -11,7 +11,7 @@ permissions:
id-token: write
concurrency:
- group: "pages"
+ group: 'pages'
cancel-in-progress: false
jobs:
badges/index.ts
@@ -13,7 +13,7 @@ export default [
await import('./fix-commit/fix-commit.js'),
await import('./github-anniversary/github-anniversary.js'),
await import('./mass-delete-commit/mass-delete-commit.js'),
- await import('./most-reactions/most-reactions.js'),
+ // TODO: await import('./most-reactions/most-reactions.js'),
await import('./my-badges-contributor/my-badges-contributor.js'),
await import('./old-issue/old-issue.js'),
await import('./polite-coder/polite-coder.js'),
scripts/check-images.mjs
@@ -40,5 +40,7 @@ for (const { default: b } of allBadges) {
if (!ok) {
process.exit(1)
} else {
- console.log('✅ All images exist, have the expected dimensions, and have unique ids.')
+ console.log(
+ '✅ All images exist, have the expected dimensions, and have unique ids.',
+ )
}
scripts/generate-gh-pages.mjs
@@ -12,7 +12,9 @@ for (const { default: b } of allBadges) {
const dirname = path.basename(path.dirname(url))
const filename = path.basename(url).replace('.js', '.ts')
for (const id of b.badges) {
- badgesHtml.push(`<a href="https://github.com/my-badges/my-badges/tree/master/badges/${dirname}/${filename}"><img src="https://my-badges.github.io/my-badges/${id}.png" alt="${b.desc}" title="${b.desc}" width="128"></a>`)
+ badgesHtml.push(
+ `<a href="https://github.com/my-badges/my-badges/tree/master/badges/${dirname}/${filename}"><img src="https://my-badges.github.io/my-badges/${id}.png" alt="${b.desc}" title="${b.desc}" width="128"></a>`,
+ )
}
}
src/collect/comments.graphql
@@ -56,7 +56,11 @@ fragment Reactions on Reactable {
}
}
-query DiscussionCommentsQuery($login: String!, $num: Int = 100, $cursor: String) {
+query DiscussionCommentsQuery(
+ $login: String!
+ $num: Int = 100
+ $cursor: String
+) {
user(login: $login) {
repositoryDiscussionComments(first: $num, after: $cursor) {
totalCount
src/collect/comments.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "comments.graphql".
const DiscussionComment = `#graphql
fragment DiscussionComment on DiscussionComment {
@@ -46,7 +46,6 @@ export type DiscussionComment = {
} | null
} & Reactions
-
const IssueComment = `#graphql
fragment IssueComment on IssueComment {
url
@@ -93,7 +92,6 @@ export type IssueComment = {
} | null
} & Reactions
-
const Reactions = `#graphql
fragment Reactions on Reactable {
reactions(first: 100) {
@@ -111,7 +109,15 @@ export type Reactions = {
reactions: {
totalCount: number
nodes: Array<{
- content: 'CONFUSED' | 'EYES' | 'HEART' | 'HOORAY' | 'LAUGH' | 'ROCKET' | 'THUMBS_DOWN' | 'THUMBS_UP'
+ content:
+ | 'CONFUSED'
+ | 'EYES'
+ | 'HEART'
+ | 'HOORAY'
+ | 'LAUGH'
+ | 'ROCKET'
+ | 'THUMBS_DOWN'
+ | 'THUMBS_UP'
user: {
login: string
} | null
@@ -119,7 +125,6 @@ export type Reactions = {
}
}
-
export const DiscussionCommentsQuery = `#graphql
${Reactions}
${IssueComment}
@@ -145,7 +150,11 @@ query DiscussionCommentsQuery($login: String!, $num: Int = 100, $cursor: String)
}
}` as string & DiscussionCommentsQuery
-export type DiscussionCommentsQuery = (vars: { login: string, num?: number | null, cursor?: string | null }) => {
+export type DiscussionCommentsQuery = (vars: {
+ login: string
+ num?: number | null
+ cursor?: string | null
+}) => {
user: {
repositoryDiscussionComments: {
totalCount: number
@@ -164,7 +173,6 @@ export type DiscussionCommentsQuery = (vars: { login: string, num?: number | nul
} | null
}
-
export const IssueCommentsQuery = `#graphql
${Reactions}
${IssueComment}
@@ -190,7 +198,11 @@ query IssueCommentsQuery($login: String!, $num: Int = 100, $cursor: String) {
}
}` as string & IssueCommentsQuery
-export type IssueCommentsQuery = (vars: { login: string, num?: number | null, cursor?: string | null }) => {
+export type IssueCommentsQuery = (vars: {
+ login: string
+ num?: number | null
+ cursor?: string | null
+}) => {
user: {
issueComments: {
totalCount: number
src/collect/commits.graphql
@@ -55,4 +55,3 @@ query CommitsQuery(
resetAt
}
}
-
src/collect/commits.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "commits.graphql".
const Commit = `#graphql
fragment Commit on Commit {
@@ -51,7 +51,6 @@ export type Commit = {
}
}
-
export const CommitsQuery = `#graphql
${Commit}
query CommitsQuery($owner: String!, $name: String!, $author: ID!, $num: Int = 100, $cursor: String) {
@@ -81,19 +80,28 @@ query CommitsQuery($owner: String!, $name: String!, $author: ID!, $num: Int = 10
}
}` as string & CommitsQuery
-export type CommitsQuery = (vars: { owner: string, name: string, author: string, num?: number | null, cursor?: string | null }) => {
+export type CommitsQuery = (vars: {
+ owner: string
+ name: string
+ author: string
+ num?: number | null
+ cursor?: string | null
+}) => {
repository: {
defaultBranchRef: {
- target: {} & {
- history: {
- totalCount: number
- nodes: Array<{} & Commit> | null
- pageInfo: {
- hasNextPage: boolean
- endCursor: string | null
- }
- }
- } | null | null
+ target:
+ | ({} & {
+ history: {
+ totalCount: number
+ nodes: Array<{} & Commit> | null
+ pageInfo: {
+ hasNextPage: boolean
+ endCursor: string | null
+ }
+ }
+ })
+ | null
+ | null
} | null
} | null
rateLimit: {
src/collect/issue-timeline.graphql
@@ -1,4 +1,10 @@
-query IssueTimelineQuery($owner: String!, $name: String!, $number: Int!, $num: Int = 100, $cursor: String) {
+query IssueTimelineQuery(
+ $owner: String!
+ $name: String!
+ $number: Int!
+ $num: Int = 100
+ $cursor: String
+) {
repository(owner: $owner, name: $name) {
issue(number: $number) {
timelineItems(first: $num, after: $cursor) {
src/collect/issue-timeline.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "issue-timeline.graphql".
export const IssueTimelineQuery = `#graphql
query IssueTimelineQuery($owner: String!, $name: String!, $number: Int!, $num: Int = 100, $cursor: String) {
@@ -30,19 +30,28 @@ query IssueTimelineQuery($owner: String!, $name: String!, $number: Int!, $num: I
}
}` as string & IssueTimelineQuery
-export type IssueTimelineQuery = (vars: { owner: string, name: string, number: number, num?: number | null, cursor?: string | null }) => {
+export type IssueTimelineQuery = (vars: {
+ owner: string
+ name: string
+ number: number
+ num?: number | null
+ cursor?: string | null
+}) => {
repository: {
issue: {
timelineItems: {
totalCount: number
- nodes: Array<{
- __typename: string
- } & {
- createdAt: string
- actor: {
- login: string
- } | null
- } | null> | null
+ nodes: Array<
+ | ({
+ __typename: string
+ } & {
+ createdAt: string
+ actor: {
+ login: string
+ } | null
+ })
+ | null
+ > | null
pageInfo: {
hasNextPage: boolean
endCursor: string | null
src/collect/issues.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "issues.graphql".
const Issue = `#graphql
fragment Issue on Issue {
@@ -65,7 +65,15 @@ export type Issue = {
reactions: {
totalCount: number
nodes: Array<{
- content: 'CONFUSED' | 'EYES' | 'HEART' | 'HOORAY' | 'LAUGH' | 'ROCKET' | 'THUMBS_DOWN' | 'THUMBS_UP'
+ content:
+ | 'CONFUSED'
+ | 'EYES'
+ | 'HEART'
+ | 'HOORAY'
+ | 'LAUGH'
+ | 'ROCKET'
+ | 'THUMBS_DOWN'
+ | 'THUMBS_UP'
user: {
login: string
} | null
@@ -83,7 +91,6 @@ export type Issue = {
}
}
-
export const IssuesQuery = `#graphql
${Issue}
query IssuesQuery($username: String!, $num: Int = 100, $cursor: String) {
@@ -107,7 +114,11 @@ query IssuesQuery($username: String!, $num: Int = 100, $cursor: String) {
}
}` as string & IssuesQuery
-export type IssuesQuery = (vars: { username: string, num?: number | null, cursor?: string | null }) => {
+export type IssuesQuery = (vars: {
+ username: string
+ num?: number | null
+ cursor?: string | null
+}) => {
user: {
issues: {
totalCount: number
src/collect/pulls.graphql
@@ -16,7 +16,7 @@ fragment PullRequest on PullRequest {
login
}
name
- languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
+ languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
totalCount
nodes {
name
src/collect/pulls.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "pulls.graphql".
const PullRequest = `#graphql
fragment PullRequest on PullRequest {
@@ -121,8 +121,23 @@ export type PullRequest = {
totalCount: number
nodes: Array<{
name: string
- conclusion: 'ACTION_REQUIRED' | 'CANCELLED' | 'FAILURE' | 'NEUTRAL' | 'SKIPPED' | 'STALE' | 'STARTUP_FAILURE' | 'SUCCESS' | 'TIMED_OUT'
- status: 'COMPLETED' | 'IN_PROGRESS' | 'PENDING' | 'QUEUED' | 'REQUESTED' | 'WAITING'
+ conclusion:
+ | 'ACTION_REQUIRED'
+ | 'CANCELLED'
+ | 'FAILURE'
+ | 'NEUTRAL'
+ | 'SKIPPED'
+ | 'STALE'
+ | 'STARTUP_FAILURE'
+ | 'SUCCESS'
+ | 'TIMED_OUT'
+ status:
+ | 'COMPLETED'
+ | 'IN_PROGRESS'
+ | 'PENDING'
+ | 'QUEUED'
+ | 'REQUESTED'
+ | 'WAITING'
startedAt: string | null
completedAt: string | null
}> | null
@@ -135,7 +150,15 @@ export type PullRequest = {
reactions: {
totalCount: number
nodes: Array<{
- content: 'CONFUSED' | 'EYES' | 'HEART' | 'HOORAY' | 'LAUGH' | 'ROCKET' | 'THUMBS_DOWN' | 'THUMBS_UP'
+ content:
+ | 'CONFUSED'
+ | 'EYES'
+ | 'HEART'
+ | 'HOORAY'
+ | 'LAUGH'
+ | 'ROCKET'
+ | 'THUMBS_DOWN'
+ | 'THUMBS_UP'
user: {
login: string
} | null
@@ -143,7 +166,6 @@ export type PullRequest = {
}
}
-
export const PullsQuery = `#graphql
${PullRequest}
query PullsQuery($username: String!, $num: Int = 100, $cursor: String) {
@@ -167,7 +189,11 @@ query PullsQuery($username: String!, $num: Int = 100, $cursor: String) {
}
}` as string & PullsQuery
-export type PullsQuery = (vars: { username: string, num?: number | null, cursor?: string | null }) => {
+export type PullsQuery = (vars: {
+ username: string
+ num?: number | null
+ cursor?: string | null
+}) => {
user: {
pullRequests: {
totalCount: number
src/collect/stars.graphql
@@ -4,7 +4,7 @@ fragment StarredRepo on Repository {
stargazers {
totalCount
}
- languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
+ languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
totalCount
edges {
size
@@ -40,4 +40,3 @@ query StarsQuery($login: String!, $num: Int = 100, $cursor: String) {
resetAt
}
}
-
src/collect/stars.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "stars.graphql".
const StarredRepo = `#graphql
fragment StarredRepo on Repository {
@@ -43,7 +43,6 @@ export type StarredRepo = {
} | null
}
-
export const StarsQuery = `#graphql
${StarredRepo}
query StarsQuery($login: String!, $num: Int = 100, $cursor: String) {
@@ -68,7 +67,11 @@ query StarsQuery($login: String!, $num: Int = 100, $cursor: String) {
}
}` as string & StarsQuery
-export type StarsQuery = (vars: { login: string, num?: number | null, cursor?: string | null }) => {
+export type StarsQuery = (vars: {
+ login: string
+ num?: number | null
+ cursor?: string | null
+}) => {
user: {
starredRepositories: {
totalCount: number
src/collect/user.graphql
@@ -61,4 +61,3 @@ query UserQuery($login: String!) {
resetAt
}
}
-
src/collect/user.graphql.ts
@@ -1,4 +1,4 @@
-// DO NOT EDIT. This file was generated by megaera.
+// DO NOT EDIT. This is a generated file. Instead of this file, edit "user.graphql".
const User = `#graphql
fragment User on User {
@@ -79,11 +79,14 @@ export type User = {
anyPinnableItems: boolean
pinnedItems: {
totalCount: number
- nodes: Array<{} & {
- name: string
- } & {
- name: string
- } | null> | null
+ nodes: Array<
+ | ({} & {
+ name: string
+ } & {
+ name: string
+ })
+ | null
+ > | null
}
sponsoring: {
totalCount: number
@@ -102,7 +105,6 @@ export type User = {
}
}
-
export const UserQuery = `#graphql
${User}
query UserQuery($login: String!) {
@@ -118,7 +120,7 @@ query UserQuery($login: String!) {
}` as string & UserQuery
export type UserQuery = (vars: { login: string }) => {
- user: {} & User | null
+ user: ({} & User) | null
rateLimit: {
limit: number
cost: number
test/present-badges.test.ts
@@ -54,8 +54,7 @@ describe('present-badges', () => {
'* <a href="https://github.com/foo/bar">foo/bar: ★1000</a>\n' +
'\n' +
"<sup>I have push, maintainer or admin permissions, so I'm definitely an author.<sup>\n",
- image:
- 'https://github.com/my-badges/my-badges/blob/master/badges/stars/stars-100.png?raw=true',
+ image: 'https://my-badges.github.io/my-badges/stars-100.png',
},
{
id: 'stars-500',
@@ -67,8 +66,7 @@ describe('present-badges', () => {
'* <a href="https://github.com/foo/bar">foo/bar: ★1000</a>\n' +
'\n' +
"<sup>I have push, maintainer or admin permissions, so I'm definitely an author.<sup>\n",
- image:
- 'https://github.com/my-badges/my-badges/blob/master/badges/stars/stars-500.png?raw=true',
+ image: 'https://my-badges.github.io/my-badges/stars-500.png',
},
])
})
@@ -94,8 +92,7 @@ describe('present-badges', () => {
'* <a href="https://github.com/foo/bar">foo/bar: ★1000</a>\n' +
'\n' +
"<sup>I have push, maintainer or admin permissions, so I'm definitely an author.<sup>\n",
- image:
- 'https://github.com/my-badges/my-badges/blob/master/badges/stars/stars-100.png?raw=true',
+ image: 'https://my-badges.github.io/my-badges/stars-100.png',
},
])
})
@@ -121,8 +118,7 @@ describe('present-badges', () => {
'* <a href="https://github.com/foo/bar">foo/bar: ★1000</a>\n' +
'\n' +
"<sup>I have push, maintainer or admin permissions, so I'm definitely an author.<sup>\n",
- image:
- 'https://github.com/my-badges/my-badges/blob/master/badges/stars/stars-100.png?raw=true',
+ image: 'https://my-badges.github.io/my-badges/stars-100.png',
},
{
id: 'stars-500',
@@ -134,8 +130,7 @@ describe('present-badges', () => {
'* <a href="https://github.com/foo/bar">foo/bar: ★1000</a>\n' +
'\n' +
"<sup>I have push, maintainer or admin permissions, so I'm definitely an author.<sup>\n",
- image:
- 'https://github.com/my-badges/my-badges/blob/master/badges/stars/stars-500.png?raw=true',
+ image: 'https://my-badges.github.io/my-badges/stars-500.png',
},
])
})
@@ -162,8 +157,7 @@ describe('present-badges', () => {
'* <a href="https://github.com/foo/bar">foo/bar: ★1000</a>\n' +
'\n' +
"<sup>I have push, maintainer or admin permissions, so I'm definitely an author.<sup>\n",
- image:
- 'https://github.com/my-badges/my-badges/blob/master/badges/stars/stars-2000.png?raw=true',
+ image: 'https://my-badges.github.io/my-badges/stars-2000.png',
},
])
})
package-lock.json
@@ -11,7 +11,7 @@
"dependencies": {
"@octokit/plugin-retry": "^7.1.1",
"@octokit/plugin-throttling": "^9.3.0",
- "megaera": "^0.0.2",
+ "megaera": "^1.0.0",
"minimist": "^1.2.8",
"octokit": "^4.0.2"
},
@@ -1251,9 +1251,9 @@
"dev": true
},
"node_modules/megaera": {
- "version": "0.0.2",
- "resolved": "https://registry.npmjs.org/megaera/-/megaera-0.0.2.tgz",
- "integrity": "sha512-VXzm1d9Qoi+jY3H4kyi87YZojQ3fs73T/FUKo37WfJ+74nId0nOM0fREJUc3V7m2pZ3i+w7IVK9XDm2V9bE/iQ==",
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/megaera/-/megaera-1.0.0.tgz",
+ "integrity": "sha512-wGe8LOPvg83cj2S2UTcJxxk9c5BheAATm9PObGahqyyBGqcrR5y64/MaTQImbsd33g+HDhn1FCm9mUcrt0G5kw==",
"license": "MIT",
"dependencies": {
"graphql": "^16.0.0"
package.json
@@ -19,13 +19,14 @@
"build": "tsc",
"check-images": "node scripts/check-images.mjs",
"generate-gh-pages": "node scripts/generate-gh-pages.mjs",
+ "megaera": "megaera --schema .github/schema.graphql src/**/*.graphql && prettier --write src/**/*.graphql.ts",
"test": "npm run test:unit",
"test:unit": "c8 -r lcov -r text -o coverage -x scripts -x test node --loader ts-node/esm --experimental-specifier-resolution=node scripts/test.mjs"
},
"dependencies": {
"@octokit/plugin-retry": "^7.1.1",
"@octokit/plugin-throttling": "^9.3.0",
- "megaera": "^0.0.2",
+ "megaera": "^1.0.0",
"minimist": "^1.2.8",
"octokit": "^4.0.2"
},