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.
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
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
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 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
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