0.4.46 • Published 4 years ago

@greenhousegroup/shared-ui v0.4.46

Weekly downloads
167
License
MIT
Repository
gitlab
Last release
4 years ago

JARVIS UI

This package contains ready to use React components in the style of JARVIS UI. The project is built based on storybookJS. You can find the online version of the storybook on: https://storybook.jarvis.greenhousegroup.com/

Requirements

To use these components you need to have a font-awesome pro license configured for your solution.

Installation

You can install this packages in your react environment using one of the following commands.

NPM

npm install @greenhousegroup/shared-ui

Yarn

yarn install @greenhousegroup/shared-ui

Using components

Any component seen in the storybook can be imported from the main package. See the following example.

import React from 'react';
import { BasicPage } from '@greenhousegroup/shared-ui';

export default function OverviewPage(): React.ReactElement {
  return (
    <BasicPage title="Example page" crumbs={['Example page']}>
      Content
    </BasicPage>
  );
}

For JARVIS UI Developers

Besides using it in you own project you can also have the need to add new components, or new features to existing

Install

yarn install

Usage

yarn storybook

This will run the storybook application allowing you to view and interact with the individual components.

yarn test

This will run the Jest test framework in watch mode.

yarn test:ui

This will run the UI tests in the Jest test framework. First storybook will start in a new window and the tests will run after that. Be aware that you'll have to close storybook manually afterwards.

yarn lint
yarn lint-style

These will run linting on the code and styling.

Writing tests

Regular tests should be placed in the same folder as the component, name like component.test.tsx. UI tests, any test that uses the browser with tools like selenium of puppeteer should by placed in a UI test file, named like component.test.ui.tsx.

Versioning

We use semantic versioning for this package, with the schema MAJOR.MINOR.PATCH. For more information check out: https://semver.org/

Publishing

  1. Update the CHANGELOG.md with your latest changes
  2. Increase the version (corresponding to the one in the changelog) in package.json
  3. Merge to master branch

The last step of the pipeline, is publishing. Storybook will always be deployed. When you want/need to publish the shared-ui to NPM, you'll manually have to click the play button on the publish-shared-ui-to-npm step.

Using local version in your project

Sometimes you want to debug something locally, without releasing a new version of Jarvis UI every time. There are two ways to do this.

Linking

You can link to the local version using yarn link, follow these steps to get it up and running. 1. Open a command prompt and browse to the root of Jarvis UI. 2. Run yarn link, you should now see a message that a link has been created for "@greenhousegroup/shared-ui". 3. Browse to the root of your project, where you already use the Jarvis UI NPM package. 4. Run yarn link "@greenhousegroup/shared-ui", you should now see a message that the link is being used.

This creates a symbolic link to the build of your local package. Now you can change code in Jarvis UI, run the command yarn build on the Jarvis UI project and you should see the changes in your application.

Be aware

  • You have to build Jarvis UI after every change!
  • After you are done with local development, remove the link by running yarn unlink "@greenhousegroup/shared-ui" followed by a yarn install.

Webpack alias

Webpack alias allows you to point a module resolve to a certain directory. This is the most flexible and efficient way to work on shared UI from your project, but it requires some configuration and can most easily break in the future. But it does not require building, changes reflect instantly in your project.

You should add an module alias to your webpack config, and make sure that your webpack handles typescript. Also make sure any (s)css files are processed without using local modules.

Assuming you have your project in the same folder as Jarvis-UI, you could use the following example which is from webpack.config.dev.js in the Briefing-UI project.

Add this function to the file

function useLocalJarvisUi(config) {
  config.resolve.alias = {
    "@greenhousegroup/shared-ui": path.resolve(__dirname, "../../../../shared-ui/src/"),
  }
  config.module.rules.push({
      test: /\.scss$|\.css$/,
      use: [
        MiniCssExtractPlugin.loader,
        'css-loader',
        'sass-loader',
      ],
      exclude: [
        path.resolve(__dirname, '../../')
      ]
  })
}

Now before exporting your config just call useLocalJarvisUI(config) to use the local version, disable the line to use the installed version.

Be aware

  • Your webpack will be a little slower, since it has to build two projects
  • Changes in setup / files / packages in Jarvis UI could break this solution.

Resolutions

"webpack-dev-server/*/http-proxy": "^1.18.1"

2020-08-31

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ high          │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ http-proxy                                                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=1.18.1                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ webpack-dev-server                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ webpack-dev-server > http-proxy-middleware > http-proxy      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://www.npmjs.com/advisories/1486                        │
└───────────────┴──────────────────────────────────────────────────────────────┘

"minimist": "^1.2.3"

2020-08-31 Multiple, one example:

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimist                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.2.1 <1.0.0 || >=1.2.3                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ node-sass                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ node-sass > node-gyp > mkdirp > minimist                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://www.npmjs.com/advisories/1179                        │
└───────────────┴──────────────────────────────────────────────────────────────┘

"lodash": "^4.17.19"

2020-08-31 Multiple, one example:

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.19                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-dates                                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ react-dates > lodash                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://www.npmjs.com/advisories/1523                        │
└───────────────┴──────────────────────────────────────────────────────────────┘

Known issues

Type intersection not working

Intersected types are not correctly displayed when used in the properties. The documentation goes missing from the storybook, which makes using the component a lot less practical. For example templates/BasePage/BasePage.tsx has a definition for BasePagePassThroughProps, which was meant to be used and extended in other templates. But when doing so, none of the property documentation will show up. This issue comes from react-docgen and is still open on their end: https://github.com/reactjs/react-docgen/pull/352 Or from react-docgen-typescript-loader where it is also still open: https://github.com/styleguidist/react-docgen-typescript/issues/158

Upgrading rc-slider 9.2.4 ❯ 9.3.1

Upgrading this package breaks the whole slider. It does not seem to be a JSX element anymore. This is a known issue, but not fixed yet: https://github.com/react-component/slider/issues/656

Upgrading @typescript-eslint/eslint-plugin 2.34.0 ❯ 3.6.0

This moves rules that are used by other packages, so it breaks the linting

License

MIT © Greenhouse

0.4.46

4 years ago

0.4.45

4 years ago

0.4.44

4 years ago

0.4.43

4 years ago

0.4.42

4 years ago

0.4.40

4 years ago

0.4.41

4 years ago

0.4.39

4 years ago

0.4.38

4 years ago

0.4.37

4 years ago

0.4.35

4 years ago

0.4.36

4 years ago

0.4.34

4 years ago

0.4.33

4 years ago

0.4.32

4 years ago

0.4.31

4 years ago

0.4.30

4 years ago

0.4.28

4 years ago

0.4.27

4 years ago

0.4.26

4 years ago

0.4.25

4 years ago

0.4.24

4 years ago

0.4.23

4 years ago

0.4.22

4 years ago

0.4.21

4 years ago

0.4.20

4 years ago

0.4.19

4 years ago

0.4.18

4 years ago

0.4.17

4 years ago

0.4.15

4 years ago

0.4.16

4 years ago

0.4.13

4 years ago

0.4.14

4 years ago

0.4.12

4 years ago

0.4.10

4 years ago

0.4.11

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.3.38

4 years ago

0.3.37

4 years ago

0.3.36

4 years ago

0.3.35

4 years ago

0.3.34

4 years ago

0.3.33

4 years ago

0.3.32

4 years ago

0.3.31

4 years ago

0.3.30

4 years ago

0.3.29

4 years ago

0.3.28

4 years ago

0.3.27

4 years ago

0.3.26

4 years ago

0.3.25

4 years ago

0.3.24

4 years ago

0.3.23

4 years ago

0.3.22

4 years ago

0.3.21

4 years ago

0.3.20

4 years ago

0.3.19

4 years ago

0.3.18

4 years ago

0.3.17

4 years ago

0.3.16

4 years ago

0.3.15

4 years ago

0.3.14

4 years ago

0.3.13

4 years ago

0.3.12

4 years ago

0.3.11

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.6

4 years ago

0.3.7

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.57

4 years ago

0.2.56

4 years ago

0.2.55

4 years ago

0.2.54

4 years ago

0.2.52

4 years ago

0.2.51

4 years ago

0.2.53

4 years ago

0.2.50

4 years ago

0.2.49

4 years ago

0.2.48

4 years ago

0.2.47

4 years ago

0.2.46

4 years ago

0.2.45

4 years ago

0.2.44

4 years ago

0.2.43

4 years ago

0.2.42

4 years ago

0.2.41

4 years ago

0.2.40

4 years ago

0.2.38

4 years ago

0.2.37

4 years ago

0.2.36

4 years ago

0.2.35

4 years ago

0.2.34

4 years ago

0.2.33

4 years ago

0.2.32

4 years ago

0.2.31

4 years ago

0.2.30

4 years ago

0.2.29

4 years ago

0.2.28

4 years ago

0.2.27

4 years ago

0.2.26

4 years ago

0.2.25

4 years ago

0.2.24

4 years ago

0.2.23

4 years ago

0.2.22

4 years ago

0.2.21

4 years ago

0.2.20

4 years ago

0.2.19

4 years ago

0.2.18

4 years ago

0.2.17

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.1.29

4 years ago

0.2.1

4 years ago

0.1.28

4 years ago

0.1.27

4 years ago

0.1.26

4 years ago

0.1.25

4 years ago

0.1.24-1

4 years ago

0.1.24

4 years ago

0.1.23

4 years ago

0.1.20

4 years ago

0.1.21

4 years ago

0.1.22

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.15

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.12

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago