Skip to content

Commit

Permalink
Merge branch 'master' into template-style
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow authored Oct 20, 2020
2 parents 9d951d9 + d60b90b commit e0cdc64
Show file tree
Hide file tree
Showing 14 changed files with 645 additions and 446 deletions.
446 changes: 281 additions & 165 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@
]
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/polyfill": "^7.11.5",
"@babel/core": "^7.12.3",
"@babel/polyfill": "^7.12.1",
"@babel/register": "7.12.1",
"@mapbox/react-click-to-select": "^2.2.0",
"@types/chai": "^4.2.12",
Expand Down Expand Up @@ -197,7 +197,7 @@
"gatsby-plugin-react-helmet": "^3.3.9",
"gatsby-plugin-remove-trailing-slashes": "^2.3.10",
"gatsby-plugin-styled-components": "^3.3.9",
"gatsby-plugin-typescript": "^2.4.16",
"gatsby-plugin-typescript": "^2.4.22",
"got": "11.7.0",
"humanize-string": "^2.1.0",
"husky": "^4.3.0",
Expand Down
44 changes: 18 additions & 26 deletions services/github/github-search.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,29 @@ const { errorMessagesFor, documentation } = require('./github-helpers')
const schema = Joi.object({ total_count: nonNegativeInteger }).required()

module.exports = class GithubSearch extends GithubAuthV3Service {
static get category() {
return 'analysis'
}
static category = 'analysis'

static get route() {
return {
base: 'github/search',
pattern: ':user/:repo/:query+',
}
static route = {
base: 'github/search',
pattern: ':user/:repo/:query+',
}

static get examples() {
return [
{
title: 'GitHub search hit counter',
pattern: ':user/:repo/:query',
namedParams: {
user: 'torvalds',
repo: 'linux',
query: 'goto',
},
staticPreview: this.render({ query: 'goto', totalCount: 14000 }),
documentation,
static examples = [
{
title: 'GitHub search hit counter',
pattern: ':user/:repo/:query',
namedParams: {
user: 'torvalds',
repo: 'linux',
query: 'goto',
},
]
}
staticPreview: this.render({ query: 'goto', totalCount: 14000 }),
documentation,
},
]

static get defaultBadgeData() {
return {
label: 'counter',
}
static defaultBadgeData = {
label: 'counter',
}

static render({ query, totalCount }) {
Expand Down
38 changes: 16 additions & 22 deletions services/github/github-size.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,26 @@ const schema = Joi.alternatives(
)

module.exports = class GithubSize extends GithubAuthV3Service {
static get category() {
return 'size'
}
static category = 'size'

static get route() {
return {
base: 'github/size',
pattern: ':user/:repo/:path*',
}
static route = {
base: 'github/size',
pattern: ':user/:repo/:path*',
}

static get examples() {
return [
{
title: 'GitHub file size in bytes',
namedParams: {
user: 'webcaetano',
repo: 'craft',
path: 'build/phaser-craft.min.js',
},
staticPreview: this.render({ size: 9170 }),
keywords: ['repo'],
documentation,
static examples = [
{
title: 'GitHub file size in bytes',
namedParams: {
user: 'webcaetano',
repo: 'craft',
path: 'build/phaser-craft.min.js',
},
]
}
staticPreview: this.render({ size: 9170 }),
keywords: ['repo'],
documentation,
},
]

static render({ size }) {
return {
Expand Down
56 changes: 24 additions & 32 deletions services/github/github-stars.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,35 @@ const schema = Joi.object({
}).required()

module.exports = class GithubStars extends GithubAuthV3Service {
static get category() {
return 'social'
}
static category = 'social'

static get route() {
return {
base: 'github/stars',
pattern: ':user/:repo',
}
static route = {
base: 'github/stars',
pattern: ':user/:repo',
}

static get examples() {
return [
{
title: 'GitHub Repo stars',
namedParams: {
user: 'badges',
repo: 'shields',
},
queryParams: { style: 'social' },
// TODO: This is currently a literal, as `staticPreview` doesn't
// support `link`.
staticPreview: {
label: 'Stars',
message: '7k',
style: 'social',
},
documentation,
static examples = [
{
title: 'GitHub Repo stars',
namedParams: {
user: 'badges',
repo: 'shields',
},
]
}
queryParams: { style: 'social' },
// TODO: This is currently a literal, as `staticPreview` doesn't
// support `link`.
staticPreview: {
label: 'Stars',
message: '7k',
style: 'social',
},
documentation,
},
]

static get defaultBadgeData() {
return {
label: 'stars',
namedLogo: 'github',
}
static defaultBadgeData = {
label: 'stars',
namedLogo: 'github',
}

static render({ stars, user, repo }) {
Expand Down
76 changes: 35 additions & 41 deletions services/github/github-tag.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,45 @@ const schema = Joi.object({
}).required()

class GithubTag extends GithubAuthV4Service {
static get category() {
return 'version'
}
static category = 'version'

static get route() {
return {
base: 'github/v/tag',
pattern: ':user/:repo',
queryParamSchema,
}
static route = {
base: 'github/v/tag',
pattern: ':user/:repo',
queryParamSchema,
}

static get examples() {
return [
{
title: 'GitHub tag (latest by date)',
namedParams: { user: 'expressjs', repo: 'express' },
staticPreview: this.render({
version: 'v5.0.0-alpha.7',
sort: 'date',
}),
documentation,
},
{
title: 'GitHub tag (latest SemVer)',
namedParams: { user: 'expressjs', repo: 'express' },
queryParams: { sort: 'semver' },
staticPreview: this.render({ version: 'v4.16.4', sort: 'semver' }),
documentation,
},
{
title: 'GitHub tag (latest SemVer pre-release)',
namedParams: { user: 'expressjs', repo: 'express' },
queryParams: { sort: 'semver', include_prereleases: null },
staticPreview: this.render({
version: 'v5.0.0-alpha.7',
sort: 'semver',
}),
documentation,
},
]
}
static examples = [
{
title: 'GitHub tag (latest by date)',
namedParams: { user: 'expressjs', repo: 'express' },
staticPreview: this.render({
version: 'v5.0.0-alpha.7',
sort: 'date',
}),
documentation,
},
{
title: 'GitHub tag (latest SemVer)',
namedParams: { user: 'expressjs', repo: 'express' },
queryParams: { sort: 'semver' },
staticPreview: this.render({ version: 'v4.16.4', sort: 'semver' }),
documentation,
},
{
title: 'GitHub tag (latest SemVer pre-release)',
namedParams: { user: 'expressjs', repo: 'express' },
queryParams: { sort: 'semver', include_prereleases: null },
staticPreview: this.render({
version: 'v5.0.0-alpha.7',
sort: 'semver',
}),
documentation,
},
]

static get defaultBadgeData() {
return { label: 'tag' }
static defaultBadgeData = {
label: 'tag',
}

static render({ version, sort }) {
Expand Down
48 changes: 20 additions & 28 deletions services/github/github-top-language.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,31 @@ const { BaseGithubLanguage } = require('./github-languages-base')
const { documentation } = require('./github-helpers')

module.exports = class GithubTopLanguage extends BaseGithubLanguage {
static get category() {
return 'analysis'
}
static category = 'analysis'

static get route() {
return {
base: 'github/languages/top',
pattern: ':user/:repo',
}
static route = {
base: 'github/languages/top',
pattern: ':user/:repo',
}

static get examples() {
return [
{
title: 'GitHub top language',
namedParams: {
user: 'badges',
repo: 'shields',
},
staticPreview: this.render({
language: 'javascript',
languageSize: 99.5,
totalSize: 100,
}),
documentation,
static examples = [
{
title: 'GitHub top language',
namedParams: {
user: 'badges',
repo: 'shields',
},
]
}
staticPreview: this.render({
language: 'javascript',
languageSize: 99.5,
totalSize: 100,
}),
documentation,
},
]

static get defaultBadgeData() {
return {
label: 'language',
}
static defaultBadgeData = {
label: 'language',
}

static render({ language, languageSize, totalSize }) {
Expand Down
Loading

0 comments on commit e0cdc64

Please sign in to comment.