npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@govuk-one-login/di-ipv-cri-common-express

v8.0.3

Published

Express libraries and utilities for use building GOV.UK One Login Credential Issuers

Downloads

1,736

Readme

ipv-cri-common-express

GitHub Action: Scan repository Coverage

ipv-cri-common-express contains Express libraries and utilities for use for building GOV.UK One Login Credential Issuers

It provides functionality for use with an Express webserver, GOV.UK Design System and the HMPO Components library

It was originally created in order to share code between Credential Issuers in a prescribed but abstract way. The use of shared code then allows the Credential Issuers to solely focus on whatever the specific screens and interactions that are required as part of their use case.

This package contains:

  • assets
    • JavaScript used for progressive enhancement
  • components
  • lib
    • Express middleware
  • routes
    • Express router to handle common OAuth functionality
  • scripts
    • checkTranslations script used to ensure localisation files are kept synchronised

The combination of components, middleware, routing and utility scripts into a single package has resulted in a slightly muddled approach to how this package is used and maintained. Work towards splitting this up into individual specific packages has already started, beginning with replacing the JavaScript inside the assets folder with @govuk-one-login/frontend-analytics

GA4 and the Crown Logo

The implementation of GA4 and the Crown Logo update are contained across multiple versions of common-express in various stages. See below for details:

5.1.0

  • Contains the flag to activate the new crown logo set to true ready for go-live of that feature

Environment Variables

Several environment variables are declared within the CRIs and then used within the shared code of this repository:

  • GA4_ENABLED - Feature flag to enable GA4, defaulted to "false"
  • UA_ENABLED - Feature flag to enable UA, defaulted to "false"
  • UA_CONTAINER_ID - Container ID for Universal Analytics, required for UA to work correctly. Default value is GTM-TK92W68
  • GA4_CONTAINER_ID - Container ID for GA4, required for analytics to work correctly. Default value is GTM-KD86CMZ
  • ANALYTICS_COOKIE_DOMAIN - Cookie domain to persist values throughout the different sections of the OneLogin journey. Default value is localhost
  • ANALYTICS_DATA_SENSITIVE - Redacts all form response data, defaulted to "true". Only to be set to "false" if a journey section contains no PII in none text based form controls
  • GA4_PAGE_VIEW_ENABLED - Feature flag to enable GA4 page view tracking, defaulted to "true"
  • GA4_FORM_RESPONSE_ENABLED - Feature flag to enable GA4 form response tracking, defaulted to "true"
  • GA4_FORM_ERROR_ENABLED - Feature flag to enable GA4 form error tracking, defaulted to "true"
  • GA4_FORM_CHANGE_ENABLED - Feature flag to enable GA4 form change tracking, defaulted to "true"
  • GA4_NAVIGATION_ENABLED - Feature flag to enable GA4 navigation tracking, defaulted to "true"
  • GA4_SELECT_CONTENT_ENABLED - Feature flag to enable GA4 select content tracking, defaulted to "true"

Installation

Clone this repository and then run

npm install

Development

Tests

mocha is used as the testing framework.

To run the tests:

npm run test

Linting and code formatting

Linting and code formatting are applied using a combination of prettier, eslint.

These can be run manually using:

npm run lint

Commit Hooks

Linting and code formatting is enforced on commit using pre-commit.

Pre-commit hooks can be run manually using:

pre-commit run --all-files

Note: Husky was previously used, and will need to be de-configured using git config --unset-all core.hooksPath and re-configured using pre-commit install

Release Procedure

Releases are automatically published to npm at @govuk-one-login/di-ipv-cri-common-express using a GitHub action upon creation of an appropriate Git tag.

The previous usage of "govuk-one-login/ipv-cri-common-express.git#v4.0.0" should not be used as this has no support for package building, which will be a requirement with future improemetns

In order to prepare a new release

  1. git checkout a fresh copy of the main branch
  2. create a separate branch for the version to be updated to (e.g. chore/release/v1.2.3
  3. Run npm version VERSION --no-git-tag-version, changing VERSION to be major, minor or patch as required
    • Once this has been run, the package.json and package-lock.json files will be updated with the new version.
  4. Create a PR for this change, and get this approved and merged
  5. Once this has been done, a release can be created using GitHub by accessing the releases section.
  6. Choose a new tag matching your version number, prefixed with v to avoid Git reference collisions, e.g. v1.2.3
  7. Click on the "Generate release notes" button to automatically pull in commit messages for the release notes.

Code Owners

This repo has a CODEOWNERS file in the root and is configured to require PRs to reviewed by Code Owners.

Peer Dependencies

This node package includes the initialisation script from the GDS Analytics package (https://www.npmjs.com/package/@govuk-one-login/frontend-analytics).