Skip to content

Commit

Permalink
Merge branch 'master' into 8921-postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s authored Feb 23, 2023
2 parents 66267b4 + ec8d739 commit dbf5c67
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LABEL fly.version=$version
ENV NODE_ENV production

WORKDIR /usr/src/app
COPY --from=Builder /usr/src/app /usr/src/app
COPY --from=Builder --chown=0:0 /usr/src/app /usr/src/app

CMD node server

Expand Down
1 change: 0 additions & 1 deletion frontend/components/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default function Search({
<form action="javascript:void 0" autoComplete="off">
<BlockInput
autoComplete="off"
autoFocus
onChange={onQueryChanged}
placeholder="search"
/>
Expand Down
49 changes: 49 additions & 0 deletions services/vcpkg/vcpkg-version.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Joi from 'joi'
import { ConditionalGithubAuthV3Service } from '../github/github-auth-service.js'
import { fetchJsonFromRepo } from '../github/github-common-fetch.js'
import { renderVersionBadge } from '../version.js'
import { NotFound } from '../index.js'

const vcpkgManifestSchema = Joi.object({
version: Joi.string().required(),
}).required()

export default class VcpkgVersion extends ConditionalGithubAuthV3Service {
static category = 'version'

static route = { base: 'vcpkg/v', pattern: ':portName' }

static examples = [
{
title: 'Vcpkg',
namedParams: { portName: 'entt' },
staticPreview: this.render({ version: '3.11.1' }),
},
]

static defaultBadgeData = { label: 'vcpkg' }

static render({ version }) {
return renderVersionBadge({ version })
}

async handle({ portName }) {
try {
const { version } = await fetchJsonFromRepo(this, {
schema: vcpkgManifestSchema,
user: 'microsoft',
repo: 'vcpkg',
branch: 'master',
filename: `ports/${portName}/vcpkg.json`,
})
return this.constructor.render({ version })
} catch (error) {
if (error instanceof NotFound) {
throw new NotFound({
prettyMessage: 'port not found',
})
}
throw error
}
}
}
16 changes: 16 additions & 0 deletions services/vcpkg/vcpkg-version.tester.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { isSemver } from '../test-validators.js'
import { createServiceTester } from '../tester.js'

export const t = await createServiceTester()

t.create('gets the port version of entt')
.get('/entt.json')
.expectBadge({ label: 'vcpkg', message: isSemver })

t.create('returns not found for invalid port')
.get('/this-port-does-not-exist.json')
.expectBadge({
label: 'vcpkg',
color: 'red',
message: 'port not found',
})

0 comments on commit dbf5c67

Please sign in to comment.