# hygen-next

> A hygen package for Next.js

Latest version **0.6.0** (published 2021-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install hygen-next
pnpm add hygen-next
yarn add hygen-next
bun add hygen-next
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2021-03-02 |
| First published | 2021-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tundera |
| Keywords | hygen, generate, generator, nextjs, next |

## Links

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

## Recent versions

- 0.6.0 (latest) — 2021-03-02
- 0.5.0 — 2021-03-02
- 0.4.0 — 2021-03-02
- 0.3.0 — 2021-03-02
- 0.2.0 — 2021-03-02
- 0.1.0 — 2021-02-25

## README

# hygen-next

This is a [hygen](https://github.com/jondot/hygen) package for [Next.js](https://github.com/vercel/next.js) that makes it easier to scaffold out components, pages, and API routes in a Next.js project in a consistent manner. Feel free to adapt the templates to your specific use-case.

By default, the templates included use TypeScript and assume a basic setup of the following tools:

- Storybook using [Component Story Format](https://storybook.js.org/docs/react/api/csf)
- Jest with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/)

## Quick Start

Install `hygen-add` globally

```zsh
yarn global hygen-add
```

Then in your Next.js project directory run

```zsh
hygen-add next
```

If you prefer using `npx`, skip the global install and run

```zsh
npx hygen-add next
```

## Generators

Available generators are described in the following sections. Currently supported commands include:

- `hygen component new` for components in the `src/components` directory
- `hygen page [type]:new` for pages where `type` is one of `basic`, `ssg`, or `ssr`
- `hygen api new` for API routes in the `pages` directory

### Components

```zsh
hygen component new [name]
```

This generator creates a new React component with an accompanying Storybook file and a Jest test using React Testing Library.

If you don't pass any flags, an interactive CLI will prompt you for a name and location (default `src/components`) of the component you want to generate.

By default the component generators create a Storybook file, so you'll either need to have an instance in your project or create one by running

```zsh
npx sb init
```

### Pages

```zsh
hygen page [type]:new [name]
```

This generator creates a new page in your `pages` directory, where `type` is one of the following:

- `basic` for a generic page
- `ssg` for a page with `getStaticProps`
- `ssr` for a page with `getServerSideProps`

### API Routes

```zsh
hygen api new [name]
```

This generator creates a new API route in your `pages/api` directory. You can skip specifying a name to use the interactive CLI prompt instead.

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