PLASMA by WeWork
Plasma is a design system for creating sensible, modern interfaces.
Component docs at http://plasma.guide
Storybook at http://plasma.guide/dev/storybook
Select and Datepicker components do not work right now. Use react-select
and datepicker directly in Spacestation.
Running Storybook
- Run the Plasma Webpack dev server:
yarn start
- Run the Storybook server:
yarn storybook
- Go to http://localhost:6006/ to view the Storybook
Developing with Storybook
- Follow steps above "Running Storybook"
- Create a new dev branch:
git checkout -b mybranch
- Add / update as necessary
- Add stories to the
stories/
directory as you add / update components!
- Run
yarn run styleguide
. - Load up http://0.0.0.0:6060
- Run
yarn run styleguide:build
- Files output to /styleguide
- Run
yarn flow:buildTypeDefs
This will output flow-typed compatible definitions of Flow types for Plasma. For Spacestation, you likely want to yarn flow:buildTypeDefs | pbcopy
(if on Mac) and paste the contents to the plasma_vx.x.x.js
under flow-typed/
- Run
./docs/publish.sh
from the root dir. This will update the docs, commit to gh-pages, and push to github (updating http://plasma.guide)
Info here: https://react-styleguidist.js.org/docs/documenting.html
- When you're ready, push your branch to Github and create a pull request.
- If you've made visual changes, include screenshots.
- If you've made implementation changes, run
yarn test:update
to update jest snapshots. - PR will be reviewed
- When PR is accepted, it will be merged into master.
- (Optional) If you also need to publish a new Plasma version, read that section.
- Create a separate PR or bump the npm version in the feature branch, do not publish from master.
- Run
yarn run pack
to bundle the .js and .css file into/dist
folder. - Run
npm version patch
. This will bump the version in package.json and create a new tag and push the tag to Github. - Make sure you're logged in to NPM via
npm login
. login is in 1password, when prompted for email please use: dev-team@wework.com - Run
npm publish
from the root directory to publish to NPM registry. - Check https://www.npmjs.com/~wework-dev to make sure package is updated.
- In your terminal,
cd
to local Plasma repo. - Run
yarn link
. cd
to local Spacestation repo.- Run
yarn link @wework-dev/plasma
. This creates a symlink in Spacestation'snode_modules/@wework-dev/plasma
folder that points to local Plasma repo. - (Optional) If you need to, you can unlink at any time with
yarn unlink @wework-dev/plasma
- Create a new Plasma dev branch:
cd /plasma
git checkout -b mybranch
- Run the Plasma dev server with watch:
yarn watch
- Save any changes in Plasma, webpack should bundle changes in
/dist
- Run Spacestion:
cd /spacestation
yarn start
- Changes you make in Plasma should automatically be picked up by Spacestation
- Follow "Creating a Pull Request / Publishing"
-
Run
yarn add @wework-dev/plasma
in your project. -
Include the Plasma object (or individual components) in your Javascript. Plasma object example:
import Plasma from '@wework-dev/plasma'; <Plasma.Button label="Click it" />;
Individual components example:
import { Button } from '@wework-dev/plasma'; <Button label="Click it" />;
For testing, Plasma uses Jest (https://facebook.github.io/jest/) with Enzyme (http://airbnb.io/enzyme/).
Tests are located in src/tests
.
Flow coverage can be checked via yarn flow:coverage
.
- Run
yarn test
for a single run oryarn test:watch
to watch for changes.