2.2.14 • Published 10 days ago

@royaloperahouse/chord v2.2.14

Weekly downloads
-
License
MIT
Repository
-
Last release
10 days ago

Royal Opera House Chord - Front End Design System

Welcome to The Royal Opera House Front End Design System, @royaloperahouse/chord

This package is a library of UI components intended to be used in the ROH website.

It uses React, TypeScript, TSDX and Storybook.

The NPM packages are published at https://www.npmjs.com/package/@royaloperahouse/chord

The Storybook for the latest version of the library is hosted at chord.roh.org.uk

Prerequisites


  • Make sure the required package dependencies are installed using yarn install

  • If this is the first time you are working on Chord, make sure to run yarn build to build all the modules.

  • To deploy the storybook publicly you will need credentials for the parent 'Royal Opera House' AWS account in your ~/.aws/credentials file.

    • The deploy script expects these to be called [parent].

    • You can find these values at:

      AWS 'Your Applications' page -> 'Royal Opera House' -> 'Developer Access' -> 'Command line or programmatic access'

  • To deploy a preview for demo / QA you will need the CHROMATIC_PROJECT_TOKEN -- find this in 1Password

  • To publish the NPM package you will need the ROH NPM_TOKEN -- find this in 1Password

Versioning


We use Semantic Versioning for Chord.

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible library changes
  • MINOR version when you add functionality in a backwards compatible manner
  • PATCH version when you make backwards compatible bug fixes

When you create a new release always update the CHANGELOG and package.json

Increment your version from the latest stable version on chord-releases

Deploying the Storybook


1. To build and deploy locally

You can quickly build and serve the contents of /storybook-static from your local machine, for development and manual testing. To do this run:

yarn storybook

By default the storybook will be accessible at http://localhost:6006/

The server will hot-reload on most changes.

2. To deploy a preview version remotely

You can deploy a release candidate, or work-in-progress to Chromatic for showcase or QA.

NOTE: you will need the CHROMATIC_PROJECT_TOKEN as described in Prerequisites above.

Either set the token as a shell variable or use a .env file in the chord root directory containing the token, as so:

CHROMATIC_PROJECT_TOKEN=tokengoeshere

Run:

yarn deploy-storybook-dev

to build and deploy the storybook from your repo to Chromatic.

You will find the address of your deployed storybook in the console output, looking something like this:

→ View your Storybook at https://randomHexString-randomAlphabeticalString.chromatic.com

3. To deploy a release version

You can deploy the contents of ./storybook-static to S3 as a static site, which is permanently accessible at chord.roh.org.uk

NOTE: To do this you will need the correct AWS credentials set up, as described in Prerequisites above.

First build the storybook using:

yarn build-storybook

then run:

yarn deploy-storybook

IMPORTANT: This URL is intended to showcase the latest stable version of Chord, it should be kept up to date with the main chord-releases branch and should only be used for release versions. If you want to deploy a development version follow the steps above under To deploy a preview version remotely.

Releasing a New Package Version


This is the procedure for releasing a new Chord NPM package.

There are two types of package:

A snapshot can be published to use a development version of the Chord library in our frontend staging environments, to perform integrated, manual testing.

A stable package is published for use in production.

NOTE: You will need the NPM_TOKEN, as described in 'Prerequisites' above.

1. To release a snapshot version

IMPORTANT: Make sure you always publish your snapshots from chord-development after merging in your feature branch.

For snapshots, RELEASE_VERSION should be the same as the latest stable version of the Chord Library, as found in chord-releases, followed by an unused lowercase letter.

For example, if the latest stable release was 1.42.0, and the last snapshot published to NPM was 1.42.0-w, you would use RELEASE_VERSION 1.42.0-x

To publish a snapshot use:

NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-snapshot

The version published to NPM will be named, e.g. 1.42.0-a-chord-development, use this to install the snapshot package in the frontend repos.

2. To release a stable version

IMPORTANT: Make sure you always publish your stable packages from chord-releases after merging in your feature branch.

For stable releases, increment your version from the latest stable version found on chord-releases, following the rules described in Versioning above, and use this as RELEASE_VERSION. (Make sure it matches the version in your package.json and CHANGELOG.md!)

To publish a stable package use:

NPM_ROH_TOKEN={NPM_TOKEN} RELEASE_VERSION={RELEASE_VERSION} yarn publish-release

Using the Package


The package is deployed to NPM, and can be installed using yarn or npm:

npm i --save @royaloperahouse/chord
yarn add @royaloperahouse/chord

Testing


To Lint the package use:

yarn lint
# Use the --fix option to perform automatic fixes

To run the unit tests (using Jest) use:

yarn test

# Use the -u option to update snapshots if needed
# Run `yarn test:watch` to re-run tests on changes

To run and and store the unit tests for display in storybook use:

yarn test-storybook
# Use the -u option to update snapshots if needed

Development Process


1. Branching Model

  • The Chord project lives in the roh-components monorepo
  • When working on Chord, treat the roh-components/packages/chord directory as your root
  • The Chord development branch is currently chord-development
  • The Chord main branch is currently chord-releases
  • All work should be done on a correctly named feature branch of the format: issueType/ticketNumber-short-description-of-feature, e.g. feature/RD-1234-update-chord-documentation
  • Always create your feature branch FROM, and submit pull requests TO, the main branch
  • For QA / UAT of a Chord component in isolation: following review you should deploy a preview version to Chromatic straight from your feature branch without merging to development
  • For releasing an NPM snapshot: merge your feature branch into the development branch and publish the NPM snapshot from there

2. Detailed Workflow

Before review:

  • Git pull the latest version of chord-releases
  • Checkout a new, correctly-named feature branch from chord releases
  • Do your work on this feature branch
  • Run: yarn lint
  • Run: yarn test
  • Commit your changes
  • Create a pull request from your feature branch to chord-releases
  • Add the appropriate reviewers

Before QA / UAT:

After your PR is approved, you have two options:

i. For QA of a component in isolation:

  • Follow the steps above in Deploying the Storybook -> 2. Deploying a preview version remotely
  • Share the generated Chromatic URL with the appropriate people for QA / UAT

ii. For integrated testing of a component in the frontend staging environments:

  • Check out the chord-development branch
  • Merge your work in to chord-development
  • Follow the steps above under Publishing a New Package Version -> 1. To release a snapshot version
  • Git push the updated chord-development branch to remote
  • Finally, in the frontend repo:
  1. Update the package.json to reference the new snapshot version
  2. Run: yarn install
  3. Deploy the frontend to a staging environment

When ready for production:

  • Return to your chord feature branch
  • Update the chord version in package.json, incrementing from the last stable release, found in chord-releases, and following the rules described in the Versioning section
  • Update CHANGELOG.md, adding the new version number and a short description of your changes
  • Run: yarn lint
  • Run: yarn test
  • Run: yarn test-storybook -u
  • Run: yarn build-storybook
  • Git commit, push, and update your PR for final approval
  • Merge your approved PR to chord-releases
  • Follow the steps in Publishing a New Package Version -> 2. To release a stable version to publish the NPM package
  • Finally, follow the steps in Deploying The Storybook -> 3. To deploy a release version, to update the public Chord Storybook page

Once you have successfully published a new release version, you can open a ticket to update to this version in any of the frontend repos.

Notes


The storybook-static folder

This folder contains all the HTML / JS required to deploy the Storybook as a static site. It's autogenerated whenever the Storybook is built and therefore will show up a lot of merge conflicts when you merge other branches into your feature branch. It is best to leave generating the storybook until the later part of your workflow, but in case you run into conflicts earlier, it's ok to just delete the folder and regenerate using:

yarn build-storybook

For the same reason changes to this folder will cause a lot of big diffs, when looking at a PR, but can mostly be skimmed over unless something looks unusual.


Examples

There is an example implementation in the example folder. Alternatively there are also integration examples in storybook. Make sure to keep these updated so as to showcase the current components available.


Bundle analysis

Calculate the real cost of your library using size-limit with yarn size and visualize it with yarn analyze.

2.2.14

10 days ago

2.2.13

1 month ago

2.2.12

1 month ago

2.2.11

1 month ago

2.2.10

2 months ago

2.2.9

2 months ago

2.2.8

2 months ago

2.2.7

2 months ago

2.2.6

2 months ago

2.2.5

2 months ago

2.2.4

3 months ago

2.2.3

3 months ago

2.2.2

4 months ago

2.2.1

4 months ago

2.2.0

5 months ago

2.1.10

5 months ago

1.2.10

5 months ago

2.1.4-c

7 months ago

2.1.2

8 months ago

2.1.1

8 months ago

2.1.4

7 months ago

2.1.3

7 months ago

2.1.6

7 months ago

2.1.5

7 months ago

2.1.8

6 months ago

2.1.7

7 months ago

2.1.0

9 months ago

1.24.1

10 months ago

1.24.2

10 months ago

1.25.0

10 months ago

1.25.1

10 months ago

1.25.2

10 months ago

2.1.9

6 months ago

1.26.0

10 months ago

1.27.0

10 months ago

1.27.1

9 months ago

1.28.0

9 months ago

1.24.0

11 months ago

1.23.2

11 months ago

1.18.3

12 months ago

1.21.0

12 months ago

1.21.1

12 months ago

1.21.2

11 months ago

1.19.0

12 months ago

1.22.0

11 months ago

1.22.1

11 months ago

1.23.0

11 months ago

1.23.1

11 months ago

1.20.1

12 months ago

1.20.2

12 months ago

1.20.0

12 months ago

1.18.0

1 year ago

1.18.2

1 year ago

1.13.2

1 year ago

1.13.1

1 year ago

1.13.0

1 year ago

1.14.0

1 year ago

1.15.0

1 year ago

1.15.1

1 year ago

1.16.0

1 year ago

1.17.0

1 year ago

1.12.3

1 year ago

1.12.2

1 year ago

1.12.1

1 year ago

1.12.0

1 year ago

1.12.4

1 year ago

1.11.0

1 year ago

1.6.4

1 year ago

1.6.3

1 year ago

1.6.2

1 year ago

1.9.0

1 year ago

1.10.0

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.2.0

2 years ago

0.7.441

2 years ago

1.6.1

1 year ago

1.6.0

1 year ago

1.1.0

2 years ago

1.5.0

1 year ago

0.8.0

2 years ago

1.4.0

1 year ago

0.9.0

2 years ago

1.3.1

1 year ago

1.3.0

2 years ago

0.7.49

2 years ago

0.7.46

2 years ago

0.7.48

2 years ago

0.7.47

2 years ago

0.7.33

2 years ago

0.7.32

2 years ago

0.7.35

2 years ago

0.7.34

2 years ago

0.7.37

2 years ago

0.7.36

2 years ago

0.7.39

2 years ago

0.7.38

2 years ago

0.7.44

2 years ago

0.7.43

2 years ago

0.7.45

2 years ago

0.7.40

2 years ago

0.7.42

2 years ago

0.7.41

2 years ago

0.7.31

2 years ago

0.7.30

2 years ago

0.7.22

2 years ago

0.7.24

2 years ago

0.7.23

2 years ago

0.7.29

2 years ago

0.7.26

2 years ago

0.7.25

2 years ago

0.7.28

2 years ago

0.7.27

2 years ago

0.7.21

2 years ago

0.7.20

2 years ago

0.7.19

2 years ago

0.7.18

2 years ago

0.7.15

2 years ago

0.7.14

2 years ago

0.7.17

2 years ago

0.7.16

2 years ago

0.7.11

2 years ago

0.7.13

2 years ago

0.7.12

2 years ago

0.5.10

2 years ago

0.5.11

2 years ago

0.7.2

2 years ago

0.5.4

2 years ago

0.7.1

2 years ago

0.5.3

2 years ago

0.7.4

2 years ago

0.5.6

2 years ago

0.7.3

2 years ago

0.5.5

2 years ago

0.7.0

2 years ago

0.7.10

2 years ago

0.7.9

2 years ago

0.7.6

2 years ago

0.5.8

2 years ago

0.7.5

2 years ago

0.5.7

2 years ago

0.7.8

2 years ago

0.7.7

2 years ago

0.5.9

2 years ago

0.6.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.9

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.1

2 years ago

0.2.6-b

2 years ago

0.3.0

2 years ago

0.2.6-a

2 years ago

0.2.6

2 years ago

0.2.1-RD-7070

2 years ago

0.2.3-beta

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago