# netlify-cms-json-exporter

> Export all your Netlify CMS contents in a single object with all relations resolved.

Latest version **0.1.2** (published 2021-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install netlify-cms-json-exporter
pnpm add netlify-cms-json-exporter
yarn add netlify-cms-json-exporter
bun add netlify-cms-json-exporter
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2021-06-18 |
| First published | 2021-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 12 |
| Dependencies | 4 |
| Unpacked size | 19.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Marco Montalbano |
| Maintainers | marcomontalbano |
| Keywords | netlify cms, netlify, cms, export |

## Links

- npm: https://www.npmjs.com/package/netlify-cms-json-exporter
- Homepage: https://github.com/marcomontalbano/netlify-cms-json-exporter#readme
- Issues: https://github.com/marcomontalbano/netlify-cms-json-exporter/issues
- npm.io page: https://npm.io/package/netlify-cms-json-exporter

## Dependencies (4)

- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [dot-object](https://npm.io/package/dot-object.md) ^2.1.4
- [@types/js-yaml](https://npm.io/package/@types/js-yaml.md) ^4.0.1
- [@types/dot-object](https://npm.io/package/@types/dot-object.md) ^2.1.2

## Recent versions

- 0.1.2 (latest) — 2021-06-18
- 0.1.0-beta.2 (next) — 2021-02-05
- 0.1.1 — 2021-04-28
- 0.1.0 — 2021-04-28
- 0.1.0-beta.1 — 2021-02-03

## README

# Netlify CMS - JSON Exporter

[Netlify CMS](https://www.netlifycms.org/) stores the content in separate folders and files.
With `JSON Exporter` you can export all your Netlify CMS contents in a single object with all relations resolved.

This can be useful if need to inject your content as `props` inside your components.

## Usage

```sh
# with yarn
yarn add -D netlify-cms-json-exporter

# with npm
npm install --save-dev netlify-cms-json-exporter
```

### Export as `db.json`

```js
import fs from 'fs'
import { getContent } from 'netlify-cms-json-exporter'

const content = getContent('./public/admin/config.yml', './content')

fs.writeFileSync('db.json', JSON.stringify(content, undefined, 2))
```

### Typescript `.d.ts`

```js
// netlify-cms-exporter.js

import { getContent } from 'netlify-cms-json-exporter'

const content = getContent('./public/admin/config.yml', './content')

console.log(
  JSON.stringify(content, undefined, 2)
)
```

```sh
node netlify-cms-exporter.js | npx json-ts --stdin --prefix "" > content.d.ts
```

---
_Source: https://npm.io/package/netlify-cms-json-exporter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
