Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 7bf10cd

Browse files
authored
add section about private submodules; use hierarchical headings (#155)
1 parent 7ad6d32 commit 7bf10cd

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

README.md

+30-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ The plugin can be found on [npm here](https://www.npmjs.com/package/@netlify/plu
4141
- [Setup](#setup)
4242
- [1. Set Next.js target to serverless](#1-set-nextjs-target-to-serverless)
4343
- [2. Add postbuild hook](#2-add-postbuild-hook)
44-
- [3. Configure Netlify](#3-configure-netlify)
44+
- [3. Configure for Netlify](#3-configure-for-netlify)
45+
- [(Optional) Configure private git submodules](#optional-configure-private-git-submodules)
4546
- [Demo](#demo)
4647
- [Optional Extras](#optional-extras)
4748
- [Preview Locally](#preview-locally)
@@ -63,7 +64,7 @@ npm install --save next-on-netlify
6364

6465
## Setup
6566

66-
#### 1. Set Next.js target to serverless
67+
### 1. Set Next.js target to serverless
6768

6869
We must build our Next.js app as a serverless app. You can read more about serverless Next.js [here](https://nextjs.org/docs/api-reference/next.config.js/build-target#serverless-target).
6970

@@ -90,7 +91,7 @@ module.exports = {
9091
};
9192
```
9293

93-
#### 2. Add postbuild hook
94+
### 2. Add postbuild hook
9495

9596
The next-on-netlify package adds the `next-on-netlify` command. When we run this command, some magic happens to prepare our Next.js app for hosting on Netlify\*.
9697

@@ -110,7 +111,7 @@ We want the next-on-netlify command to run after we build our Next.js applicatio
110111

111112
\*If you're curious about the "magic", check out the well-documented [`next-on-netlify.js` file](https://github.com/netlify/next-on-netlify/blob/master/next-on-netlify.js).
112113

113-
#### 3. Configure Netlify
114+
### 3. Configure for Netlify
114115

115116
We're almost done! We just have to tell Netlify how to build our Next.js app, where the functions folder is located, and which folder to upload to its CDN. We do that with a `netlify.toml` file and the following instructions:
116117

@@ -121,7 +122,27 @@ We're almost done! We just have to tell Netlify how to build our Next.js app, wh
121122
publish = "out_publish"
122123
```
123124

124-
Note: `out_functions` and `out_publish` are hard-coded into next-on-netlify. These are not configurable at the moment.
125+
Note: `out_functions` and `out_publish` are hard-coded into next-on-netlify.
126+
These are not configurable at the moment.
127+
128+
#### (Optional) Configure private git submodules
129+
If your project contains private submodules, in order to deploy it, you will
130+
need to:
131+
132+
1. [Generate a Deploy
133+
Key](https://docs.netlify.com/configure-builds/repo-permissions-linking/#deploy-keys)
134+
in Netlify and [add it to the relevant
135+
submodules](https://docs.github.com/en/developers/overview/managing-deploy-keys#setup-2)
136+
so that they can be cloned during the deploy process.
137+
138+
2. Ensure the submodule remotes are set to SSH format (i.e.
139+
`[email protected]:owner/project.git`, not `https://...`). Inside the submodule
140+
directory, the git remote can be updated with:
141+
142+
```bash
143+
# git remote set-url [remote] [url]
144+
git remote set-url origin [email protected]:owner/project.git
145+
```
125146

126147
We're done. Let's deploy 🚀🚀🚀
127148

@@ -132,7 +153,7 @@ We're done. Let's deploy 🚀🚀🚀
132153

133154
## Optional Extras
134155

135-
#### Preview Locally
156+
### Preview Locally
136157

137158
I recommend you still use `next dev` to build and preview your application locally.
138159

@@ -184,7 +205,7 @@ Preview Mode is not yet available locally, running `netlify dev`, for static pag
184205

185206
For now, Preview Mode *is* supported in production for all Next.js page types.
186207

187-
#### Custom Netlify Redirects
208+
### Custom Netlify Redirects
188209

189210
You can define custom redirects in a `_redirects` and/or in your `netlify.toml` file.
190211
The precedence of these rules are:
@@ -196,12 +217,12 @@ Currently, there is no support for redirects set in your `netlify.toml` file.
196217

197218
[Read more about Netlify redirects here](https://docs.netlify.com/routing/redirects/).
198219

199-
#### Custom Netlify Functions
220+
### Custom Netlify Functions
200221

201222
`next-on-netlify` creates one Netlify Function for each of your
202223
SSR pages and API endpoints. It is currently not possible to create custom Netlify Functions. This feature is on our list to do.
203224

204-
#### Using Netlify Identity
225+
### Using Netlify Identity
205226

206227
You can use [Netlify Identity](https://docs.netlify.com/visitor-access/identity/) with `next-on-netlify`. For all pages with server-side rendering (getInitialProps*, getServerSideProps, and API routes), you can access the [clientContext object](https://docs.netlify.com/functions/functions-and-identity/#access-identity-info-via-clientcontext) via the `req` parameter.
207228

0 commit comments

Comments
 (0)