# Songwhip Packages

A pnpm-powered monorepo containing shared Songwhip packages.

## Getting Started

```sh
# at the root of the repo
pnpm install
```

### Build everything

```sh
# at the root of the repo
pnpm build
```

### Run all tests

```sh
# at the root of the repo
pnpm test
```

### Format and fix issues

```sh
# at the root of the repo
pnpm fix
```

### Run tests in watch mode

To run tests in watch mode for a specific package:

```sh
pnpm test:unit --project @theorchard/songwhip-utils --watch
# or navigate to the package directory:
cd packages/songwhip-utils-express
pnpm test:unit --watch
```

## Publish packages

Packages are published to the **GitHub Packages** registry (`npm.pkg.github.com`) using a Jenkins pipeline.

### How to publish a package new version

1. **New Branch**: Create a new local branch for your changes.
2. **Make Changes**: Implement your changes in the relevant package(s).
3. **Create Changeset**: Run the following command to create a changeset: 
   `pnpm new-version`. Follow the prompts to describe your changes and specify version bumps.
4. **Commit Changes**: Commit the changeset file(s) along with your code changes.
5. **Push Branch**: Push your branch to the remote repository.
6. **Open PR**: Open a Pull Request against the `master` branch.
7. **Merge PR**: Once the PR is approved and merged, the Jenkins pipeline will automatically publish the new package versions based on the changesets.

### Versioning
This monorepo uses independent versioning for each package. 
A package that depends on another package in the monorepo should generally use peer dependencies to avoid version conflicts / duplication.
When publishing, ensure that the versions of interdependent packages are compatible.

- **Major**: breaking API changes (removed or renamed exports, behavior shifts requiring consumer updates), or migrations to new runtimes/configs.
- **Minor**: backward-compatible additions (new exports, options, feature flags that default to existing behavior).
- **Patch**: bug fixes, non-breaking refactors, dependency bumps that keep the public API stable, and documentation-only updates.


