The React Components collection is a TypeScript based collection of components used across a range of application within DHI
React-Components are demonstrated here and are available as npm package from Github packages.
Generating a Personal Access token with GitHub - More info
- Visit Github.com → Your Profile (top right) → Settings.
- Develop settings (bottom of sidebar)
- Personal access tokens
- "Generate new token"
- Note:
GitHub Packages
- Tick:
repo, write:packages, read:packages, delete:packages, admin:repo_hook
- "Generate token"
- Click clipboard icon to copy token.
- Open
C:\users\<username>\.npmrc
or create this file here if doesn't exist. - Paste within it, replacing
<AUTH_TOKEN>
with the token you copied moments ago.
@dhi:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<AUTH_TOKEN>
(this file can also be created in project-scope via .npmrc
in root, but it is not advised as it links to your personal access token.)
- Open
C:\users\<username>\.yarnrc.yml
or create this file here if doesn't exist. - Paste within it, replacing
<AUTH_TOKEN>
with the token you copied moments ago.
npmScopes:
dhi:
npmAlwaysAuth: true
npmAuthToken: <AUTH_TOKEN>
npmRegistryServer: "https://npm.pkg.github.com"
(this file can also be created in project-scope via .yarnrc.yml
in root, but it is not advised as it links to your personal access token.)
- Now you may install DHI packages from GitHub Packages!
The recommended workflow is to run TSDX in one terminal:
yarn
yarn start
To run Storybook
yarn
yarn start
yarn storybook
Publishing the package can be done by running the following command in the root of the package "react-components".
yarn npm publish
Note: There is no prompt for the package version. The version to be published will be found in ./packages/react-components/package.json
.