diff --git a/docs/.vitepress/components.d.ts b/docs/.vitepress/components.d.ts new file mode 100644 index 0000000..43ae3b7 --- /dev/null +++ b/docs/.vitepress/components.d.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +/* prettier-ignore */ +declare module 'vue' { + export interface GlobalComponents { + Home: typeof import('./theme/components/Home.vue')['default'] + HomeContributors: typeof import('./theme/components/HomeContributors.vue')['default'] + HomeSponsors: typeof import('./theme/components/HomeSponsors.vue')['default'] + HomeTeam: typeof import('./theme/components/HomeTeam.vue')['default'] + TeamMember: typeof import('./theme/components/TeamMember.vue')['default'] + } +} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 239cfd8..c08c95f 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,32 +1,134 @@ +import type { HeadConfig } from 'vitepress' +import { transformerTwoslash } from '@shikijs/vitepress-twoslash' +import { withPwa } from '@vite-pwa/vitepress' import { defineConfig } from 'vitepress' +import viteConfig from './vite.config' + // https://vitepress.dev/reference/site-config -export default defineConfig({ - title: 'bunfig', - description: 'A smart config leader for Bun projects.', - cleanUrls: true, - - themeConfig: { - // https://vitepress.dev/reference/default-theme-config - nav: [ - { text: 'Docs', link: '/intro' }, - { text: 'Changelog', link: 'https://github.com/stacksjs/bunfig/releases' }, - ], - sidebar: [ +const analyticsHead: HeadConfig[] = [ + [ + 'script', + { + 'src': 'https://cdn.usefathom.com/script.js', + 'data-site': 'JWZWSUOY', + 'defer': '', + }, + ], +] + +const nav = [ + { + text: 'Changelog', + link: 'https://github.com/stacksjs/bunfig/blob/main/CHANGELOG.md', + }, + // { text: 'Blog', link: 'https://updates.ow3.org' }, + { + text: 'Resources', + items: [ + { text: 'Team', link: '/team' }, + { text: 'Sponsors', link: '/sponsors' }, + { text: 'Partners', link: '/partners' }, + { text: 'Postcardware', link: '/postcardware' }, { - text: 'Get Started', items: [ - { text: 'Introduction', link: '/intro' }, - { text: 'Install', link: '/install' }, + { + text: 'Awesome Stacks', + link: 'https://github.com/stacksjs/awesome-stacks', + }, + { + text: 'Contributing', + link: 'https://github.com/stacksjs/stacks/blob/main/.github/CONTRIBUTING.md', + }, ], }, ], + }, +] - socialLinks: [ - { icon: 'github', link: 'https://github.com/stacksjs/bunfig' }, - { icon: 'bluesky', link: 'https://bsky.app/profile/chrisbreuer.dev' }, - { icon: 'twitter', link: 'https://twitter.com/stacksjs' }, +const sidebar = [ + { + text: 'Get Started', + items: [ + { text: 'Introduction', link: '/intro' }, + { text: 'Install', link: '/install' }, + { text: 'Usage', link: '/usage' }, ], }, -}) +] + +export default withPwa( + defineConfig({ + lang: 'en-US', + title: 'bunfig', + description: 'A smart config leader for Bun projects.', + lastUpdated: true, + cleanUrls: true, + metaChunk: true, + + head: [ + ['link', { rel: 'icon', type: 'image/svg+xml', href: './images/logo-mini.svg' }], + ['link', { rel: 'icon', type: 'image/png', href: './images/logo.png' }], + ['meta', { name: 'theme-color', content: '#0A0ABC' }], + ['meta', { property: 'og:type', content: 'website' }], + ['meta', { property: 'og:locale', content: 'en' }], + ['meta', { property: 'og:title', content: 'bunfig | A smart config leader for Bun projects.' }], + ['meta', { property: 'og:site_name', content: 'bunfig' }], + ['meta', { property: 'og:image', content: './images/og-image.jpg' }], + ['meta', { property: 'og:url', content: 'https://bunfig.netlify.app/' }], + // ['script', { 'src': 'https://cdn.usefathom.com/script.js', 'data-site': '', 'data-spa': 'auto', 'defer': '' }], + ...analyticsHead, + ], + + themeConfig: { + logo: './images/logo-transparent.svg', + + nav, + sidebar, + + editLink: { + pattern: 'https://github.com/stacksjs/stacks/edit/main/docs/docs/:path', + text: 'Edit this page on GitHub', + }, + + footer: { + message: 'Released under the MIT License.', + copyright: 'Copyright © 2024-present Stacks.js, Inc.', + }, + + socialLinks: [ + { icon: 'twitter', link: 'https://twitter.com/stacksjs' }, + { icon: 'bluesky', link: 'https://bsky.app/profile/chrisbreuer.dev' }, + { icon: 'github', link: 'https://github.com/stacksjs/bunfig' }, + { icon: 'discord', link: 'https://discord.gg/stacksjs' }, + ], + + // algolia: services.algolia, + + // carbonAds: { + // code: '', + // placement: '', + // }, + }, + + pwa: { + manifest: { + theme_color: '#0A0ABC', + }, + }, + + markdown: { + theme: { + light: 'vitesse-light', + dark: 'vitesse-dark', + }, + + codeTransformers: [ + transformerTwoslash(), + ], + }, + + vite: viteConfig, + }), +) diff --git a/docs/.vitepress/sw.ts b/docs/.vitepress/sw.ts new file mode 100644 index 0000000..17ad045 --- /dev/null +++ b/docs/.vitepress/sw.ts @@ -0,0 +1,123 @@ +/// + +/// + +import { CacheableResponsePlugin } from 'workbox-cacheable-response' +import { ExpirationPlugin } from 'workbox-expiration' +import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching' +import { NavigationRoute, registerRoute } from 'workbox-routing' +import { NetworkFirst, NetworkOnly, StaleWhileRevalidate } from 'workbox-strategies' + +declare let self: ServiceWorkerGlobalScope + +const entries = self.__WB_MANIFEST + +// self.__WB_MANIFEST is the default injection point +precacheAndRoute(entries) + +// clean old assets +cleanupOutdatedCaches() + +let allowlist: undefined | RegExp[] +if (import.meta.env.DEV) + allowlist = [/^\/$/] + +if (import.meta.env.PROD) { + const swPath = self.location.pathname.lastIndexOf('/') + const base = swPath === 0 ? '/' : self.location.pathname.slice(0, swPath + 1) + function escapeStringRegexp(value: string) { + // Escape characters with special meaning either inside or outside character sets. + // Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. + return value + .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') + .replace(/-/g, '\\x2d') + } + allowlist = entries.filter((page) => { + return typeof page === 'string' + ? page.endsWith('.html') + : page.url.endsWith('.html') + }).map((page) => { + const url = typeof page === 'string' ? page : page.url + const regex = url === 'index.html' + ? escapeStringRegexp(base) + : escapeStringRegexp(`${base}${url.replace(/\.html$/, '')}`) + return new RegExp(`^${regex}(\\.html)?$`) + }) + registerRoute( + ({ request, sameOrigin }) => { + return sameOrigin && request.mode === 'navigate' + }, + new NetworkOnly({ + plugins: [{ + /* this callback will be called when the fetch call fails */ + handlerDidError: async () => Response.redirect('404', 302), + /* this callback will prevent caching the response */ + cacheWillUpdate: async () => null, + }], + }), + 'GET', + ) + // googleapis + registerRoute( + /^https:\/\/fonts\.googleapis\.com\/.*/i, + new NetworkFirst({ + cacheName: 'google-fonts-cache', + plugins: [ + new CacheableResponsePlugin({ statuses: [0, 200] }), + // we only need a few entries + new ExpirationPlugin({ + maxEntries: 10, + maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days + }), + ], + }), + ) + // gstatic + registerRoute( + /^https:\/\/fonts\.gstatic\.com\/.*/i, + new StaleWhileRevalidate({ + cacheName: 'google-fonts-cache', + plugins: [ + new CacheableResponsePlugin({ statuses: [0, 200] }), + // we only need a few entries + new ExpirationPlugin({ + maxEntries: 10, + maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days + }), + ], + }), + ) + // antfu sponsors + registerRoute( + /^https:\/\/cdn\.jsdelivr\.net\/.*/i, + new NetworkFirst({ + cacheName: 'jsdelivr-images-cache', + plugins: [ + new CacheableResponsePlugin({ statuses: [0, 200] }), + // we only need a few entries + new ExpirationPlugin({ + maxEntries: 10, + maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days + }), + ], + }), + ) +} + +// to allow work offline +registerRoute(new NavigationRoute( + createHandlerBoundToURL('index.html'), + { allowlist }, +)) + +// Skip-Waiting Service Worker-based solution +self.addEventListener('activate', async () => { + // after we've taken over, iterate over all the current clients (windows) + const clients = await self.clients.matchAll({ type: 'window' }) + clients.forEach((client) => { + // ...and refresh each one of them + client.navigate(client.url) + }) +}) + +self.skipWaiting() diff --git a/docs/.vitepress/theme/components/Home.vue b/docs/.vitepress/theme/components/Home.vue new file mode 100644 index 0000000..6dfb775 --- /dev/null +++ b/docs/.vitepress/theme/components/Home.vue @@ -0,0 +1,9 @@ + diff --git a/docs/.vitepress/theme/components/HomeContributors.vue b/docs/.vitepress/theme/components/HomeContributors.vue new file mode 100644 index 0000000..662cf1a --- /dev/null +++ b/docs/.vitepress/theme/components/HomeContributors.vue @@ -0,0 +1,20 @@ + + + diff --git a/docs/.vitepress/theme/components/HomeSponsors.vue b/docs/.vitepress/theme/components/HomeSponsors.vue new file mode 100644 index 0000000..c24bef7 --- /dev/null +++ b/docs/.vitepress/theme/components/HomeSponsors.vue @@ -0,0 +1,19 @@ + diff --git a/docs/.vitepress/theme/components/HomeTeam.vue b/docs/.vitepress/theme/components/HomeTeam.vue new file mode 100644 index 0000000..d8030d4 --- /dev/null +++ b/docs/.vitepress/theme/components/HomeTeam.vue @@ -0,0 +1,20 @@ + + + diff --git a/docs/.vitepress/theme/components/TeamMember.vue b/docs/.vitepress/theme/components/TeamMember.vue new file mode 100644 index 0000000..b7b75aa --- /dev/null +++ b/docs/.vitepress/theme/components/TeamMember.vue @@ -0,0 +1,42 @@ + + + diff --git a/docs/.vitepress/theme/components/contributors.json b/docs/.vitepress/theme/components/contributors.json new file mode 100644 index 0000000..02777bf --- /dev/null +++ b/docs/.vitepress/theme/components/contributors.json @@ -0,0 +1,6 @@ +{ + "chrisbbreuer": true, + "glennmichael123": false, + "cab-mikee": true, + "konkonam": false +} diff --git a/docs/.vitepress/theme/components/contributors.ts b/docs/.vitepress/theme/components/contributors.ts new file mode 100644 index 0000000..9ae22d9 --- /dev/null +++ b/docs/.vitepress/theme/components/contributors.ts @@ -0,0 +1,85 @@ +import contributors from './contributors.json' + +export interface Contributor { + name: string + avatar: string +} + +export interface CoreTeam { + avatar: string + name: string + github: string + twitter?: string + bluesky?: string + sponsors?: boolean + description: string + packages?: string[] + functions?: string[] +} + +const contributorsAvatars: Record = {} + +function getAvatarUrl(name: string) { + return `https://avatars.githubusercontent.com/${name}?v=4` +} + +const contributorList = (Object.keys(contributors) as string[]).reduce((acc, name) => { + contributorsAvatars[name] = getAvatarUrl(name) + + if (contributors[name]) { + acc.push({ name, avatar: contributorsAvatars[name] }) + } + + return acc +}, [] as Contributor[]) + +const coreTeamMembers: CoreTeam[] = [ + { + avatar: contributorsAvatars.chrisbbreuer || 'default-avatar.png', + name: 'Chris Breuer', + github: 'chrisbbreuer', + twitter: 'chrisbbreuer', + bluesky: 'chrisbreuer.dev', + sponsors: true, + description: 'Open sourceror.
Core Stacks team.
Working at Stacks.js', + packages: ['core'], + functions: ['cloud', 'backend', 'frontend', 'ci/cd'], + }, + { + avatar: contributorsAvatars.glennmichael123 || 'default-avatar.png', + name: 'Glenn', + github: 'glennmichael123', + twitter: 'glennmichael123', + sponsors: false, + packages: ['core'], + functions: ['backend', 'frontend', 'desktop'], + description: 'Open sourceror.
Core Stacks team.
Working at Stacks.js', + }, + + { + avatar: contributorsAvatars['cab-mikee'] || 'default-avatar.png', + name: 'Mike', + github: 'cab-mikee', + twitter: 'cab-mikee', + sponsors: false, + description: 'Open sourceror.
Core Stacks team.
Working at Stacks.js', + packages: ['core'], + functions: ['backend', 'frontend'], + }, + + { + avatar: contributorsAvatars.konkonam || 'default-avatar.png', + name: 'Zoltan', + github: 'konkonam', + sponsors: true, + description: 'Open sourceror.
Core Stacks team.', + packages: ['core'], + functions: ['backend', 'frontend', 'desktop'], + }, +] + .sort((pre, cur) => { + const contribute = Object.keys(contributors) + return contribute.findIndex(name => name === pre.github) - contribute.findIndex(name => name === cur.github) + }) + +export { contributorList as contributors, coreTeamMembers } diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts new file mode 100644 index 0000000..f5920f6 --- /dev/null +++ b/docs/.vitepress/theme/index.ts @@ -0,0 +1,24 @@ +import type { Theme } from 'vitepress' +import TwoSlashFloatingVue from '@shikijs/vitepress-twoslash/client' +import DefaultTheme from 'vitepress/theme' +import { h } from 'vue' + +import 'uno.css' + +import './styles/main.css' +import './styles/vars.css' +import './styles/overrides.css' + +export default { + ...DefaultTheme, + + enhanceApp(ctx: any) { + ctx.app.use(TwoSlashFloatingVue) + }, + + Layout: () => { + return h(DefaultTheme.Layout, null, { + // https://vitepress.dev/guide/extending-default-theme#layout-slots + }) + }, +} satisfies Theme diff --git a/docs/.vitepress/theme/styles/main.css b/docs/.vitepress/theme/styles/main.css new file mode 100644 index 0000000..1e1091d --- /dev/null +++ b/docs/.vitepress/theme/styles/main.css @@ -0,0 +1,31 @@ +html.dark { + color-scheme: dark; +} + +.vp-doc h2 { + border-top: 0; + margin-top: 10px; +} + +.VPMenuLink .link { + line-height: 28px !important; +} + +.VPSidebarGroup .link { + padding: 3px 0 !important; +} + +.vp-doc a:has(> code) { + text-decoration: none; + color: var(--vp-c-brand-1); +} + +.vp-doc a:has(> code):hover { + text-decoration: underline; +} + +#app a:focus-visible, +#app button:focus-visible, +#app input[type='checkbox']:focus-visible { + --at-apply: outline-1 outline-primary ring-2 ring-primary; +} diff --git a/docs/.vitepress/theme/styles/overrides.css b/docs/.vitepress/theme/styles/overrides.css new file mode 100644 index 0000000..034df81 --- /dev/null +++ b/docs/.vitepress/theme/styles/overrides.css @@ -0,0 +1,8 @@ +.custom-block-title { + opacity: 0.5; + font-size: 12px; + margin-top: -5px !important; + margin-bottom: -10px !important; + filter: saturate(0.6); + letter-spacing: 0.5px; +} diff --git a/docs/.vitepress/theme/styles/vars.css b/docs/.vitepress/theme/styles/vars.css new file mode 100644 index 0000000..2e42bba --- /dev/null +++ b/docs/.vitepress/theme/styles/vars.css @@ -0,0 +1,104 @@ +/** + * Colors + * -------------------------------------------------------------------------- */ + +:root { + --vp-c-brand-1: #2563eb; + --vp-c-brand-2: #1e40af; + --vp-c-brand-3: #172554; + --vp-c-brand-soft: #2563eb50; + + --vp-c-text-dark-1: #ffffff; /* Adding this to ensure light text */ + + --vp-c-text-code: #4a72bf; + + --vp-code-block-bg: rgba(125, 125, 125, 0.04); + --vp-code-copy-code-bg: rgba(125, 125, 125, 0.1); + --vp-code-copy-code-hover-bg: rgba(125, 125, 125, 0.2); + + --vp-c-disabled-bg: rgba(125, 125, 125, 0.2); + --vp-c-text-light-2: rgba(56 56 56 / 70%); + --vp-c-text-dark-2: rgba(56 56 56 / 70%); + + --vp-custom-block-info-bg: transparent; + --vp-custom-block-tip-bg: transparent; + + --vp-custom-block-warning-bg: #d9a40605; + --vp-custom-block-warning-text: #d9a406; + --vp-custom-block-warning-border: #d9a40630; + + --vp-custom-block-tip-bg: #2563eb05; + --vp-custom-block-tip-text: #2563eb; + --vp-custom-block-tip-border: #2563eb30; + + --vp-code-color: #4a72bf; +} + +.dark { + --vp-code-block-bg: var(--vp-c-bg-alt); + --vp-c-text-code: #93c5fd; + --vp-c-text-dark-2: rgba(235, 235, 235, 0.6); +} + +/** + * Component: Code + * -------------------------------------------------------------------------- */ + +:root { + --vp-code-line-highlight-color: rgba(125, 125, 125, 0.2); +} + +.dark { + --vp-code-line-highlight-color: rgba(0, 0, 0, 0.5); +} + +/** + * Component: Button + * -------------------------------------------------------------------------- */ + + :root { + --vp-button-brand-border: var(--vp-c-brand-1); + --vp-button-brand-text: var(--vp-c-text-dark-1); + --vp-button-brand-bg: var(--vp-c-brand-1); + --vp-button-brand-hover-border: var(--vp-c-brand-2); + --vp-button-brand-hover-text: var(--vp-c-text-dark-1); + --vp-button-brand-hover-bg: var(--vp-c-brand-2); + --vp-button-brand-active-border: var(--vp-c-brand-2); + --vp-button-brand-active-text: var(--vp-c-text-dark-1); + --vp-button-brand-active-bg: var(--vp-c-brand-2); + } + +/** + * Component: Home + * -------------------------------------------------------------------------- */ + +:root { + --vp-home-hero-name-color: transparent; + --vp-home-hero-name-background: -webkit-linear-gradient( + 120deg, + #1e40af, + #2563eb + ); + --vp-home-hero-image-background-image: linear-gradient(-45deg, #1e40af 50%, #2563eb 50%); + --vp-home-hero-image-filter: blur(30px); +} + +@media (min-width: 640px) { + :root { + --vp-home-hero-image-filter: blur(56px); + } +} + +@media (min-width: 960px) { + :root { + --vp-home-hero-image-filter: blur(60px); + } +} + +/** + * Component: Algolia + * -------------------------------------------------------------------------- */ + +/* .DocSearch { + --docsearch-primary-color: var(--vp-c-brand) !important; +} */ diff --git a/docs/.vitepress/unocss.config.ts b/docs/.vitepress/unocss.config.ts new file mode 100644 index 0000000..1517046 --- /dev/null +++ b/docs/.vitepress/unocss.config.ts @@ -0,0 +1,40 @@ +import { + defineConfig, + presetAttributify, + presetIcons, + presetUno, + transformerDirectives, + transformerVariantGroup, +} from 'unocss' + +export default defineConfig({ + shortcuts: { + 'border-main': 'border-$vp-c-divider', + 'bg-main': 'bg-gray-400', + 'bg-base': 'bg-white dark:bg-hex-1a1a1a', + }, + + presets: [ + presetUno(), + presetAttributify(), + presetIcons({ + scale: 1.2, + warn: true, + }), + ], + + theme: { + colors: { + primary: '#3eaf7c', + }, + + fontFamily: { + mono: 'var(--vp-font-family-mono)', + }, + }, + + transformers: [ + transformerDirectives(), + transformerVariantGroup(), + ], +}) diff --git a/docs/.vitepress/vite.config.ts b/docs/.vitepress/vite.config.ts new file mode 100644 index 0000000..9c0812b --- /dev/null +++ b/docs/.vitepress/vite.config.ts @@ -0,0 +1,60 @@ +import { resolve } from 'node:path' +// import Inspect from 'vite-plugin-inspect' +import UnoCSS from 'unocss/vite' +import IconsResolver from 'unplugin-icons/resolver' +import Icons from 'unplugin-icons/vite' +import Components from 'unplugin-vue-components/vite' +import { defineConfig } from 'vite' + +export default defineConfig({ + build: { + assetsDir: 'assets', + rollupOptions: { + output: { + assetFileNames: 'assets/[name].[hash][extname]', + }, + }, + }, + + resolve: { + dedupe: [ + 'vue', + '@vue/runtime-core', + ], + }, + + plugins: [ + // custom + // MarkdownTransform(), + // Contributors(contributions), + + // plugins + Components({ + dirs: resolve(__dirname, 'theme/components'), + include: [/\.vue$/, /\.vue\?vue/, /\.md$/], + resolvers: [ + IconsResolver({ + componentPrefix: '', + }), + ], + dts: resolve(__dirname, 'components.d.ts'), + transformer: 'vue3', + }), + + Icons({ + compiler: 'vue3', + defaultStyle: 'display: inline-block', + }), + + UnoCSS(resolve(__dirname, 'unocss.config.ts')), + + // Inspect(), + ], + + optimizeDeps: { + exclude: [ + // 'vue', + 'body-scroll-lock', + ], + }, +}) diff --git a/docs/_data/team.js b/docs/_data/team.js new file mode 100644 index 0000000..32c87bb --- /dev/null +++ b/docs/_data/team.js @@ -0,0 +1,102 @@ +export const core = [ + { + avatar: 'https://ca.slack-edge.com/TAFCQEYEP-UAFFN6YSE-fb28a6b5d278-512', + name: 'Chris Breuer', + title: 'Creator', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Independent open source developer, builder in the Stacks ecosystem.', + links: [ + { icon: 'github', link: 'https://github.com/chrisbbreuer' }, + { icon: 'bluesky', link: 'https://bsky.app/profile/chrisbreuer.dev' }, + { icon: 'twitter', link: 'https://twitter.com/chrisbbreuer' }, + ], + sponsor: 'https://github.com/sponsors/chrisbbreuer', + }, + { + avatar: 'https://avatars.githubusercontent.com/u/72235211', + name: 'Blake Ayer', + title: 'Cloud Genius', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://github.com/blakeayer' }], + sponsor: 'https://github.com/sponsors/blakeayer', + }, + { + avatar: 'https://avatars.githubusercontent.com/u/19656966', + name: 'Zoltan', + title: 'Desktop Wizard', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://github.com/konkonam' }], + sponsor: 'https://github.com/sponsors/konkonam', + }, + { + avatar: 'https://www.averyahill.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Favatar.626e0c07.jpg&w=128&q=75', + name: 'Avery Hill', + title: 'Merchandise & Event Planning', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://www.averyahill.com/' }], + }, + { + avatar: 'https://avatars.githubusercontent.com/u/10015302', + name: 'Harlequin Doyon', + title: 'A collaborative being', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://github.com/harlekoy' }], + sponsor: 'https://github.com/sponsors/harlekoy', + }, + { + avatar: 'https://ca.slack-edge.com/TAFCQEYEP-UCX5LQ2NP-g16e383ecf66-512', + name: 'Germaine Abellanosa', + title: 'Social Tech Genius', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://github.com/germikee' }], + sponsor: 'https://github.com/sponsors/germikee', + }, + { + avatar: 'https://avatars.githubusercontent.com/u/58994540', + name: 'Frederik Bußmann', + title: 'A collaborative being', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://github.com/freb97' }], + sponsor: 'https://github.com/sponsors/freb97', + }, + { + avatar: 'https://avatars.githubusercontent.com/u/977413', + name: 'Dorell James', + title: 'A collaborative being', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [ + { icon: 'github', link: 'https://github.com/dorelljames' }, + { icon: 'twitter', link: 'https://twitter.com/dorelljames' }, + ], + sponsor: 'https://github.com/sponsors/dorelljames', + }, + { + avatar: 'https://avatars.githubusercontent.com/u/29087513', + name: 'Glenn Michael', + title: 'Desktop, Mobile, Web', + org: 'Stacks', + orgLink: 'https://stacksjs.org/', + desc: 'Core team member of Stacks.', + links: [{ icon: 'github', link: 'https://github.com/glennmichael123' }], + sponsor: 'https://github.com/sponsors/glennmichael123', + }, +] + +export const emeriti = [ + // +] diff --git a/docs/index.md b/docs/index.md index 1a174c7..3c6e513 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,9 +5,10 @@ hero: name: "bunfig" text: "A smart config loader for Bun projects." tagline: "Lightweight, zero-dependency, and fully typed." + image: /images/logo-white.png actions: - theme: brand - text: Documentation + text: Get Started link: /intro - theme: alt text: View on GitHub @@ -24,3 +25,5 @@ features: icon: "🔍" details: "Type-safe configuration." --- + + diff --git a/docs/install.md b/docs/install.md index 00044b4..7e18df5 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,35 +1,14 @@ # Install +## Bun & Node.js + ```bash bun install -d bunfig -``` - -## Usage - -If you are building any sort of Bun project, you can use the `loadConfig` function to load your configuration. - -```ts -import type { Config } from 'bunfig' -import { loadConfig } from 'bunfig' -interface MyLibraryConfig { - port: number - host: string -} - -const options: Config = { - name: 'my-app', // required - cwd: './', // default: process.cwd() - defaults: { // default: {} - port: 3000, - host: 'localhost', - }, -} - -const resolvedConfig = await loadConfig(options) - -console.log(resolvedConfig) // { port: 3000, host: 'localhost' }, unless a config file is found +# or, invoke immediately +bunx bunfig ``` -> [!TIP] -> If your process.cwd() includes a `$name.config.{ts,js,mjs,cjs}` file, it will be loaded and merged with the defaults, with file config file values taking precedence. +## Binaries + +For now, you can download the `bunfig` binaries from the [releases page](https://github.com/stacksjs/bunfig/releases/tag/v0.4.0). Choose the binary that matches your platform and architecture: diff --git a/docs/intro.md b/docs/intro.md index ff4f3ff..14f14b9 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -1,3 +1,5 @@ +

Social Card of this repo

+ # Introduction `bunfig` is a smart configuration loader for Bun projects. It is lightweight, zero-dependency, and fully typed. diff --git a/docs/public/images/favicon-dark.svg b/docs/public/images/favicon-dark.svg new file mode 100644 index 0000000..2083958 --- /dev/null +++ b/docs/public/images/favicon-dark.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/docs/public/images/favicon.svg b/docs/public/images/favicon.svg new file mode 100644 index 0000000..2083958 --- /dev/null +++ b/docs/public/images/favicon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/docs/public/images/logo-mini.svg b/docs/public/images/logo-mini.svg new file mode 100644 index 0000000..7e957cb --- /dev/null +++ b/docs/public/images/logo-mini.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/public/images/logo-transparent.svg b/docs/public/images/logo-transparent.svg new file mode 100644 index 0000000..7e957cb --- /dev/null +++ b/docs/public/images/logo-transparent.svg @@ -0,0 +1,4 @@ + + + + diff --git a/docs/public/images/logo-white.png b/docs/public/images/logo-white.png new file mode 100644 index 0000000..a19143e Binary files /dev/null and b/docs/public/images/logo-white.png differ diff --git a/docs/public/images/logo.png b/docs/public/images/logo.png new file mode 100644 index 0000000..0064fce Binary files /dev/null and b/docs/public/images/logo.png differ diff --git a/docs/public/images/logo.svg b/docs/public/images/logo.svg new file mode 100644 index 0000000..d12c222 --- /dev/null +++ b/docs/public/images/logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/docs/public/images/og-image.png b/docs/public/images/og-image.png new file mode 100644 index 0000000..58f763d Binary files /dev/null and b/docs/public/images/og-image.png differ diff --git a/docs/team.md b/docs/team.md new file mode 100644 index 0000000..7c74724 --- /dev/null +++ b/docs/team.md @@ -0,0 +1,36 @@ +--- +layout: page +title: Meet the Team +description: A team of incredible people. +sidebar: false +--- + + + + + + + + + + + diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..d5a5599 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,29 @@ +# Usage + +If you are building any sort of Bun project, you can use the `loadConfig` function to load your configuration. + +```ts +import type { Config } from 'bunfig' +import { loadConfig } from 'bunfig' + +interface MyLibraryConfig { + port: number + host: string +} + +const options: Config = { + name: 'my-app', // required + cwd: './', // default: process.cwd() + defaults: { // default: {} + port: 3000, + host: 'localhost', + }, +} + +const resolvedConfig = await loadConfig(options) + +console.log(resolvedConfig) // { port: 3000, host: 'localhost' }, unless a config file is found +``` + +> [!TIP] +> If your process.cwd() includes a `$name.config.{ts,js,mjs,cjs}` file, it will be loaded and merged with the defaults, with file config file values taking precedence. diff --git a/package.json b/package.json index 11166bf..5faaa80 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "files": ["README.md", "dist"], "scripts": { "build": "bun --bun build.ts", - "lint": "bunx eslint .", - "lint:fix": "bunx eslint . --fix", + "lint": "bunx --bun eslint --flag unstable_ts_config .", + "lint:fix": "bunx --bun eslint --flag unstable_ts_config . --fix", "fresh": "bunx rimraf node_modules/ bun.lock && bun i", "changelog": "bunx changelogen --output CHANGELOG.md", "prepublishOnly": "bun --bun run build", @@ -41,20 +41,30 @@ "typecheck": "bun --bun tsc --noEmit" }, "devDependencies": { - "@stacksjs/eslint-config": "^3.11.3-beta.4", + "@iconify-json/carbon": "^1.2.5", + "@shikijs/vitepress-twoslash": "^1.24.2", + "@stacksjs/eslint-config": "^3.12.0-beta.4", "@types/bun": "^1.1.14", + "@vite-pwa/vitepress": "^0.5.3", "bumpp": "^9.9.1", "bun-plugin-dtsx": "^0.21.9", "changelogen": "^0.5.7", "lint-staged": "^15.2.11", "simple-git-hooks": "^2.11.1", "typescript": "^5.7.2", + "unocss": "0.61.0", + "unplugin-icons": "^0.22.0", + "unplugin-vue-components": "^0.28.0", + "vite-plugin-pwa": "^0.21.1", "vitepress": "^1.5.0" }, + "overrides": { + "unconfig": "0.3.10" + }, "simple-git-hooks": { "pre-commit": "bun lint-staged" }, "lint-staged": { - "*.{js,ts}": "bunx eslint . --fix" + "*.{js,ts}": "bunx eslint --flag unstable_ts_config . --fix" } }