2023-06-04 16:59:38 +02:00
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import { defineConfig } from 'vitepress'
|
2023-06-07 08:25:46 +02:00
|
|
|
import { createWriteStream } from 'node:fs'
|
|
|
|
|
import { resolve } from 'node:path'
|
|
|
|
|
import { SitemapStream } from 'sitemap'
|
2023-06-04 16:59:38 +02:00
|
|
|
import sidebar from './sidebar';
|
2023-06-15 14:44:43 +02:00
|
|
|
import fs from 'fs';
|
2023-06-04 16:59:38 +02:00
|
|
|
|
2023-06-07 08:25:46 +02:00
|
|
|
const links = []
|
|
|
|
|
|
|
|
|
|
|
2023-06-07 08:38:21 +02:00
|
|
|
const title = "Lucide";
|
|
|
|
|
const socialTitle = "Lucide Icons";
|
2023-06-07 08:25:46 +02:00
|
|
|
const description = "Beautiful & consistent icon toolkit made by the community."
|
|
|
|
|
|
2023-06-04 16:59:38 +02:00
|
|
|
// https://vitepress.dev/reference/site-config
|
|
|
|
|
export default defineConfig({
|
2023-06-07 08:25:46 +02:00
|
|
|
title,
|
|
|
|
|
description,
|
2023-06-04 16:59:38 +02:00
|
|
|
cleanUrls: true,
|
|
|
|
|
outDir: '.vercel/output/static',
|
|
|
|
|
vite: {
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: [
|
|
|
|
|
{
|
|
|
|
|
find: /^.*\/VPIconAlignLeft\.vue$/,
|
|
|
|
|
replacement: fileURLToPath(
|
|
|
|
|
new URL('./theme/components/overrides/VPIconAlignLeft.vue', import.meta.url)
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
find: /^.*\/VPFooter\.vue$/,
|
|
|
|
|
replacement: fileURLToPath(
|
|
|
|
|
new URL('./theme/components/overrides/VPFooter.vue', import.meta.url)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
]
|
2023-06-15 14:44:43 +02:00
|
|
|
},
|
2023-06-04 16:59:38 +02:00
|
|
|
},
|
|
|
|
|
head: [
|
2023-06-07 08:25:46 +02:00
|
|
|
[ 'script', {
|
2023-07-31 21:21:43 +02:00
|
|
|
src: 'https://analytics.lucide.dev/js/script.js',
|
2023-06-07 08:25:46 +02:00
|
|
|
'data-domain': 'lucide.dev',
|
|
|
|
|
defer: ''
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:locale",
|
|
|
|
|
content:"en_US"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:type",
|
|
|
|
|
content:"website"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:site_name",
|
|
|
|
|
content: title,
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:title",
|
2023-06-07 08:38:21 +02:00
|
|
|
content: socialTitle,
|
2023-06-07 08:25:46 +02:00
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:description",
|
|
|
|
|
content: description
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:url",
|
|
|
|
|
content:"https://lucide.dev"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:image",
|
|
|
|
|
content: "https://lucide.dev/og.png"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:image:width",
|
|
|
|
|
content:"1200"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:image:height",
|
|
|
|
|
content:"630"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"og:image:type",
|
|
|
|
|
content:"image/png"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"twitter:card",
|
|
|
|
|
content:"summary_large_image"
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"twitter:title",
|
2023-06-07 08:38:21 +02:00
|
|
|
content: socialTitle,
|
2023-06-07 08:25:46 +02:00
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"twitter:description",
|
|
|
|
|
content: description
|
|
|
|
|
}],
|
|
|
|
|
[ 'meta', {
|
|
|
|
|
property:"twitter:image",
|
|
|
|
|
content:"https://lucide.dev/og.png"
|
|
|
|
|
}],
|
2023-06-04 16:59:38 +02:00
|
|
|
],
|
|
|
|
|
themeConfig: {
|
|
|
|
|
// https://vitepress.dev/reference/default-theme-config
|
|
|
|
|
logo: {
|
|
|
|
|
light: '/logo.light.svg',
|
|
|
|
|
dark: '/logo.dark.svg'
|
|
|
|
|
},
|
|
|
|
|
nav: [
|
2023-06-07 08:25:46 +02:00
|
|
|
{ text: 'Icons', link: '/icons/' },
|
2023-06-04 16:59:38 +02:00
|
|
|
{ text: 'Guide', link: '/guide/' },
|
|
|
|
|
{ text: 'Packages', link: '/packages' },
|
|
|
|
|
{ text: 'License', link: '/license' },
|
|
|
|
|
],
|
|
|
|
|
sidebar,
|
|
|
|
|
socialLinks: [
|
|
|
|
|
{ icon: 'github', link: 'https://github.com/lucide-icons/lucide' },
|
|
|
|
|
{ icon: 'discord', link: 'https://discord.gg/EH6nSts' }
|
|
|
|
|
],
|
|
|
|
|
footer: {
|
|
|
|
|
message: 'Released under the ISC License.',
|
|
|
|
|
copyright: `Copyright © ${new Date().getFullYear()} Lucide Contributors`
|
|
|
|
|
},
|
|
|
|
|
editLink: {
|
|
|
|
|
pattern: 'https://github.com/lucide-icons/lucide/edit/main/docs/:path'
|
|
|
|
|
},
|
2023-06-07 08:25:46 +02:00
|
|
|
},
|
|
|
|
|
transformHtml: (_, id, { pageData }) => {
|
|
|
|
|
if (/[\\/]404\.html$/.test(id)) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pageData.relativePath.startsWith('icons/')) {
|
|
|
|
|
links.push({
|
|
|
|
|
url: pageData.relativePath.replace(/((^|\/)index)?\.md$/, '$2'),
|
|
|
|
|
lastmod: pageData?.params?.changedRelease?.date
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
links.push({
|
|
|
|
|
url: pageData.relativePath.replace(/((^|\/)index)?\.md$/, '$2'),
|
|
|
|
|
lastmod: pageData.lastUpdated
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
buildEnd: async ({ outDir }) => {
|
|
|
|
|
const sitemap = new SitemapStream({
|
|
|
|
|
hostname: 'https://lucide.dev/'
|
|
|
|
|
})
|
|
|
|
|
const writeStream = createWriteStream(resolve(outDir, 'sitemap.xml'))
|
|
|
|
|
sitemap.pipe(writeStream)
|
|
|
|
|
links.forEach((link) => sitemap.write(link))
|
|
|
|
|
sitemap.end()
|
|
|
|
|
await new Promise((r) => writeStream.on('finish', r))
|
|
|
|
|
},
|
2023-06-04 16:59:38 +02:00
|
|
|
})
|