badgen.net/next.config.js

104 wiersze
2.6 KiB
JavaScript
Czysty Zwykły widok Historia

2022-12-31 06:29:41 +00:00
/** @type {import('next').NextConfig} */
const { withSentryConfig } = require('@sentry/nextjs')
const badgeList = require('./public/.meta/badges.json')
2022-12-31 06:29:41 +00:00
const nextConfig = {
reactStrictMode: true,
2023-01-04 01:31:10 +00:00
optimizeFonts: false,
2022-12-31 06:29:41 +00:00
experimental: {
2023-01-04 01:31:10 +00:00
appDir: false,
2022-12-31 06:29:41 +00:00
forceSwcTransforms: true,
},
sentry: {
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
// for client-side builds. (This will be the default starting in
// `@sentry/nextjs` version 8.0.0.) See
// https://webpack.js.org/configuration/devtool/ and
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
// for more information.
hideSourceMaps: true,
},
async rewrites() {
const liveBadgeRedirects = badgeList.live.map(badge => {
return {
source: `/${badge.id}/:path*`,
destination: `/api/${badge.id}/:path*`,
}
})
const staticBadgeRedirects = [{
source: `/badge/:path*`,
destination: `/api/badge/:path*`,
}]
const badgeRedirects = [
{ source: '/badge/:path*', destination: '/api/static' },
2023-02-05 11:20:03 +00:00
{ source: '/badge', destination: '/api/static' },
]
2023-02-05 11:20:03 +00:00
const badgeApis = [
'/static',
2023-03-18 02:53:04 +00:00
'/github',
2023-07-25 15:24:30 +00:00
'/gitlab',
2023-07-26 12:17:48 +00:00
'/https',
2023-07-02 11:57:22 +00:00
// registry
2023-07-02 00:01:52 +00:00
'/amo',
2023-06-10 01:25:28 +00:00
'/npm',
2023-06-28 08:40:09 +00:00
'/crates',
2023-07-02 11:57:22 +00:00
'/winget',
2023-07-28 14:35:25 +00:00
'/docker',
'/chrome-web-store',
2023-07-02 00:15:06 +00:00
'/vs-marketplace',
'/hackage',
'/ppm',
2023-06-10 02:37:06 +00:00
'/pypi',
2023-07-02 11:57:22 +00:00
// analysis
'/bundlephobia',
'/packagephobia',
'/codeclimate',
'/codecov',
'/travis',
'/xo',
2023-07-02 11:57:22 +00:00
// social network
'/discord',
'/matrix',
'/runkit',
2023-07-09 09:52:24 +00:00
'/peertube',
2023-06-10 07:27:32 +00:00
// discontinued
'/apm',
2023-06-19 07:51:39 +00:00
'/lgtm',
2023-06-22 06:57:25 +00:00
'/david',
]
badgeApis.forEach(badge => {
badgeRedirects.push({ source: `${badge}/:path*`, destination: `/api${badge}` }) // badges
badgeRedirects.push({ source: badge, destination: `/api${badge}` }) // doc pages
})
// const badgeRedirects = liveBadgeRedirects.concat(staticBadgeRedirects)
return badgeRedirects
},
2019-05-26 04:41:21 +00:00
}
2022-12-31 06:29:41 +00:00
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs
dryRun: process.env.VERCEL_ENV !== "production"
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
}
module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions)