Skip to content

Commit

Permalink
add more detail on bundle vs package
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeii committed Jan 13, 2025
1 parent 3ac9ccf commit ee6893f
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -19,33 +25,16 @@ 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

To release a new version with your changes, run `pnpm changeset add` and follow the prompts. This will create a new changeset file in the `.changeset` directory. Commit this file with your PR.

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).
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit ee6893f

Please sign in to comment.