- Clone the repository.
- Run
npm ci
to install dependencies. - All needed environment variables are listed in the .env.example file. To automatically set them fill in a
.env
file following the same structure as the example file.
cp .env.example .env
- Run app in development mode (
npm run dev
).
We use scripted migrations for CMS model changes. Use DatoCMS's scripted migrations guide, to add a migration script and test it.
If you need to make changes to the CMS model you will have to use a sandbox environment:
- Create a new sandbox by forking the primary environment here or by doing
npx datocms environments:fork <primary-env> <new-env>
. DatoCMS has a limit on concurrent sandboxes, if those are occupied check with your teammates to see if any of them can be deleted. - Update the value of
datocmsEnvironment
atconstants.mjs
to<new-env>
- Run the app in development mode (
npm run dev
).
After you are done setting up the sandbox there are 2 ways of creating migrations.
- Create a new migration script using
npx datocms migrations:new 'create <migration name>' --api-token=<YOUR-API-TOKEN>
- Open the file that was just created in the
migrations
folder and write your migrations - Run the migrations on your sandbox environment
npx datocms migrations:run --destination=<new-env> --api-token=<YOUR-API-TOKEN>
- Go to
https://voorhoede-website.admin.datocms.com/environments/<new-env>
and make changes to the models. Make sure you are on the correct sandbox before making changes, the name of the environment should appear on the right of the navbar. - Have the client autogenerate a migration file with all your changes
npx datocms migrations:new addAuthors --autogenerate=<new-env>:<primary-env> --api-token=<YOUR-API-TOKEN>
- Check that the autogenerated file is correct
Once your PR is ready to merge, we have to apply the migrations to DatoCMS's main environment. Follow the following script on your branch, before merging:
- Turn on maintenance mode in DatoCMS
- Apply migrations to a fresh sandbox
- Run
npx datocms migrations:run --destination=<env-name>-deploy --api-token=<token>
to create a fresh fork of the primary environment with the new migrations applied. We use the-deploy
suffix so it's clear it's a deployment environment. - Fill in the required content. Make sure to not enter dummy content, as this environment will go to production!
- Run
- Commit the updated constants.mjs, containing your new environment
- Merge the PR
- Await the production deploy to succeed
- Promote the new environment in DatoCMS
- Turn off maintenance mode
- Once you've made sure everything is in order, you can remove the previous primary environment. Be aware that you forfeit the option to rollback by performing this action.
Key decisions that are made during the course of the project are documented in docs/decision-log/. Please read the log so you understand why decisions are made and document key decisions when you make them.