Skip to content

Commit 033aef2

Browse files
author
root
committed
Copy Template Repo
0 parents  commit 033aef2

File tree

14 files changed

+10505
-0
lines changed

14 files changed

+10505
-0
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'daily'
7+
allow:
8+
- dependency-name: '@layer0/*'
9+
open-pull-requests-limit: 10

.github/workflows/layer0.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Deploy to Layer0
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
deploy-to-layer0:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- uses: actions/setup-node@v1
13+
with:
14+
node-version: 14
15+
registry-url: https://npm-proxy.fury.io/moovweb/
16+
- run: npm ci
17+
- run: npm run layer0:deploy -- --token=$LAYER0_DEPLOY_TOKEN
18+
env:
19+
LAYER0_DEPLOY_TOKEN: ${{secrets.LAYER0_DEPLOY_TOKEN}}

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel
35+
# Layer0 generated build directory
36+
.layer0

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.next
2+
.layer0
3+
node_modules
4+
.github

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 150
5+
}

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Static Prerendering with Layer0
2+
3+
A demo showing off Static Prerendering upto 25K URLs with Layer0.
4+
5+
## Demo
6+
7+
https://layer0-docs-layer0-prerender-example-default.layer0-limelight.link/prerender/p05XWekdKY
8+
9+
## Try It Now
10+
11+
[![Deploy with Layer0](https://docs.layer0.co/button.svg)](https://app.layer0.co/deploy?repo=https://github.com/layer0-docs/layer0-prerender-example)
12+
13+
## Getting Started
14+
15+
### Clone This Repo
16+
17+
Use `git clone https://github.com/layer0-docs/layer0-prerender-example.git` to get the files within this repository onto your local machine.
18+
19+
### Install dependencies
20+
21+
On the command line, in the project root directory, run the following command:
22+
23+
```bash
24+
npm install
25+
```
26+
27+
### Run the Next.js app locally on Layer0
28+
29+
Run the Next.js app with the command:
30+
31+
```bash
32+
npm run layer0:dev
33+
```
34+
35+
Load the site: http://127.0.0.1:3000
36+
37+
### Testing production build locally with Layer0
38+
39+
You can do a production build of your app and test it locally using:
40+
41+
```bash
42+
npm run layer0:build && npm run layer0:run --production
43+
```
44+
45+
Setting --production runs your app exactly as it will be uploaded to the Layer0 cloud using serverless-offline.
46+
47+
## Deploying to Layer0
48+
49+
Deploying requires an account on Layer0. [Sign up here for free](https://app.layer0.co/signup). Once you have an account, you can deploy to Layer0 by running the following in the root folder of your project:
50+
51+
```bash
52+
npm run layer0:deploy
53+
```
54+
55+
See [deploying](https://docs.layer0.co/guides/deploying) for more information.

layer0.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
connector: '@layer0/next',
3+
prerenderConcurrency: 200, // Change to 10 if on FREE plan
4+
}

next.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { withLayer0, withServiceWorker } = require('@layer0/next/config')
2+
3+
module.exports = withLayer0(
4+
withServiceWorker({
5+
target: 'server',
6+
layer0SourceMaps: true,
7+
})
8+
)

0 commit comments

Comments
 (0)