npm package: @skillswaveca/nova-shared-libraries
Description: A monorepo of shared libraries for Nova projects.
Author: SkillsWave
Latest version: 5.1.0

<p align="center">
  <img src="https://github.com/SkillsWave/nova-shared-libraries/assets/1350855/3e7683f6-227c-4948-aaed-b9ee4d2400d7" width="400"/>
</p>

# Nova shared libraries
This repository contains a collection of shared libraries used across the Nova ecosystem. These libraries are designed to be used across multiple projects and are intended to simplify the development process.

## Usage
This package is published to npm. You can include it in your project by adding
```json
    "@skillswaveca/nova-shared-libraries": "^5.0.0",
```
to your projects `package.json` or by running `npm install @skillswaveca/nova-shared-libraries`

## Installation
This nova shared repository is a monorepo, which means that it contains multiple packages. It uses pnpm, so you will need to install that first
```bash
npm install -g pnpm
```
Once installed you can install the dependencies of the repository by running the following command:
```bash
pnpm install
```
## Library documentation
You can find the documentation in the github pages of this repository. [Here](https://ubiquitous-adventure-vyvnmlw.pages.github.io/)

If you want to generate the documentation for a single package you can run the following command:
```bash
pnpm run generate-docs --filter <package-name>
```

While it is not necessary to generate docs yourself as the CI will do it for you, you can aggregate the documentation of all the packages by running the following command:
```bash
pnpm run aggregate-docs
```

To view the generated documentation locally, run:

```bash
pnpm run docs
```

This will build the docs and start a local server (using sirv) at `http://localhost:8080` (or next available port).

## Testing
You can run all tests by running
```bash
pnpm -r test
```

Or you can run tests for an individual workspace by running
```bash
cd packages/{packageToTest}
pnpm run test
```

## Developing locally
If you want to change this package simultaneously with a related Nova repo, you can do that using `npm link` ([docs](https://docs.npmjs.com/cli/v10/commands/npm-link)).

The basic steps are:
1. At the root of this repo, run `npm link`
2. Go to the repo you are working on and run `npm link @skillswaveca/nova-shared-libraries`
3. Any changes you make in `@skillswaveca/nova-shared-libraries` should be automatically included in the repo.

## Adding a library to the repository
This repository contains a helper script for creating new libraries. You can run the following command to create a new library:

```bash
pnpm run create-library
```

After running the create-library script, you will be prompted to enter the name of the library you want to create and the description. The script will then create a new directory with the name you provided and will initialize a new package inside it.

```bash
> nova-shared-libraries@1.0.0 create-library
> node ./scripts/create-library.js

Enter the package name: nova-model
Enter the package description: A library for defining models in the nova ecosystem
```

## Release Process

This repository uses [semantic-release](https://github.com/semantic-release/semantic-release) to automate versioning and releases. When you merge to `main`, the release workflow automatically:

- Analyzes commit messages to determine the version bump
- Generates CHANGELOG.md
- Creates a GitHub release
- Publishes to npm

### Commit Message Format

Use [Conventional Commits](https://www.conventionalcommits.org/) format to trigger the correct version bump:

#### Patch Release (x.x.X) - Bug Fixes

```bash
git commit -m "fix: correct logging output format"
git commit -m "fix(drivers): handle null response from API"
```

#### Minor Release (x.X.0) - New Features

```bash
git commit -m "feat: add new authentication method"
git commit -m "feat(router): support custom middleware validation"
```

#### Major Release (X.0.0) - Breaking Changes

Use `BREAKING CHANGE:` in the commit body or footer:

```bash
git commit -m "feat!: update to ESLint 9

BREAKING CHANGE: Migrated to ESLint 9 flat config format.
Projects using this library will need to update their ESLint configuration."
```

Or use the `!` suffix on the type:

```bash
git commit -m "feat!: remove deprecated API methods"
git commit -m "refactor!: change logger interface"
```

#### Other Commit Types (No Release)

These don't trigger a release:

```bash
git commit -m "chore: update dependencies"
git commit -m "docs: fix typo in README"
git commit -m "style: format code"
git commit -m "test: add unit tests for driver"
git commit -m "refactor: simplify config logic"
git commit -m "ci: update GitHub Actions workflow"
```

### Skipping CI/Release

To skip the release workflow entirely:

```bash
git commit -m "chore: update dev dependencies [skip ci]"
```

### Manual Release

If you need to create a release manually:

1. Update version in all `package.json` files
2. Update CHANGELOG.md
3. Commit with `[skip ci]`
4. Create [GitHub release](https://github.com/SkillsWave/nova-shared-libraries/releases/new)
5. Publish to npm: `pnpm -r publish --access public`