Skip to content

Latest commit

 

History

History
95 lines (62 loc) · 2.18 KB

README.md

File metadata and controls

95 lines (62 loc) · 2.18 KB

Munksnäs Spejarna web site

This is the web site for the scout group Munksnäs Spejarna. It is located at www.munksnasspejarna.fi. The site is created using Next.js with Contentful as a CMS. It is deployed to Vercel.

Development with Vercel CLI

Using the Vercel CLI is currently only available to Joakim, as the project uses the free single-user Hobby plan.

Install the Vercel CLI:

npm i -g vercel

Login to Vercel:

vercel login

Link the project:

vercel

Download the environment variables:

vercel env pull

Run the development server:

vercel dev

Development without the Vercel CLI

Create an .env file with the following environment variables, which you can get from Joakim.

CONTENTFUL_SPACE_ID=<space_id>
CONTENTFUL_ACCESS_TOKEN=<access_token>
CONTENTFUL_PREVIEW_ACCESS_TOKEN=<preview_access_token>
CONTENTFUL_PREVIEW_SECRET=<preview_secret>

Run the development server:

pnpm dev

Deployments

To deploy to a preview environment run:

vercel deploy

To manually deploy to production run:

vercel deploy --prod

A new production deployment is done automatically whenever code is pushed to the master branch on GitHub.

A webhook is also configured in Contentful so that a production deployment is done whenever there are changes in the content.

Contentful

Contentful types are automatically generated and are located in the src/contentful/types directory. To generate types, first create a personal access token in the Contentful app. You can then run:

export CONTENTFUL_MANAGEMENT_ACCESS_TOKEN=<token>
pnpm generate-contentful-types

Tests

Playwright is used for end-to-end testing. Playwright tests are run automatically after a PR is deployed to a preview environment. To run the tests locally:

pnpm test

See the Playwright CLI docs for options. For example, to run a single test in debug mode for Chromium only:

pnpm playwright test --debug --project=chromium