https://github.com/ministryofjustice/hmpps-typescript-lib
A set of shared utilities for use with typescript projects
https://github.com/ministryofjustice/hmpps-typescript-lib
hmpps
Last synced: about 2 months ago
JSON representation
A set of shared utilities for use with typescript projects
- Host: GitHub
- URL: https://github.com/ministryofjustice/hmpps-typescript-lib
- Owner: ministryofjustice
- License: mit
- Created: 2024-09-12T13:12:00.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-04-09T14:16:53.000Z (2 months ago)
- Last Synced: 2025-04-09T15:29:56.534Z (2 months ago)
- Topics: hmpps
- Language: TypeScript
- Size: 196 KB
- Stars: 0
- Watchers: 28
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.MD
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# HMPPS typescript library
A set of shared utilities for use with typescript projects.
The `@ministryofjustice/hmpps-typescript-lib` package itself should not be installed.## Using packages in your applications
See individual packages’ README.md
- @ministryofjustice/eslint-config-hmpps – ESLint rules for HMPPS typescript projects
- @ministryofjustice/hmpps-monitoring – Retrieve and display health and status information from external services and internal componentsSome of these will be included in the [template project](https://github.com/ministryofjustice/hmpps-template-typescript)
and would be adopted automatically by new projects.## Development
Sub-packages in this projects are build on node 22 and tested on node 20 and 22.
npm scripts from the root all delegate to sub-packages:
```shell
npm run clean # remove built artefacts
npm run build # build artefacts
npm test # run unit tests
npm run lint # run lint checks
npm run lint-fix # fix lint errors automatically where possible
```… and can be called within packages themselves:
```shell
npm test --workspace packages/monitoring
cd packages/monitoring && npm test
```TODO: document adding a new sub-package
### Publishing process
TODO: document this better once we have trialled it
There is a Github actions pipeline to publish new releases of sub-packages.
When a new version needs to be released, these steps should be followed as part of the usual pull request process…1) Make necessary changes to package(s).
2) Ensure the README.md and CHANGELOG.md files are correct.
3) Update version in package.json for the updated packages, _not_ the root project.
4) Create pull request, get it reviewed and merge into `main`.
5) Create a tag on the `main` branch for the pull request’s squashed merge commit.
The tag name can be in the form `[package]-[version]`, but automation does not rely on this.
So run `git fetch --tags` to get all the existing tags, `git tag` to list the tags and, for example, run
```shell
git tag clients-0.0.1-alpha.6
git push origin tag clients-0.0.1-alpha.6
```
6) On [Github](https://github.com/ministryofjustice/hmpps-typescript-lib/releases), create a new release from this tag.
This kicks off the Github actions pipeline to publish changed packages to npmjs.com and as tarball attachments to the
release itself.TODO: ideally, we would use something like this automatically, however squashing commits leaves the tag dangling
```shell
npm version --workspace [package] [major | minor | prerelease --preid=pre]
```