Skip to content

Commit

Permalink
feat: migrate /crates
Browse files Browse the repository at this point in the history
  • Loading branch information
amio committed Jun 28, 2023
1 parent 4b969c1 commit a4dbc2d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion libs/badge-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const liveBadgeList = [
// 'github',
'gitlab',
// release registries
'crates',
'docker',
'homebrew',
'amo',
Expand Down
2 changes: 2 additions & 0 deletions libs/badge-list2.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import staticBadge from '../pages/api/static'
import github from '../pages/api/github'
import npm from '../pages/api/npm'
import crates from '../pages/api/crates'
import bundlephobia from '../pages/api/bundlephobia'
import packagephobia from '../pages/api/packagephobia'
import codeclimate from '../pages/api/codeclimate'
Expand All @@ -16,6 +17,7 @@ export default {
static: staticBadge.meta,
github: github.meta,
npm: npm.meta,
crates: crates.meta,
bundlephobia: bundlephobia.meta,
packagephobia: packagephobia.meta,
codeclimate: codeclimate.meta,
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const nextConfig = {
'/static',
'/github',
'/npm',
'/crates',
'/bundlephobia',
'/packagephobia',
'/codeclimate',
Expand Down
12 changes: 9 additions & 3 deletions api-/crates.ts → pages/api/crates.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import got from '../libs/got'
import { millify, version, versionColor } from '../libs/utils'
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
import got from '../../libs/got'
import { millify, version, versionColor } from '../../libs/utils'
import { createBadgenHandler, PathArgs } from '../../libs/create-badgen-handler-next'

export default createBadgenHandler({
title: 'Rust Crates',
Expand Down Expand Up @@ -37,5 +37,11 @@ async function handler ({topic, pkg}: PathArgs) {
status: millify(crate.recent_downloads) + ' latest version',
color: 'green'
}
default:
return {
subject: 'crates.io',
status: 'unknown topic',
color: 'grey'
}
}
}
4 changes: 0 additions & 4 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
"source": "/cran/:match*",
"destination": "https://v2022.badgen.net/cran/:match*"
},
{
"source": "/crates/:match*",
"destination": "https://v2022.badgen.net/crates/:match*"
},
{
"source": "/ctan/:match*",
"destination": "https://v2022.badgen.net/ctan/:match*"
Expand Down

1 comment on commit a4dbc2d

@vercel
Copy link

@vercel vercel bot commented on a4dbc2d Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.