@ministryofjustice/hmpps-mpop-frontend-components-lib
v0.0.12
Published
MPOP front-end components library
Maintainers
Keywords
Readme
hmpps-mpop-frontend-components-lib
MPoP front-end library
Usage
Installation
npm install @ministryofjustice/hmpps-mpop-frontend-components-libNunjucks setup
The components in this library use custom Nunjucks filters. You must register them with your Nunjucks environment before rendering any components, otherwise you will see a filter not found error.
Call mpopNunjucksSetup once when configuring your application:
import nunjucks from 'nunjucks'
import { mpopNunjucksSetup } from '@ministryofjustice/hmpps-mpop-frontend-components-lib'
const env = nunjucks.configure([...])
mpopNunjucksSetup(env)SCSS
Import the component styles in your SCSS entry point:
@import '@ministryofjustice/hmpps-mpop-frontend-components-lib/dist/all';Releasing
This package is published to npm using GitHub Releases and npm Trusted Publishing.
You can view the npm page for this package here https://www.npmjs.com/package/@ministryofjustice/hmpps-mpop-frontend-components-lib
Pre-requisites
Ensure GitHub CLI (gh) is installed and authenticated
gh auth status || gh auth login
Release process
Create a unique branch name from the latest
mainand update the package version, such as:git checkout main git pull git checkout -b chore/bump-package-version-<version> npm version patch --no-git-tag-versionAlternatively:
npm version minor --no-git-tag-version npm version major --no-git-tag-versionCommit the version change:
git add package.json package-lock.json git commit -m "Bump package version" git push -u origin HEADRaise a pull request and merge it into
main.Ensure your local
mainis up to date, then create a draft GitHub release for the version:git checkout main git pull VERSION=$(node -p "require('./package.json').version") gh release create "v$VERSION" \ --target main \ --title "v$VERSION" \ --generate-notes \ --draftPublish the GitHub release (i.e. mark it as not a draft) to trigger the publish workflow and publish the package to npm.
Notes
- The GitHub release tag should be
v<version>, where<version>matches the version inpackage.json. - The package version must be greater than the latest version published to npm.
- Publishing uses npm Trusted Publishing via GitHub Actions and does not require an npm token.
- If the version already exists on npm, the publish workflow will skip publishing.
