chore: update vercel static path to public
|
@ -1,7 +1,6 @@
|
|||
dist
|
||||
yarn.lock
|
||||
node_modules
|
||||
public
|
||||
.vercel
|
||||
.firebase
|
||||
.next
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
dist
|
||||
test
|
||||
.next
|
||||
public
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import badgeList from '../static/.meta/badges.json'
|
||||
import badgeList from '../public/.meta/badges.json'
|
||||
|
||||
const examples = [...badgeList.live, ...badgeList.static].reduce((accu, curr) => {
|
||||
return (accu as any).concat(Object.entries(curr.examples))
|
||||
|
|
|
@ -1,10 +1,31 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
|
||||
const badgeList = require('./public/.meta/badges.json')
|
||||
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
|
||||
experimental: {
|
||||
appDir: true,
|
||||
forceSwcTransforms: 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 = liveBadgeRedirects.concat(staticBadgeRedirects)
|
||||
|
||||
return badgeRedirects
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = nextConfig
|
||||
|
|
|
@ -4,7 +4,7 @@ import BadgenTitle from '../components/badgen-title'
|
|||
// import TopBar from '../components/top-bar'
|
||||
import Intro from '../components/home-intro'
|
||||
import Footer from '../components/footer'
|
||||
import examples from '../static/.meta/badges.json'
|
||||
import examples from '../public/.meta/badges.json'
|
||||
|
||||
const Index = () => {
|
||||
const [tab, setTab] = useState('live')
|
||||
|
|
|
@ -26,7 +26,7 @@ import { useState, useEffect } from 'react'
|
|||
import BadgenTitle from '../components/badgen-title'
|
||||
import Intro from '../components/home-intro'
|
||||
import Footer from '../components/footer'
|
||||
import examples from '../static/.meta/badges.json'
|
||||
import examples from '../public/.meta/badges.json'
|
||||
|
||||
export default function Index () {
|
||||
const [tab, setTab] = useState('live')
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 445 B Po Szerokość: | Wysokość: | Rozmiar: 445 B |
Przed Szerokość: | Wysokość: | Rozmiar: 445 B Po Szerokość: | Wysokość: | Rozmiar: 445 B |
Przed Szerokość: | Wysokość: | Rozmiar: 457 B Po Szerokość: | Wysokość: | Rozmiar: 457 B |
Przed Szerokość: | Wysokość: | Rozmiar: 1.7 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.7 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 1.5 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.5 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 1.6 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.6 KiB |
|
@ -4,11 +4,11 @@ import { loadBadgeMeta } from '../libs/badge-list'
|
|||
|
||||
const rel = (...args) => path.resolve(__dirname, ...args)
|
||||
|
||||
async function main () {
|
||||
;(async function main () {
|
||||
const badgeMeta = await loadBadgeMeta()
|
||||
await fse.outputJson(rel('../static/.meta/badges.json'), badgeMeta)
|
||||
}
|
||||
|
||||
main()
|
||||
await fse.outputJson(rel('../public/.meta/badges.json'), badgeMeta, {
|
||||
spaces: 2
|
||||
})
|
||||
})()
|
||||
|
||||
process.on('unhandledRejection', console.error)
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
"version": 2,
|
||||
"regions": ["all"],
|
||||
"routes": [
|
||||
{ "src": "/docs/(.*)", "status": 301, "headers": { "Location": "/$1" } },
|
||||
{ "src": "/(?<name>[^/]+).*", "dest": "/api/$name.ts" }
|
||||
{ "src": "/docs/(.*)", "status": 301, "headers": { "Location": "/$1" } }
|
||||
],
|
||||
"env": {
|
||||
"GH_TOKENS": "@badgen-gh-tokens",
|
||||
|
|