6.5.1 • Published 1 year ago

@equinor/ioc-pb-common-frontend v6.5.1

Weekly downloads
40
License
MIT
Repository
github
Last release
1 year ago

ioc-pb-common-frontend

NPM library for shared frontend code to be used by applications maintained by the IOC Prevent Breakdowns (PB) team.

Viewing and testing the content in storybook

The components created in this library should all be viewable and testable in storybook, locally (with yarn start, or yarn storybook) and in github pages.

Viewing storybook in github pages

In the github repo, in the upper right hand side under About, there is a link to the github pages where the library's components that are in the last released version are shown.

Making changes to the library

When adding a new export, make sure the folder it is in contains an index.ts file which is exporting that component, and that every folder upwards in the structure is exporting from the folders it contains.

Committing with commitizen and semantic versioning

Run git add .

and

git commit -m "my commit message"

as you normally would. When committing, you will be prompted to choose what type of commit it is by commitizen (e.g. feat, fix, chore etc) and provide other info for the change log.

Then run

git push

Creating a beta or alpha version and consuming it

You can create a beta or alpha version by pushing the commit to a branch named 'beta' or 'alpha' respectively.

To consume these check the name of the version that gets created in https://www.npmjs.com/package/@equinor/ioc-pb-common-frontend .

It will be something along the lines of '1.0.1-beta.1".

Install it using

yarn add @equinor/ioc-pb-common-frontend@1.0.1-beta.1

Testing the library locally with yarn symlink

When you have made changes to the library and want to test it via an app you also have locally. By using yarn's symlink support this is fairly easy.

In your package

In your package you want to link, enter this command:

yarn link

If your package is already registered you can skip this step, however, if you have a package with the same name registered, you have to unregister before you can do this step. To unregister, simply run:

yarn unlink

Now you can make sure that the package is build everytime you make a change to your code:

yarn dev

In your app you want to test the package

In your app you can link your package by running:

yarn link [package-name]

Now you can use it just like you would any library.

Update libraries to match pb frontend, or in both places.

Potential issues: yarn link dosen't link correctly

The yarn link [package-name] command writes in a line in your package.json file where it tells yarn/npm that a package has an exception to importing the package. Make sure that the names and the path are correct. It should be something like this

"resolutions": { @equinor/ioc-pb-common-frontend: "portal:path/to/the/package/repo/ioc-pb-common-frontend" }

Add the private flag if you do not have user rights cross domain yarn link -p [package-name]

Potential issues: Invalid Hook Call

You may get an error 'Invalid Hook Call Warning'. If you get this, from your library project folder run

npm link ../myapp/node_modules/react

substituting 'myapp' for the name of your app. See https://reactjs.org/warnings/invalid-hook-call-warning.html for more information.

Testing the library locally with yarn build

An alternative way of testing the library locally is by building the library locally and referring to this directly in package.json of the app you wish to test it in. This is however a very slow approach; for any changes to show up it requires a new build and install, which can take 5-10 mins.

How to:

  1. In the app you wish to test new library changes in, go into package.json and set "@equinor/ioc-pb-common-frontend": "../../ioc-pb-common-frontend" (make sure you dont commit this change - it is only for testing locally)
  2. In ioc-pb-common-frontend terminal: run "yarn build"
  3. In app terminal: run "yarn" (this is the really slow one - and it looks like it's stuck and not doing anything. Have patience, go grab a coffee and wait 5-10 mins)

When you make changes to the npm package, you will have to repeat steps 2 + 3 in order to see those changes take effect in your app again.

Troubleshooting common issues

Github pages isnt updating to changes made in main

Github pages seems to randomly stop working. If it doesn't update with the newest changes, try the following:

  1. In the github repo, go to the Settings tab, then in the left hand menu, within Code and Automation, go to Pages.
  2. Source should be set to a branch called gh-pages, with folder root.
  3. Change Source to main branch. Wait a few minutes then check the github pages page to see that it is now showing this readme file instead of storybook.
  4. Change Source back to gh-pages branch. Wait a few minutes, then check to see that it is now showing storybook again, with all the latest and greatest components.
5.3.3

2 years ago

6.1.0

2 years ago

6.5.0

2 years ago

6.2.0

2 years ago

6.3.0

2 years ago

6.0.0

2 years ago

6.4.0

2 years ago

5.3.2-beta.3

2 years ago

5.3.2-beta.2

2 years ago

6.5.1

1 year ago

6.2.0-beta.1

2 years ago

5.3.2

2 years ago

5.3.1

2 years ago

5.3.0

2 years ago

5.1.0

2 years ago

4.16.2

2 years ago

5.0.0-beta.6

2 years ago

5.0.0-beta.7

2 years ago

5.0.0-beta.4

2 years ago

5.0.0-beta.5

2 years ago

5.0.0-beta.2

2 years ago

5.0.0-beta.3

2 years ago

5.0.0-beta.1

2 years ago

5.3.1-beta.1

2 years ago

5.3.1-beta.2

2 years ago

5.3.1-beta.3

2 years ago

5.2.0

2 years ago

5.0.0

2 years ago

5.3.2-beta.1

2 years ago

4.16.0

2 years ago

4.16.1

2 years ago

4.15.1

2 years ago

4.14.2

2 years ago

4.14.3

2 years ago

4.15.0

2 years ago

4.14.2-beta.1

2 years ago

4.14.1

2 years ago

4.14.0

2 years ago

4.13.0

2 years ago

4.9.0

2 years ago

4.7.2

2 years ago

4.9.1

2 years ago

4.7.3

2 years ago

4.12.0

2 years ago

4.10.0

2 years ago

4.8.5

2 years ago

4.8.3

2 years ago

4.2.0-beta.2

2 years ago

4.11.0

2 years ago

4.11.1

2 years ago

4.11.2

2 years ago

4.11.3

2 years ago

4.7.1

2 years ago

4.7.0

2 years ago

4.6.2

2 years ago

4.6.1

3 years ago

4.6.0

3 years ago

4.5.0

3 years ago

4.4.0

3 years ago

4.3.0

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.2.0-beta.1

3 years ago

4.1.0

3 years ago

4.1.0-beta.1

3 years ago

4.0.1

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.1.0-beta.1

3 years ago

3.0.0

3 years ago

2.5.0

3 years ago

2.4.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.0.0-beta.2

3 years ago

2.0.0-beta.1

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-beta.3

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.1.0-beta.6

3 years ago

1.1.0-beta.5

3 years ago

1.1.0-beta.2

3 years ago

1.1.0-beta.1

3 years ago

1.1.0-beta.4

3 years ago

1.1.0-beta.3

3 years ago

1.0.1

3 years ago