This package contains the commercial (advertising) code that is loaded on all pages on theguardian.com.
There are 2 packages in this repo:
@guardian/commercial-bundleThe commercial bundle, which is an independent set of javascript files that is loaded on all pages on theguardian.com.@guardian/commercial-coreAn npm package used by other parts of the Guardian codebase, such as DCR.
- Node
- pnpm
- install this via
corepackwhich ships with Node automatically
- install this via
Please use the .devcontainer configuration to open your IDE in an isolated development environment ie. a dev container. You will need to have Docker installed (or at least have a Docker daemon running). See documentation available at https://github.com/guardian/devenv for extra information and help with development containers.
When updating the devenv.yaml file, ensure that you regenerate the resulting devcontainer.json files by running devenv generate.
Your IDE should prompt you to rebuild your dev container when this is done.
All usual commands should be available from within the dev container.
To install dependencies, run pnpm i.
@guardian/commercial-bundle and @guardian/commercial-core are deployed separately.
@guardian/commercial-bundle is deployed to PROD automatically when merged to main. It does not use changesets.
@guardian/commercial-core is published as an npm package and uses changesets, if you've made changes to this package, you will need to ensure you have added a changeset before merging your PR.
A commercial-dev team member will then need to merge the changeset PR to release the new version.
Testing GitHub workflows locally allows developers to validate and debug CI/CD pipeline changes before pushing to GitHub, eliminating the need for trial-and-error commits.
- Install act:
brew install act - Install docker:
- Via terminal:
brew install docker - Docker Desktop (optional): https://www.docker.com/
- Via terminal:
To simulate a workflow trigger such as a push or pull request, run act push or act pull_request, etc. Documentation for using act can be found on the website: https://nektosact.com/usage/index.html.
- If you encounter issues running act that may be associated with your hardware, try specifying the container architecture:
act [action] --container-architecture linux/amd64 - You may be required to install a large GitHub actions docker image on first use. If so, the medium build option will suffice.
- Running docker desktop or
docker pswill give you an overview of the containers created to run your workflows.