Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge next-on-netlify into the core plugin repo #106

Merged
merged 14 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ __mocks__
test/fixtures
test/sample
next.config.js
src/cypress/builds/
src/tests/builds/
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 3.0.0 (2021-03-??)

- feat: merge `next-on-netlify` into `@netlify/plugin-nextjs`

This improves our ability to maintain the plugin, reduces confusion about how to configure Next.js support for Netlify builds, and prepares the plugin for something we're pretty dang excited about: automatic installation for new Next.js projects!
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved

> **NOTE: There are no breaking changes for existing plugin users.** This is a major release because we're bringing an external package into the plugin _and_ turning on automatic installation for new Next.js projects on Netlify. This doesn't break anything, but it's a big enough change that we wanted to treat it as a major release.

lindsaylevine marked this conversation as resolved.
Show resolved Hide resolved
### Migrating from v2 to v3

If you've installed this plugin via Netlify's UI, no action is necessary. The upgrade is automatic.

If you've installed this plugin manually in your `netlify.toml`, you can upgrade two ways:

1. Use the new automatic install! Remove this plugin from your project and `netlify.toml` and Netlify will automatically install it for a seamless experience working with Next.js on Netlify.
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved
2. Manually update to the latest version using `npm i @netlify/plugin-nextjs@latest`.
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved

## 2.0.1 (2021-02-17)

- fail build if plugin cant load next.config.js ([#99](https://github.com/netlify/netlify-plugin-nextjs/pull/99))
Expand Down
54 changes: 26 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Next.js on Netlify Build Plugin](next-on-netlify.png)

# Next.js Build Plugin
# Essential Next.js Build Plugin
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved

<p align="center">
<a aria-label="npm version" href="https://www.npmjs.com/package/@netlify/plugin-nextjs">
Expand All @@ -26,46 +26,44 @@ This build plugin is a utility for supporting Next.js on Netlify. To enable serv

## Installation and Configuration

There are two ways to install the plugin in your Next.js on Netlify site: with the Netlify UI or with file-based installation.
As of v3.0.0, all new sites deployed to Netlify with Next.js will automatically build with this plugin for a seamless experience deploying Next.js on Netlify!
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved

**UI-based Installation**
This means that you don't have to do anything — just build and deploy your site to Netlify as usual and we'll handle the rest.

You can install this plugin using this [direct in-app installation link](http://app.netlify.com/plugins/@netlify/plugin-nextjs/install) or from your team's [Plugins directory](https://app.netlify.com/plugins) in the Netlify UI.
You're able to remove the plugin at any time by visiting the Plugins tab on your site.
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved

Read more about [UI-based plugin installation](https://docs.netlify.com/configure-builds/build-plugins/#ui-installation) in our docs.
jlengstorf marked this conversation as resolved.
Show resolved Hide resolved
### Manual installation

**File-based Installation**
1\. Create a `netlify.toml` in the root of your project. Your file should include the plugins section below:

1. Create a `netlify.toml` in the root of your project. Your file should include the plugins section below:

```toml
[build]
command = "npm run build"
publish = "out"
```toml
[build]
command = "npm run build"
publish = "out"

[[plugins]]
package = "@netlify/plugin-nextjs"
```
[[plugins]]
package = "@netlify/plugin-nextjs"
```

You can also add context-specific properties and environment variables to your `netlify.toml`. Read more about [deploy contexts](https://docs.netlify.com/configure-builds/file-based-configuration/#deploy-contexts) in our docs. For example:

```toml
[context.production.environment]
NEXT_SERVERLESS = "true"
NODE_ENV = "production"
```
```toml
[context.production.environment]
NEXT_SERVERLESS = "true"
NODE_ENV = "production"
```

2. From your project's base directory, use `npm`, `yarn`, or any other Node.js package manager to add this plugin to `devDependencies` in `package.json`.
2\. From your project's base directory, use `npm`, `yarn`, or any other Node.js package manager to add this plugin to `devDependencies` in `package.json`.

```
npm install -D @netlify/plugin-nextjs
```
```
npm install -D @netlify/plugin-nextjs
```

or
or

```
yarn add -D @netlify/plugin-nextjs
```
```
yarn add -D @netlify/plugin-nextjs
```

Read more about [file-based plugin installation](https://docs.netlify.com/configure-builds/build-plugins/#file-based-installation) in our docs.

Expand Down
5 changes: 1 addition & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path')
const util = require('util')
const makeDir = require('make-dir')
const findUp = require('find-up')
const nextOnNetlify = require('./src/index.js')

const validateNextUsage = require('./helpers/validateNextUsage')
const doesNotNeedPlugin = require('./helpers/doesNotNeedPlugin')
Expand Down Expand Up @@ -53,10 +54,6 @@ module.exports = {

await makeDir(PUBLISH_DIR)

// We cannot load `next-on-netlify` (which depends on `next`) at the
// top-level because we validate whether the site is using `next`
// inside `onPreBuild`.
const nextOnNetlify = require('next-on-netlify')
nextOnNetlify({ functionsDir: FUNCTIONS_SRC, publishDir: PUBLISH_DIR })
},
}
Expand Down
Loading