Please have the latest stable versions of the following on your machine
- node
- yarn
Yarn is a requirement for contributing to Ripple as it uses Yarn specific support for Workspaces
It is recommended to use Node Version Manager to manage node versions.
NVM will use the correct version set in .nvmrc
by running the following:
# Run nvm install from the project folder.
nvm install
We are using Storybook as development environment for UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.
# install dependencies
yarn
# Start the storybook server
yarn start:storybook
Apart from Ripple component library, we have several packages used for Nuxt.js app and Tide integration.
You can use our example app for the work. The example application requires a working Tide Drupal installation to connect to.
Ensure a populated .env
exists within the /examples/vic-gov-au/
directory.
You can use /examples/vic-gov-au/example.env
as a template.
# install dependencies
yarn
# Start the example site server
yarn start:example
yarn lint
Add all components into storybook.
Run yarn test:unit
to test Storyshots.
New storytest will be added automatically at first time.
Update storyshots tests if you need by yarn test:unit -u
.
# We use Jest for unit test and snapshots test
yarn test:unit
Chromatic is the tool for visual testing, it's running in CircleCI for pull request.
If you want to run it in local:
cd src && yarn chromatic --project-token $CHROMATIC_APP_CODE
Some story need to display dynamic content like date element. It will fail the visual test. To ignore them, check: https://www.chromatic.com/docs/ignoring-elements#ignore-dom-elements.
Unit tests are important. They help us secure our processes and work flows, ensuring that the most critical parts of our projects are protected from accidental mistakes or oversights in our development. We use both Jest and Vue testing utility called vue-test-utils.
Cypress end to end testing is used for testing our Tide integration.
Most of the tests are maintained in ripple-test-tools
package.
yarn test:e2e
We use lerna to manage packages in this monorepo. The details are documented internally.
# Update docs automatically
cd src && yarn docs
Note: there is a issue in generate storybook link for mdx stories, will be fixed after MDX docs migration
# Update all ripple dependencies (./package.json & ./packages/**/package.json)
cd src && yarn package-dependencies
This script requires:
- Each ripple component package to have a
package.json
file withname
- The root directory to have a
lerna.json
file withversion
# Generate a new package in the `./packages/**/` directory
cd src && yarn new-component "[Name]" "[Description]" "[Atoms / Molecules / Organisms]"
Example: Creating a new package 'My Package' in the Organism folder:
cd src && yarn new-component "My Package" "A demonstration package." "Organisms"
After creating a new package:
- Generate the readme using
yarn docs
. - Update
package.json
by usingyarn package-dependencies
.
This directory contains our packages. components
subfolder contains all Ripple components.
This directory contains storybook site app code.
This directory contains example code for demo how to use Ripple.
This directory contains scripts for project maintaining purpose.
When we write css for Ripple component, a rpl
prefix is needed.
Use BEM methodology to name css class.
- Component class name: .rpl-[component-name]
- Element class name: .rpl-[component-name]__[element-name]
- Modifier class name: .rpl-[component-name]--[modifier-name]
Formatting rules is defined in .sass-lint.yml
.
ESLint configuration is in .eslintrc.js
.