Skip to content

Commit

Permalink
chore: update automd
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 20, 2024
1 parent 8a14b5f commit bf48062
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 32 deletions.
86 changes: 64 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# confbox

<!-- automd:badges -->
<!-- automd:badges color=yellow no-npmDownloads bundlephobia packagephobia -->

[![npm version](https://flat.badgen.net/npm/v/confbox)](https://npmjs.com/package/confbox)
[![npm downloads](https://flat.badgen.net/npm/dm/confbox)](https://npmjs.com/package/confbox)
[![npm version](https://flat.badgen.net/npm/v/confbox?color=yellow)](https://npmjs.com/package/confbox)
[![bundle size](https://flat.badgen.net/bundlephobia/minzip/confbox?color=yellow)](https://bundlephobia.com/package/confbox)
[![install size](https://flat.badgen.net/packagephobia/publish/confbox?color=yellow)](https://packagephobia.com/result?p=confbox)

<!-- /automd -->

Expand All @@ -19,11 +20,15 @@ Config parsers for:

With perfect bundling:

✨ Types exported out of the box <br>
✨ Zero config and compact redistribution <br>
✨ Dual ESM/CJS build <br>
✨ Consistent and tested API <br>
✨ Handpicked best libraries (bundle+perf) <br>
✨ Types exported out of the box

✨ Zero config and compact redistribution

✨ Dual ESM/CJS build

✨ Consistent and tested API

✨ Handpicked best libraries (bundle+perf)

> [!NOTE]
> Use [unjs/c12](https://github.com/unjs/c12) for a full featured configuration loader!
Expand Down Expand Up @@ -55,32 +60,46 @@ bun install confbox

Import:

<!-- automd:jsimport cjs cdn src="./src/index.ts" -->

**ESM** (Node.js, Bun)

```js
// ESM (tree-shakable)
import {
parseJSON5,
parseJSONC,
parseTOML,
parseYAML,
stringifyYAML,
parseTOML,
} from "confbox";
```

// Using individual builds
import { parseYAML, stringifyYAML } from "confbox/yaml";
import { parseTOML } from "confbox/toml";
import { parseJSON5 } from "confbox/json5";
import { parseJSONC } from "confbox/jsonc";
**CommonJS** (Legacy Node.js)

// CommonJS
```js
const {
parseJSON5,
parseJSONC,
parseTOML,
parseYAML,
stringifyYAML,
parseTOML,
} = require("confbox");
```

**CDN** (Deno, Bun and Browsers)

```js
import {
parseJSON5,
parseJSONC,
parseYAML,
stringifyYAML,
parseTOML,
} from "https://esm.sh/confbox";
```

<!-- /automd -->

<!-- automd:jsdocs src="./src/index" -->

### `parseJSON5(text, options?)`
Expand All @@ -103,19 +122,42 @@ Converts a [YAML](https://yaml.org/) string into an object.

Converts a JavaScript value to a [YAML](https://yaml.org/) string.


<!-- /automd -->

## Development
<!-- automd:fetch url="gh:unjs/.github/main/snippets/readme-contrib-node-pnpm.md" -->

## Contribution

<details>
<summary>Local development</summary>

- Clone this repository
- Install the latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`
- Run tests using `pnpm dev` or `pnpm test`

</details>

<!-- /automd -->

## License

Made with 💛
<!-- automd:contributors license=MIT author=pi0 -->

Published under the [MIT](https://github.com/unjs/confbox/blob/main/LICENSE) license.
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/confbox/graphs/contributors) 💛
<br><br>
<a href="https://github.com/unjs/confbox/graphs/contributors">
<img src="https://contrib.rocks/image?repo=unjs/confbox" />
</a>

<!-- /automd -->

Published under [MIT License](./LICENSE).
<!-- automd:with-automd -->

---

_🤖 auto updated with [automd](https://automd.unjs.io) (last updated: Tue Feb 20 2024)_

<!-- /automd -->
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@types/js-yaml": "^4.0.9",
"@types/node": "^20.11.19",
"@vitest/coverage-v8": "^1.3.0",
"automd": "^0.3.0",
"automd": "^0.3.2",
"changelogen": "^0.5.5",
"eslint": "^8.56.0",
"eslint-config-unjs": "^0.2.1",
Expand All @@ -81,4 +81,4 @@
"yaml": "^2.3.4"
},
"packageManager": "[email protected]"
}
}
9 changes: 5 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
export * from "./json5";
export * from "./jsonc";
export * from "./yaml";
export * from "./toml";
export { parseJSON5 } from "./json5";
export type { JSON5ParseOptions, JSON5StringifyOptions } from "./json5";

export { parseJSONC } from "./jsonc";
export type { JSONCParseError, JSONCParseOptions } from "./jsonc";

export { parseYAML, stringifyYAML } from "./yaml";
export type { parseYAMLOptions, stringifyYAMLOptions } from "./yaml";

export { parseTOML } from "./toml";

0 comments on commit bf48062

Please sign in to comment.