-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
162 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ lib-cov | |
logs | ||
node_modules | ||
temp | ||
docs/.vitepress/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }, | ||
], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 💙 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": { | ||
|
@@ -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" | ||
|