sync / nextjs-template

Next.js Template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nextjs-template

View the application

Ultra high performance progressive web application built with React and Next.js.

Lighthouse score: 100/100 Lighthouse score: 100/100 Lighthouse score: 100/100 Lighthouse score: 100/100 Lighthouse score: 100/100

This project is using Percy.io for visual regression testing.

Features

  • Progressive web app
    • offline
    • install prompts on supported platforms
  • Server side rendering
  • Next.js 9.x (canary)
  • Webpack 4.x
  • Babel 7.x
  • Now.sh 2.x
  • Yarn (monorepo with workspaces)

Things to know

  • A production build is deployed from a merge to master
  • A staging build is deployed from a PR against master

Setting up the project locally

First of all make sure you are using node 10.15.3 (any node 10.x would also do) and latest yarn, you can always have a look at the engines section of the package.json. Why node 8.10. We are using Now.sh to make the app available online and underneath it's using AWS lambda and you have to use Node 8.

$ yarn (install)
$ yarn dev

After doing this, you'll have a server with hot-reloading running at http://localhost:3000.

If you used this template from Github

Make sure you set both scripts as executable

$ chmod +x scripts/deploy-ci.sh
$ chmod +x workflows/action-puppeteer/entrypoint.sh

Run tests and friends

We don't want to use snapshots, we use also use react-testing-library to avoid having to use enzyme and to enforce best test practices.

$ yarn format
$ yarn typecheck
$ yarn lint
$ yarn test

or

$ yarn ci

End to end tests

We use cypress. Please check e2e for more details. If you wan to add a new test use the following command and wait for cypress to open

yarn e2e-build
yarn start
yarn workspace @dblechoc/e2e cypress open

Storybook

This is where we list all our components (comes with hot reloading)

$ yarn storybook

After doing this, you'll have a showcase page running at http://localhost:6006

CI

We are using Github Actions.

Next maintenance

All the documenation is located here: https://nextjs.org/docs/#setup

Now maintenance

All the documentation is located here: https://zeit.co/docs

# Install
$ curl -sfLS https://zeit.co/download.sh | sh

Useful commands

# check all running instances
$ now ls

# check logs for a given instance
$ now logs nextjs-template.now.sh --all

# check all alias (running instances to nextjs-template.now.sh)
$ now alias ls

About

Next.js Template


Languages

Language:JavaScript 45.3%Language:TypeScript 35.8%Language:Dockerfile 11.9%Language:Shell 5.0%Language:CSS 1.9%