Skip to content

Commit

Permalink
chore: add initial docs
Browse files Browse the repository at this point in the history
chore: wip

chore: wip
  • Loading branch information
chrisbbreuer committed Dec 9, 2024
1 parent 25b1b77 commit 8abe01b
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ lib-cov
logs
node_modules
temp
docs/.vitepress/cache
Binary file modified bun.lockb
Binary file not shown.
32 changes: 32 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { defineConfig } from 'vitepress'

// 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: [
{
text: 'Get Started',
items: [
{ text: 'Introduction', link: '/intro' },
{ text: 'Install', link: '/install' },
],
},
],

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' },
],
},
})
26 changes: 26 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: home

hero:
name: "bunfig"
text: "A smart config loader for Bun projects."
tagline: "Lightweight, zero-dependency, and fully typed."
actions:
- theme: brand
text: Documentation
link: /intro
- theme: alt
text: View on GitHub
link: https://github.com/stacksjs/bunfig

features:
- title: "Smart Configuration Loading"
icon: "💡"
details: "Load your configuration with ease, in a way that suits you."
- title: "Lightweight & zero-dependency"
icon: "🚀"
details: "No bloat, optimized for Bun usage."
- title: "Type-safe"
icon: "🔍"
details: "Type-safe configuration."
---
35 changes: 35 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Install

```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<MyLibraryConfig> = {
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.
59 changes: 59 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Introduction

`bunfig` is a smart configuration loader for Bun projects. It is lightweight, zero-dependency, and fully typed.

## Features

- Smart configuration loader
- Lightweight & zero-dependency
- Fully typed

_Think of `unconfig`, but optimized for Bun projects._

## Testing

```bash
bun test
```

## Changelog

Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.

## Contributing

Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.

## Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)

For casual chit-chat with others using this package:

[Join the Stacks Discord Server](https://discord.gg/stacksjs)

## Postcardware

Two things are true: Stacks OSS will always stay open-source, and we do love to receive postcards from wherever Stacks is used! 🌍 _We also publish them on our website. And thank you, Spatie_

Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094

## Sponsors

We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.

- [JetBrains](https://www.jetbrains.com/)
- [The Solana Foundation](https://solana.com/)

## Credits

- [Chris Breuer](https://github.com/chrisbbreuer)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/bun-config/tree/main/LICENSE.md) for more information.

Made with 💙
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"description": "A smart & fully-typed configuration loader for Bun.",
"author": "Chris Breuer <[email protected]>",
"license": "MIT",
"homepage": "https://github.com/stacksjs/bun-config#readme",
"homepage": "https://github.com/stacksjs/bunfig#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/stacksjs/bun-config.git"
"url": "git+https://github.com/stacksjs/bunfig.git"
},
"bugs": {
"url": "https://github.com/stacksjs/bun-config/issues"
"url": "https://github.com/stacksjs/bunfig/issues"
},
"keywords": ["config", "loader", "bun", "bunfig"],
"exports": {
Expand All @@ -35,17 +35,21 @@
"prepublishOnly": "bun --bun run build",
"release": "bun run changelog && bunx bumpp package.json --all",
"test": "bun test",
"dev:docs": "bun --bun vitepress dev docs",
"build:docs": "bun --bun vitepress build docs",
"preview:docs": "bun --bun vitepress preview docs",
"typecheck": "bun --bun tsc --noEmit"
},
"devDependencies": {
"@stacksjs/eslint-config": "^3.8.1-beta.2",
"@stacksjs/eslint-config": "^3.11.3-beta.4",
"@types/bun": "^1.1.14",
"bumpp": "^9.9.0",
"bun-plugin-dtsx": "^0.21.9",
"changelogen": "^0.5.7",
"lint-staged": "^15.2.10",
"simple-git-hooks": "^2.11.1",
"typescript": "^5.7.2"
"typescript": "^5.7.2",
"vitepress": "^1.5.0"
},
"simple-git-hooks": {
"pre-commit": "bun lint-staged"
Expand Down

0 comments on commit 8abe01b

Please sign in to comment.