@mycause/ui
v0.0.0-c9ff4eb5
Published
Design system and UI components for mycause.
Downloads
1,925
Readme
mycause ui
Design system and UI components for mycause.
Prerequisites
- Node.js (>= 22.x)
- Yarn (>= 1.22.22)
Setup
Install the package:
$ yarn add @mycause/ui
mycause ui depends on a global style reset as well as global styles for some components. The reset includes normalize.css
and a box-sizing border box reset, if you are already using something similar you may not need to include it.
Ensure you include these in your app, for example with Webpack's style-loader
:
import "@mycause/ui/styles/reset.css";
import "@mycause/ui/styles/index.css";
Some components make use of the fonts:
- Montserrat
- Montserrat Alternates
- Material Icons
- Material Icons Outlined
Ensure you include these in your app, for example using the Google Fonts CDN:
<link
href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Montserrat+Alternates:400,500&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined"
rel="stylesheet"
/>
Applying Patches with patch-package
This project uses patch-package
to apply fixes to certain dependencies. This is necessary to address issues such as the punycode
deprecation warning. Below are the steps to apply and manage these patches.
The following patches are applied:
- normalize-url: Replaced require('punycode') with require('punycode/')
- psl: Replaced require('punycode') with require('punycode/')
- unicode-length: Replaced require('punycode') with require('punycode/')
- url: Replaced require('punycode') with require('punycode/')
- tough-cookie: Replaced require('punycode') with require('punycode/')
Local development
This project uses Yarn for development dependencies.
Install dependencies with yarn
:
$ yarn install
Start the Storybook development server:
$ yarn storybook
View TypeScript errors and warnings:
$ yarn type-check
$ yarn type-check --watch # to watch
View ESLint errors and warnings:
$ yarn lint
Format code with Prettier:
$ yarn format
Build package:
$ yarn build
Storybook site
Build static Storybook site:
$ yarn build-storybook
Serve static Storybook site:
$ yarn start-storybook
Build static Storybook site as Docker image:
$ yarn build-storybook
$ docker build -t mycause/ui . # or replace with a different image name
Git hooks
Git hooks have been set up with husky
.
To skip installing git hooks, set the HUSKY_SKIP_INSTALL
environment variable to 1
$ HUSKY_SKIP_INSTALL=1 yarn install
To skip running hooks, for example when rebasing or commiting incomplete work, set the HUSKY_SKIP_HOOKS
environment variable to 1
.
$ HUSKY_SKIP_HOOKS=1 git commit ...
$ HUSKY_SKIP_HOOKS=1 git rebase ...
Linking as a dependency
To use a development version of this package as a dependency, first link it:
$ yarn link
Then go to the dependent project and run:
$ yarn link @mycause/ui
Then start the bundler in watch mode:
$ yarn dev
Publishing
Publishing a new version
Bump the version.
npm version [major | minor | patch]
Then ensure that the CHANGELOG.md
is updated for the new release. This is the last chance to make any pending changes to this version. Commit any changes and push, including tags.
CircleCI will then automatically build and publish the new version.
To manually publish the package locally, use the following command:
npm publish --access public
Using git commands
git tag <version>
git push origin <version>
Publishing an unstable version
Use the following commands to publish an unstable version. These versions are tagged with the version number 0.0.0-cHASH
where HASH
is the abbreviated git commit hash. These should only be used for internal development purposes.
The version 0.0.0
indicates that these releases have no stability guarantees and do not necessarily have any relationship with other versions.
yarn build
npm version 0.0.0-c$(git rev-parse --short HEAD) --git-tag-version=false
npm pack
npm publish mycause-ui-0.0.0-c$(git rev-parse --short HEAD).tgz --access public
git reset --hard
The
c
prefix prevents an issue where npm doesn't accept numeric identifiers that start with 0, the abbreviated git commit has may be all numeric and start with 0, soc
is prepended to avoid this.
License
MIT