Skip to content

Commit

Permalink
feat(badges): support bundlejs
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 26, 2024
1 parent 308381c commit 0ab578e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/generators/badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const badgeTypes = {
name: "bundle size",
to: "https://bundlephobia.com/package/{name}",
},
bundlejs: {
name: "bundle size",
to: "https://bundlejs.com/?q={name}",
},
packagephobia: {
name: "install size",
to: "https://packagephobia.com/result?p={name}",
Expand All @@ -39,6 +43,7 @@ const badgeProviders = <Record<string, BadgeProvider>>{
npmDownloads: "https://img.shields.io/npm/dm/{name}",
bundlephobia: "https://img.shields.io/bundlephobia/minzip/{name}",
packagephobia: false, // https://github.com/badges/shields/issues/1701
bundlejs: "https://img.shields.io/bundlejs/size/{name}",
codecov: "https://img.shields.io/codecov/c/gh/{github}",
license: "https://img.shields.io/github/license/{github}",
},
Expand All @@ -47,6 +52,7 @@ const badgeProviders = <Record<string, BadgeProvider>>{
npmVersion: "https://flat.badgen.net/npm/v/{name}",
npmDownloads: "https://flat.badgen.net/npm/dm/{name}",
bundlephobia: "https://flat.badgen.net/bundlephobia/minzip/{name}",
bundlejs: false, // https://github.com/badgen/badgen/issues/82
packagephobia: "https://flat.badgen.net/packagephobia/publish/{name}",
codecov: "https://flat.badgen.net/codecov/c/github/{github}",
license: "https://flat.badgen.net/github/license/{github}",
Expand All @@ -55,6 +61,7 @@ const badgeProviders = <Record<string, BadgeProvider>>{
npmVersion: "https://badgen.net/npm/v/{name}",
npmDownloads: "https://badgen.net/npm/dm/{name}",
bundlephobia: "https://badgen.net/bundlephobia/minzip/{name}",
bundlejs: false, // https://github.com/badgen/badgen/issues/82
packagephobia: "https://badgen.net/packagephobia/publish/{name}",
codecov: "https://badgen.net/codecov/c/github/{github}",
license: "https://badgen.net/github/license/{github}",
Expand Down Expand Up @@ -98,6 +105,10 @@ export const badges = defineGenerator({
enabled: args.bundlephobia && ctx.name,
...badgeTypes.bundlephobia,
},
bundlejs: {
enabled: args.bundlejs && ctx.name,
...badgeTypes.bundlejs,
},
packagephobia: {
enabled: args.packagephobia && ctx.name,
...badgeTypes.packagephobia,
Expand Down

0 comments on commit 0ab578e

Please sign in to comment.