- Clone the project repository (if possible re-use the same package-lock.json file)
- Use terminal to install or uninstall npm dependencies via
npm i
- Use terminal to run clean install npm dependencies via
npm ci
. Read more npm docs
- Create a .env.development file in this gatsby folder and add the required environment variables as defined in configuration.
The following environment variables are used to configure the gatsby site and source plugin when building the app in the gatsby folder:
Environment variable | Notes |
---|---|
FEED_URL | The absolute base URL of the feed, passed as the feedURL config option to custom gatsby-source-bnf plugin |
FEED_USER_KEY | The API/user key for authentication of the feed. |
GATSBY_SITE | Which site you're building (bnf or bnfc ) |
GATSBY_SEARCH_URL | The single search endpoint base URL e.g. https://[env**]-search-api.nice.org.uk/api |
Note: the variables prefixed with
GATSBY_
are made available to client side scripts so are public values, see the Gatsby docs.
Set these environment variables using .env files.
- Run
npm run build:bnf
ornpm run build:bnfc
to build a specific site
FEED_URL=https://whatever FEED_USER_KEY=abcd1234 GATSBY_SITE=bnfc # Or bnf GATSBY_SEARCH_URL=https://[env**]-search-api.nice.org.uk/api
### Search proxy for CORS issue
If you experience issue where the Search-api typeahead functional-tests step fail locally. Check the steps to resolve
1. Rebuild Gatsby site with envrionment variables. Use single search endpoint base URL that support functional-tests docker compose file
`GATSBY_SEARCH_URL=https://[env**]-search-api.nice.org.uk/api`
View [#configuration](4 above)
Other Read me to check out [Gatsby README file](https://github.com/nice-digital/bnf-gatsby/tree/main/gatsby#readme)