7.5.0 • Published 4 months ago

@vouchfor/uikit v7.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Vouch UIKit

Get Started

Ensure you have node 16 installed on your machine, for example via nvm, run nvm ls to check

nvm ls 16

you should see output if you have the version installed

->     v16.17.1

ensure you have git ssh setup locally before you clone the repo

git clone git@github.com:VouchAU/vouch-uikit-mono.git

install dependencies

cd vouch-uikit-mono
yarn

Storybook

https://uikit-storybook.vercel.app

Storybook is hosted on vercel and deployed automatically via GitHub Action every time changes are merged back to main. Storybook can also be deployed per PR by adding the deploy storybook label on the PR.

Local dev

yarn storybook

build storybook

yarn storybook:build

Playroom

https://uikit-playroom.vercel.app

Playroom is hosted on vercel and deployed automatically via GitHub Action every time changes are merged back to main. Playroom is not intended to be used on it's own because we don't get good autocomplete for web components, and playroom cannot render the svelte components natively.

Instead we have created a Playroom plugin for storybook that will automatically update the rendered web component when any of the story controls change.

Local dev

yarn playroom

build playroom

yarn playroom:build

Build package

Build src/lib production/beta/alpha package, make sure you change version in package.json.

cd packages/uikit
...
yarn package        # production

Test package locally with vouch-app

Once you build the npm package, you can test locally with vouch-app to ensure everything works as expected before publishing to npm

Assuming you build a package according Build package, now you can create a symlink to your local package

cd package
yarn link

you should see this if successfully linked

yarn link v1.22.10
success Registered "@vouchfor/uikit".
info You can now run `yarn link "@vouchfor/uikit"` in the projects where you want to use this package and it will be used instead.
✨  Done in 0.04s.

go to vouch-app-mono folder and switch to the branch you want to test against with then link the local package

cd vouch-app-mono
git checkout VCH-222
yarn link @vouchfor/uikit
yarn dev

Voilà, you are testing your feature branch with the local uikit package and don't forget to roll back after testing

cd  vouch-app
yarn unlink @vouchfor/uikit
...
cd vouch-uikit/package
yarn unlink

Test published package

You can publish an experimental version of the package by adding the publish rc label onto your PR. This will use the commit hash and a prerelease version number to publish onto NPM which you can then install into your application for testing.

This can be important because the published package and the linked package aren't necessarily 100% the same, some functionality is lost during the conversion to web-components:

  • When using a svelte component within another svelte component, you are able to pass $$restProps down to inner DOM elements, this doesn't work when the svelte component is changed into a web-component during build time
  • Using slots is a little weird
    • When using normal svelte components, if you want to style slot contents from the parent component you need to use the :global(<selector>) css selector
    • This style is lost when compiling to web components, but can be regained by changing the :global(<selector>) selector to a ::slotted(<selector>) pseudo element

Purge jsdelivr cache

@vouchfor/uikit is most likely consumed by the latest tag, not version number to ensure clients can always get the latest updates. jsdelivr default has 7 days cache for tag, so we need to purge it to reflect new version number.

Purge specific bundle.js

Our embed code snippet src attribute currently refers to a specific embed bundle js , for example

<script
  type="module"
  crossorigin="anonymous"
  referrerpolicy="no-referrer"
  src="https://cdn.jsdelivr.net/npm/@vouchfor/uikit@latest/embed/vouch-embed-inline-player.bundle.js"
></script>
<div>
  <vouch-embed-inline-player
    showname="true"
    showlogo="true"
    showcaption="true"
    showcontrol="true"
    autoplay="true"
    showwatermark="true"
    vouchid="u0Q37yiavT"
    apikey="6YoF1TdME4-DYRTycxZxr7LPSa1VYSz9MJj2ETOQUoOMt4zyLSrfJKSzBzerV"
    orientation="portrait"
  />
</div>

In this case, you will need to purge the bundle file specifically by providing absolute path

https://cdn.jsdelivr.net/npm/@vouchfor/uikit@{env}/embed/{filename}.bundle.js
https://cdn.jsdelivr.net/npm/@vouchfor/uikit@{env}/components/{filename}.bundle.js

for example,

https://cdn.jsdelivr.net/npm/@vouchfor/uikit@latest/embed/vouch-embed-inline-player.bundle.js

Unit test

yarn test

update snapshot

yarn test -u

Releasing

To make sure we are delivering the highest quality software we can, there is a multi-step review and testing process before we go ahead with any release.

  1. Once the feature has been implemented, create a PR and add the deploy storybook label to it, once storybook has been deployed send the link to the stakeholder that is in charge of the feature and get them to review.
    • The deployment URL will be added as a comment to the PR once deployed
  2. Use browserstack (credentials in 1password) to cross-browser test the storybook PR deployment using a wide range of operating systems and browser versions
    • TODO: Figure out what is a reasonable set of browsers to test with
    • TODO: Automated tools for cross browser testing using browserstack
  3. Publish the package as a release candidate by adding the publish rc label to the PR
    • Once published, install the package into the admin app and test the feature there to make sure your changes are working in situ.
    • Create a PR deployment for the admin app using the release candidate package and get stakeholders to review also.
  4. If there are no issues, bump the package to the appropriate version in the PR, then the PR can be merged into main and a regular release can be created using the instructions below
    • TODO: Automate public release

Update vouch-app

@vouchfor/uikit is a dependency of the admin app within vouch-app-mono and vouch-app for embeds and the media player, follow the below steps to publish NPM package and update package.json dependency in vouch-app-mono.

Always use semver for version numbering for main releases

  • Major: Breaking changes
  • Minor: Feature releases
  • Patch: Hotfixes

Because we have a few different environments that the embeds may be fetching from (dev, staging and prod) we have added an env prop to all of the necessary embeds that allows you to choose the environment at run time. This, along with PR releases, removes the need for an alpha and beta package release and will allow us to better automate the release process.

Prod release

You will need to log in vouch-tech on your terminal before publishing, credential is shared via 1Password.

npm login
  1. Make sure you are in packages/uikit directory
  2. Run yarn package
  3. Move to the created package folder
  4. Run npm publish --access public to publish under the latest tag
cd packages/uikit
yarn package
cd package
npm publish --access public

Then, using the same PR in vouch-app-mono that you used to test the experimental version, bump to the now latest version and re-test one final time to make sure everything worked as expected.

If everything works correctly then the PR is ready to be merged, and the CDN cache can be purged to allow for upstream clients using embeds in their apps to receive the new version.

Post release testing

Use this codepen to bump the package version that is downloaded from the CDN and make sure all of the embeds work as expected.

7.5.0

4 months ago

7.4.3

5 months ago

7.4.2

7 months ago

7.4.1

9 months ago

7.4.0

9 months ago

7.3.5

11 months ago

7.3.4

12 months ago

7.3.3

12 months ago

7.3.2

12 months ago

7.3.9

11 months ago

7.3.8

11 months ago

7.3.7

11 months ago

7.3.6

11 months ago

7.3.1

12 months ago

7.3.0

12 months ago

7.2.4

1 year ago

7.1.5

1 year ago

7.2.3

1 year ago

7.2.2

1 year ago

7.2.1

1 year ago

7.2.0

1 year ago

7.0.0

1 year ago

7.0.1

1 year ago

7.1.4

1 year ago

7.1.3

1 year ago

7.1.2

1 year ago

7.1.1

1 year ago

7.1.0

1 year ago

6.0.0

1 year ago

5.13.3

1 year ago

5.13.2

1 year ago

5.13.1

1 year ago

5.13.0

1 year ago

5.14.2

1 year ago

5.14.1

1 year ago

5.14.0

1 year ago

5.8.2

2 years ago

5.8.1

2 years ago

5.9.5

2 years ago

5.9.4

2 years ago

5.9.3

2 years ago

5.9.2

2 years ago

5.9.1

2 years ago

5.9.0

2 years ago

5.10.2

2 years ago

5.10.1

2 years ago

5.10.0

2 years ago

5.11.2

2 years ago

5.11.1

2 years ago

5.11.0

2 years ago

5.12.4

2 years ago

5.12.3

2 years ago

5.12.2

2 years ago

5.12.1

2 years ago

5.12.0

2 years ago

5.8.0

2 years ago

5.3.7

2 years ago

5.4.7

2 years ago

5.4.6

2 years ago

5.4.5

2 years ago

5.4.4

2 years ago

5.4.3

2 years ago

5.4.2

2 years ago

5.5.4

2 years ago

5.5.3

2 years ago

5.5.2

2 years ago

5.5.1

2 years ago

5.5.0

2 years ago

5.6.2

2 years ago

5.6.1

2 years ago

5.6.0

2 years ago

5.7.2

2 years ago

5.7.1

2 years ago

5.7.0

2 years ago

5.3.3

2 years ago

5.3.0

2 years ago

5.4.1

2 years ago

5.4.0

2 years ago

5.1.4

2 years ago

5.1.3

2 years ago

5.2.2

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.3.6

2 years ago

5.3.5

2 years ago

5.3.4

2 years ago

4.5.3

2 years ago

4.4.3

2 years ago

5.0.9

2 years ago

5.0.8

2 years ago

5.0.7

2 years ago

5.0.6

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.10

2 years ago

5.0.0

2 years ago

5.0.11

2 years ago

5.0.12

2 years ago

5.0.13

2 years ago

5.0.14

2 years ago

5.0.15

2 years ago

4.4.5

2 years ago

4.4.4

2 years ago

4.3.2

2 years ago

4.3.1

2 years ago

4.3.0

2 years ago

5.1.2

2 years ago

4.2.2

2 years ago

4.6.1

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.6.6

2 years ago

4.6.3

2 years ago

4.6.2

2 years ago

4.6.5

2 years ago

4.6.4

2 years ago

4.5.0

2 years ago

4.1.4

2 years ago

4.1.3

2 years ago

4.5.2

2 years ago

4.5.1

2 years ago

4.1.5

2 years ago

4.1.0

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.0.5

2 years ago

4.0.4

2 years ago

4.0.6

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

3.10.5

2 years ago

3.10.4

2 years ago

3.11.4

2 years ago

3.11.3

2 years ago

3.11.6

2 years ago

3.11.5

2 years ago

3.11.8

2 years ago

3.11.7

2 years ago

3.11.9

2 years ago

3.10.1

2 years ago

3.10.0

2 years ago

3.10.3

2 years ago

3.10.2

2 years ago

3.11.0

2 years ago

3.11.2

2 years ago

3.11.1

2 years ago

3.11.11

2 years ago

3.11.10

2 years ago

3.11.12

2 years ago

3.9.8

2 years ago

3.9.7

2 years ago

3.9.6

2 years ago

3.9.5

2 years ago

3.9.4

2 years ago

3.9.3

2 years ago

3.9.2

2 years ago

3.9.1

2 years ago

3.9.0

2 years ago

3.7.2

2 years ago

3.4.0

2 years ago

3.8.0

2 years ago

3.6.2

2 years ago

3.6.1

2 years ago

3.6.0

2 years ago

3.4.1

2 years ago

3.8.1

2 years ago

3.7.1

2 years ago

3.7.0

2 years ago

3.5.2

2 years ago

3.5.1

2 years ago

3.5.0

2 years ago

2.4.0

2 years ago

2.6.0

2 years ago

2.8.1

2 years ago

2.8.0

2 years ago

3.2.2

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

2.9.2

2 years ago

2.9.1

2 years ago

3.0.0

2 years ago

2.5.0

2 years ago

2.7.0

2 years ago

2.9.0

2 years ago

2.7.1

2 years ago

3.3.1

2 years ago

3.3.0

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.3.2

2 years ago

2.8.2

2 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.2.1

3 years ago

2.2.2

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.2

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.6.2

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.2.0

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.4.2

3 years ago

1.1.5

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.3.2

3 years ago

1.1.4

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.1.3

3 years ago

1.3.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago