Skip to content

PrideInLondon/pride-london-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Pride in London website 🌈

Netlify Status
CircleCI
CodeFactor DeepScan grade CodeQL
Language grade: JavaScript Total alerts
GuardRails badge
codecov
Quality Gate Status

This project is a community effort to provide the Pride in London website. The project is written in JavaScript/TypeScript and leverages the Gatsby and React web frameworks.

Developing locally 🎧

Prerequisites 🆕

Prior to getting started with development on this project, there are a few software installations required:

  • node: preferably installed via (nvm)
    • take note of the recommended version defined in the .nvmrc file
  • yarn: installed globally at the latest version
  • gatsby-cli: installed globally at the latest version

Once the repo has been cloned, an environment file is required in the root of the project to supply connections to our upstream systems, e.g. Contentful.

Copy the .env.example file (from the root of the project) to a new file (also at the root of the project) called .env.development:

# run this command in a terminal window from project root
cp .env.example .env.development

Replace the values on the right of the = signs with the following values:

key required default other values description
CONTENTFUL_SPACE_ID yes see Contentful - The Contentful spaceId to target
CONTENTFUL_ACCESS_TOKEN yes see Contentful - The Contentful accessToken for the given host and environment
CONTENTFUL_HOST no cdn.contentful.com preview.contentful.com The Contentful host to retrieve data from
CONTENTFUL_ENV yes master development The Contentful environment to target

More information on what each of these values mean can be found here.

In general, the default values will suffice for development purposes. The host override is useful for when there is the requirement to target draft content (i.e. unpublished content). The environment override is useful for when there is the requirement to target the development version of the content model.

If the app is not reading the content from the correct host or environment, try the following steps:

  • ensure all running app instances are closed between config changes
  • delete the local Contentful cache via the command gatsby clean

Running the development server 🏃

Ensure all the prerequisites mentioned above are installed and set to the recommended versions.

In order to install the dependencies required for the project, open a terminal window at project root and run the following command:

yarn install

Note that this command will require re-running for every update to the yarn.lock file.

In order to run the project, open a terminal window at project root and run the following command:

yarn develop

Running the unit tests ✅

There are a number of unit tests included in the project used to ensure business logic is behaving as expected across the codebase. In order to run these locally, open a terminal window at project root and run the following command:

yarn test

Note that all dependencies must be installed prior to this command being run for the first time. See section above for more information on how to do this.

Building the static site 🛠️

As the site is built using Gatsby, only the static files are served in a production setting. These files can be built locally in order to e.g. debug issues with the deployed site.

In order to achieve this, a .env.production is required in the root of the project. This may be an exact clone of the .env.development file mentioned in the section above.

Prior to running the build command, ensure that all dependencies are installed via the command:

yarn install

Once this has been completed, the build command may be run. This can be done via the command:

yarn build

Resources 📓

There are some resources available in this repo to aid development process:

  • How to guide: a guide for performing common development actions
  • Code of conduct: defines standards for how to engage in the Pride in London community

Contributing 🤝

Want to help out? That's amazing! Please see the roles available on the Pride in London volunteer platform.

License 👔

This project is licensed under the terms of the Apache License 2.0.