Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e262e0

Browse files
piehorinokai
andauthored
chore: initial readme cleanup (#392)
* chore: cleanup current CONTRIBUTING.md * chore: move contributing related content from README to contributing * chore: minor updates/corrections in contributing.md * chore: copy v4 runtime readme over * chore: initial go-through old README trying to remove outdated and update things that might still be relevant * chore: use v4 package README and not v4 repo README * Update README.md Co-authored-by: Rob Stanford <me@robstanford.com> * chore: format with prettier * chore: trigger tests Release-As: 2.0.0 --------- Co-authored-by: Rob Stanford <me@robstanford.com> Co-authored-by: pieh <pieh@users.noreply.github.com>
1 parent 9c0490c commit 0e262e0

File tree

3 files changed

+121
-114
lines changed

3 files changed

+121
-114
lines changed

‎CONTRIBUTING.md‎

Lines changed: 103 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ Before working on an issue, ask to be assigned to it. This makes it clear to oth
1010
contributors that someone is working on the issue.
1111

1212
When creating a PR, please use the template. The information in the template helps maintainers
13-
review your pull request.```
13+
review your pull request.
1414

1515
This project was made with ❤️. The simplest way to give back is by starring and sharing it online.
1616

17-
Everyone is welcome regardless of personal background. We enforce a
18-
[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and inclusive environment.
19-
2017
## Development process
2118

2219
First fork and clone the repository. If you're not sure how to do this, please watch
@@ -34,6 +31,108 @@ Make sure everything is correctly setup with:
3431
npm test
3532
```
3633

34+
## Lambda Folder structure:
35+
36+
For a simple next.js app
37+
38+
```
39+
/___netlify-server-handler
40+
├── .netlify
41+
│ ├── tags-manifest.json
42+
│ └── dist // the compiled runtime code
43+
│ └── run
44+
│ ├── handlers
45+
│ │ ├── server.js
46+
│ │ └── cache.cjs
47+
│ └── next.cjs
48+
├── .next // or distDir name from the next.config.js
49+
│ └── // content from standalone
50+
├── run-config.json // the config object from the required-server-files.json
51+
├── node_modules
52+
├── ___netlify-server-handler.json
53+
├── ___netlify-server-handler.mjs
54+
└── package.json
55+
```
56+
57+
## Testing
58+
59+
The repo includes three types of tests: e2e tests in the repo that use Playwright, integration and
60+
unit tests that use Vitest.
61+
62+
By default the e2e, integration and unit tests run against the latest version of Next.js. To run
63+
tests against a specific version, set the `NEXT_VERSION` environment variable to the desired
64+
version.
65+
66+
By default, PRs will run the tests against the latest version of Next.js. To run tests against
67+
`latest`, `canary` and `13.5.1`, apply the `test all versions` label to the PR when you create it.
68+
These also run nightly and on release PRs.
69+
70+
### Integration testing
71+
72+
> **Prerequisite** Run `npm run build` before running integration tests.
73+
74+
How to add new integration test scenarios to the application:
75+
76+
1. Create a new folder under `tests/fixtures/<your-name>`
77+
2. Adapt the `next.config.js` to be a standalone application
78+
3. Create a `postinstall` script that runs the `next build`. It's important to notice that the
79+
integration tests rely on a already built next.js application in this folder. They rely on the
80+
`.next` folder.
81+
4. Add your test
82+
83+
> Currently the tests require a built version of the `dist/run/handlers/cache.cjs` so you need to
84+
> run `npm run build` before executing the integration tests.
85+
86+
In addition, the integration tests need to be prepared before first use. You can do this by running
87+
`npm run pretest`. To speed up this process and build only the fixtures whose name starts with a
88+
given prefix, run `npm run pretest -- <prefix>`.
89+
90+
### E2E testing
91+
92+
> **Prerequisite**
93+
>
94+
> Needs the `netlify-cli` installed and being logged in having access to Netlify Testing
95+
> Organization or providing your own site ID with NETLIFY_SITE_ID environment variable.
96+
97+
The e2e tests can be invoked with `npm run e2e` and perform a full e2e test. This means they do the
98+
following:
99+
100+
1. Building the next-runtime (just running `npm run build` in the repository)
101+
2. Creating a temp directory and copying the provided fixture over to the directory.
102+
3. Packing the runtime with `npm pack` to the temp directory.
103+
4. Installing the runtime from the created zip artifact of `npm pack` (this is like installing a
104+
node_module from the registry)
105+
5. Creating a `netlify.toml` inside the temp directory of the fixture and adding the runtime as a
106+
plugin.
107+
6. Running `netlify deploy --build` invoking the runtime. This will use the
108+
[next-runtime-testing](https://app.netlify.com/sites/next-runtime-testing/overview) as site to
109+
deploy to.
110+
7. Using the `deployId` and `url` of the deployed site to run some
111+
[playwright](https://playwright.dev/) tests against, asserting the correctness of the runtime.
112+
8. After the tests where run successfully, it will delete the deployment again and clean everything
113+
up. In case of a failure, the deploy won't be cleaned up to leave it for troubleshooting
114+
purposes.
115+
116+
> [!TIP] If you'd like to always keep the deployment and the local fixture around for
117+
> troubleshooting, run `E2E_PERSIST=1 npm run e2e`.
118+
119+
### Next.js tests
120+
121+
There is a script `run-local-test.sh` and GitHub workflow that runs the e2e tests from the Next.js
122+
repo against this repo. It requires that `next.js` is checked out in the same parent directory as
123+
this repo, and is run from this repo with `./run-local-test.sh your-test-pattern-here`.
124+
125+
#### cleanup old deploys
126+
127+
To cleanup old and dangling deploys from failed builds you can run the following script:
128+
129+
```bash
130+
npx tsx ./tools/e2e/cleanup-deploys.ts
131+
```
132+
133+
This will cleanup all created deploys on the
134+
[next-runtime-testing](https://app.netlify.com/sites/next-runtime-testing/overview) site.
135+
37136
## How to write commit messages
38137

39138
We use [Conventional Commit messages](https://www.conventionalcommits.org/) to automate version
@@ -45,11 +144,6 @@ Most common commit message prefixes are:
45144
- `feat:` which represents a new feature, and generate a minor release.
46145
- `feat!:`, `fix!:` or `refactor!:` and generate a major release.
47146

48-
## Releasing
49-
50-
This repository uses [release-please](https://github.com/googleapis/release-please) to automate its
51-
releases.
52-
53147
## How to make a minimal reproduction
54148

55149
A reproducible test case is a small Next.js site built to demonstrate a problem - often this problem

‎README.md‎

Lines changed: 18 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,18 @@
1-
# Next.js Runtime
2-
3-
Next.js is supported natively on Netlify, and in most cases you will not need to install or
4-
configure anything. This repo includes the packages used to support Next.js on Netlify.
5-
6-
## Lambda Folder structure:
7-
8-
For a simple next.js app
9-
10-
```
11-
/___netlify-server-handler
12-
├── .netlify
13-
│ ├── tags-manifest.json
14-
│ └── dist // the compiled runtime code
15-
│ └── run
16-
│ ├── handlers
17-
│ │ ├── server.js
18-
│ │ └── cache.cjs
19-
│ └── next.cjs
20-
├── .next // or distDir name from the next.config.js
21-
│ └── // content from standalone
22-
├── run-config.json // the config object from the required-server-files.json
23-
├── node_modules
24-
├── ___netlify-server-handler.json
25-
├── ___netlify-server-handler.mjs
26-
└── package.json
27-
```
28-
29-
## Testing
30-
31-
The repo includes two types of tests: e2e tests in the repo that use Playwright, integration tests
32-
that use Vitest.
33-
34-
By default the e2e and integration tests run against the latest version of Next.js. To run tests
35-
against a specific version, set the `NEXT_VERSION` environment variable to the desired version.
36-
37-
By default, PRs will run the integration tests against the latest version of Next.js. To run tests
38-
against `latest`, `canary` and `13.5.1`, apply the `test all versions` label to the PR when you
39-
create it. These also run nightly and on release PRs.
40-
41-
### Integration testing
42-
43-
> **Prerequisite** Run `npm run build` before running integration tests.
44-
45-
How to add new integration test scenarios to the application:
46-
47-
1. Create a new folder under `tests/fixtures/<your-name>`
48-
2. Adapt the `next.config.js` to be a standalone application
49-
3. Create a `postinstall` script that runs the `next build`. It's important to notice that the
50-
integration tests rely on a already built next.js application in this folder. They rely on the
51-
`.next` folder.
52-
4. Add your test
53-
54-
> Currently the tests require a built version of the `dist/run/handlers/cache.cjs` so you need to
55-
> run `npm run build` before executing the integration tests.
56-
57-
In addition, the integration tests need to be prepared before first use. You can do this by running
58-
`npm run pretest`. To speed up this process and build only the fixtures whose name starts with a
59-
given prefix, run `npm run pretest -- <prefix>`.
60-
61-
### E2E testing
62-
63-
> **Prerequisite**
64-
>
65-
> Needs the `netlify-cli` installed and being logged in having access to Netlify Testing
66-
> Organization
67-
68-
The e2e tests can be invoked with `npm run e2e` and perform a full e2e test. This means they do the
69-
following:
70-
71-
1. Building the next-runtime (just running `npm run build` in the repository)
72-
2. Creating a temp directory and copying the provided fixture over to the directory.
73-
3. Packing the runtime with `npm pack` to the temp directory.
74-
4. Installing the runtime from the created zip artifact of `npm pack` (this is like installing a
75-
node_module from the registry)
76-
5. Creating a `netlify.toml` inside the temp directory of the fixture and adding the runtime as a
77-
plugin.
78-
6. Running `netlify deploy --build` invoking the runtime. This will use the
79-
[next-runtime-testing](https://app.netlify.com/sites/next-runtime-testing/overview) as site to
80-
deploy to.
81-
7. Using the `deployId` and `url` of the deployed site to run some
82-
[playwright](https://playwright.dev/) tests against, asserting the correctness of the runtime.
83-
8. After the tests where run successfully, it will delete the deployment again and clean everything
84-
up. In case of a failure, the deploy won't be cleaned up to leave it for troubleshooting
85-
purposes.
86-
87-
> [!TIP] If you'd like to always keep the deployment and the local fixture around for
88-
> troubleshooting, run `E2E_PERSIST=1 npm run e2e`.
89-
90-
### Next.js tests
91-
92-
There is a script `run-local-test.sh` and GitHub workflow that runs the e2e tests from the Next.js
93-
repo against this repo. It requires that `next.js` is checked out in the same parent directory as
94-
this repo, and is run from this repo with `./run-local-test.sh your-test-pattern-here`.
95-
96-
#### cleanup old deploys
97-
98-
To cleanup old and dangling deploys from failed builds you can run the following script:
99-
100-
```bash
101-
npx tsx ./tools/e2e/cleanup-deploys.ts
102-
```
103-
104-
This will cleanup all created deploys on the
105-
[next-runtime-testing](https://app.netlify.com/sites/next-runtime-testing/overview) site.
1+
![Next.js Runtime](https://github.com/netlify/next-runtime/raw/main/next-js-runtime.png)
2+
3+
# `@netlify/plugin-nextjs`
4+
5+
<p align="center">
6+
<a aria-label="npm version" href="https://www.npmjs.com/package/@netlify/plugin-nextjs">
7+
<img alt="" src="https://img.shields.io/npm/v/@netlify/plugin-nextjs">
8+
</a>
9+
<a aria-label="MIT License" href="https://img.shields.io/npm/l/@netlify/plugin-nextjs">
10+
<img alt="" src="https://img.shields.io/npm/l/@netlify/plugin-nextjs">
11+
</a>
12+
</p>
13+
14+
This package handles the build process and creates the runtime environment for Next.js sites on
15+
Netlify. You should not normally need to install it yourself, as it is used automatically during
16+
builds of Next.js sites. See
17+
[the docs for using Next.js on Netlify](https://docs.netlify.com/frameworks/next-js/overview/) for
18+
more details.

‎next-js-runtime.png‎

43 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /