Skip to content

Commit

Permalink
Copy Template Repo
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jul 18, 2022
0 parents commit 66b2eab
Show file tree
Hide file tree
Showing 14 changed files with 10,505 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
allow:
- dependency-name: '@layer0/*'
open-pull-requests-limit: 10
19 changes: 19 additions & 0 deletions .github/workflows/layer0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy to Layer0

on:
workflow_dispatch:
push:

jobs:
deploy-to-layer0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://npm-proxy.fury.io/moovweb/
- run: npm ci
- run: npm run layer0:deploy -- --token=$LAYER0_DEPLOY_TOKEN
env:
LAYER0_DEPLOY_TOKEN: ${{secrets.LAYER0_DEPLOY_TOKEN}}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
# Layer0 generated build directory
.layer0
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.next
.layer0
node_modules
.github
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"printWidth": 150
}
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Static Prerendering with Layer0

A demo showing off Static Prerendering upto 25K URLs with Layer0.

## Demo

https://layer0-docs-layer0-prerender-example-default.layer0-limelight.link/prerender/p05XWekdKY

## Try It Now

[![Deploy with Layer0](https://docs.layer0.co/button.svg)](https://app.layer0.co/deploy?repo=https://github.com/layer0-docs/layer0-prerender-example)

## Getting Started

### Clone This Repo

Use `git clone https://github.com/layer0-docs/layer0-prerender-example.git` to get the files within this repository onto your local machine.

### Install dependencies

On the command line, in the project root directory, run the following command:

```bash
npm install
```

### Run the Next.js app locally on Layer0

Run the Next.js app with the command:

```bash
npm run layer0:dev
```

Load the site: http://127.0.0.1:3000

### Testing production build locally with Layer0

You can do a production build of your app and test it locally using:

```bash
npm run layer0:build && npm run layer0:run --production
```

Setting --production runs your app exactly as it will be uploaded to the Layer0 cloud using serverless-offline.

## Deploying to Layer0

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:

```bash
npm run layer0:deploy
```

See [deploying](https://docs.layer0.co/guides/deploying) for more information.
4 changes: 4 additions & 0 deletions layer0.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
connector: '@layer0/next',
prerenderConcurrency: 200, // Change to 10 if on FREE plan
}
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { withLayer0, withServiceWorker } = require('@layer0/next/config')

module.exports = withLayer0(
withServiceWorker({
target: 'server',
layer0SourceMaps: true,
})
)
Loading

0 comments on commit 66b2eab

Please sign in to comment.