# next-data-pipe

> > Let your data flow in Next.js super easily.

Latest version **0.0.7** (published 2022-08-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install next-data-pipe
pnpm add next-data-pipe
yarn add next-data-pipe
bun add next-data-pipe
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2022-08-24 |
| First published | 2022-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | davidebruner |

## Links

- npm: https://www.npmjs.com/package/next-data-pipe
- Repository: https://github.com/DavideBruner/data-pipe
- Homepage: https://github.com/DavideBruner/data-pipe#readme
- Issues: https://github.com/DavideBruner/data-pipe/issues
- npm.io page: https://npm.io/package/next-data-pipe

## Recent versions

- 0.0.7 (latest) — 2022-08-24
- 0.0.6 — 2022-08-24
- 0.0.5 — 2022-08-24
- 0.0.4 — 2022-08-24
- 0.0.3 — 2022-08-24
- 0.0.2 — 2022-08-24

## README

# next-data-pipe 
> Let your data flow in Next.js super easily.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]


`next-data-pipe` is a small lib that wraps up `dipe (data-pipe)` and provides some additional utilies such as (for example in Next.js by lifting static props).


## Why would I need this?
This library works perfectly in combination with the [next-data-hooks](https://) library.

It works by lifliting up all the boilerplate needed for processing static or server data from props to pre-configured processors callbacks.

## Installation 🔧
```bash
npm install -S next-data-pipe

or 

yarn add next-data-pipe
```

## Usage 💡

This library works as an etension of the `data-pipe` library, and provides some utilities build in for Next.js projects.

```js
// example.config.js
const { LocalFilesPostProcessor } = require('next-data-pipe/processors');

const config = {
  articles: {
    processors: [
      () => {},
      LocalFilesPostProcessor,
    ]
  }
};

export default config;
```

We also expose a `useConfig` utiltiy used to return a direct link to the config file.
To use that function it's necessary to first configure the webpack config to properly resolve the config file previously created.

```js
// next.config.js
const { resolveConfig } = require('next-data-pipe');
module.exports = {
  webpack: (config, options) => {
    return resolveConfig(config, { configFilePath: './example.config.js' })
  },
}
```

And then the actual implementation will look just like:

```js
import { getConfig, readData } from 'next-data-pipe';

const articles = getConfig('articles');
let { data, errors } = readData(articles, {});
```

> You can totally skip this part and just use the `next-data-pipe` package (as shown below):

```js
import { readData } from 'next-data-pipe';
let { data, errors } = readData({
  processors: [],
}, {});

// or 
import config from '../example.config.js';
let { data, errors } = readData(config.articles, {});
```

See the example in this repo for some ideas on how to organize your data using preconfigured processors.
And check what you can do with the `data-pipe` package [here]().


[version-image]: https://img.shields.io/npm/v/next-data-pipe
[version-url]: https://npmjs.org/package/next-data-pipe

[license-image]: https://img.shields.io/npm/l/next-data-pipe
[license-url]: hhttps://github.com/DavideBruner/data-pipe/tree/main/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/next-data-pipe
[size-url]: https://github.com/DavideBruner/data-pipe/tree/main/packages/data-pipe/dist/index.js

[download-image]: https://img.shields.io/npm/dm/next-data-pipe
[download-url]: https://www.npmjs.com/package/next-data-pipe

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