diff --git a/README.md b/README.md index 1e09b23ec..b24660329 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,15 @@ This package contains the code for the commercial bundle that is loaded on all pages on theguardian.com. +There are 2 main parts to this repo: +- The commercial bundle itself, which is a set of javascript files that is loaded on all pages on theguardian.com. +- Some modules that are imported used by other parts of the Guardian codebase, such as DCR. This is published as a package to npm, `@guardian/commercial`. + +The exported modules are in `src/core`, everything else is part of the commercial bundle. + ## Installation -To install the package, run `yarn add @guardian/commercial`. +To install the npm package, run `pnpm i @guardian/commercial`. ## Development @@ -19,9 +25,9 @@ To install the package, run `yarn add @guardian/commercial`. To install dependencies, run `pnpm`. -To develop locally, run `pnpm serve` to start a local server. This will watch for changes and rebuild the bundle. Serving it at `http://localhost:3031`. +To develop locally on the bundle, run `pnpm serve` to start a local server. This will watch for changes and rebuild the bundle. Serving it at `http://localhost:3031`. -### Releasing +### Releasing to NPM This repository uses [changesets](https://github.com/changesets/changesets) for version management @@ -29,23 +35,6 @@ To release a new version with your changes, run `pnpm changeset add` and follow When your PR is merged, changeset will analyse the changes and create a PR to release the new version. -### Bumping @guardian/commercial in Frontend -Run [this script](./scripts/bump_commercial.sh) to raise a PR that bumps `@guardian/commercial` in Frontend to the specified version. - - -Execute the script as follows: - -```bash -./scripts/bump_commercial.sh [VERSION_NUMBER] -``` - -Eg -```bash -./scripts/bump_commercial.sh 11.11.1 -``` - -This will automatically create a pull request in the Frontend repository. - ### Pull requests Try to write PR titles in the conventional commit format, and squash and merge when merging. That way your PR will trigger a release when you merge it (if necessary). @@ -100,6 +89,13 @@ To test the bundle on CODE, create a PR, wait for github actions to run and a ri Although technically we don't need to "take" Frontend or DCR CODE environments anymore, it may be a good idea to claim it any way if your change may break things and cause an issue for another developer testing their changes. +#### Testing changes to the `@guardian/commercial` npm package +You can add the [beta] @guardian/commercial label to your pull request, this will release a beta version of the bundle to NPM, the exact version will be commented on your PR. + +In order to do this, first run: pnpm changeset add, again, This will create a new changeset file in the .changeset directory. Commit this file with your PR. + +Note: Once the beta version is released, the label will be removed from the PR, so you will need to add it again if you want to release subsequent new versions. + ### Deploying to PROD When you merge to main the commercial bundle will be deployed automatically and should be live within a few minutes.