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