now-next-example-builder

0.1.1 • Public • Published

Example/demo app builder for Next.js libraries

When you create a library for Next.js with an example app in the repository it can be difficult to deploy to now.sh if the example app is located in a subdirectory (./example) depending on the library located the root of repo (`./). This builder provides a workaround by inverting the nested relationship so that the library will be installed in the example app (rather than in the parent dir) when the builder finally passes the build off to the official @now/next builder.

Usage

First must have the expected filesystem.

  1. Next.js-centric library in the root
  2. A Next.js example app that sources the library in package.json
├── example
│   ├── next.config.js
│   ├── package.json
│   ├── pages
│   │   ├── about.js
│   │   └── index.js
│   └── yarn.lock
├── index.js
├── now.json
└── package.json

Next declare the now-next-example-builder where you'd normally use @now/next

{

  "version": 2,
  "name": "experiment",
  "public": true,
  "builds": [
    { "src": "example/next.config.js", "use": "now-next-example-builder" }
  ]
}

Finally run now as you normally would.

Development

Minimal example repo for manual testing: https://github.com/possibilities/now-next-example-builder-fixture

Readme

Keywords

none

Package Sidebar

Install

npm i now-next-example-builder

Weekly Downloads

100

Version

0.1.1

License

none

Unpacked Size

63 kB

Total Files

4

Last publish

Collaborators

  • possibilities