Run this command:
docker-compose up --build
The server will be live on localhost:9009
- Create a new folder:
src/React/MyComponent
- Add two files to the folder
index.js
andMyComponent.js
- Add
export * from './MyComponent'
to your newindex.js
- Write your sweet new React component
- Add
- Make your component available to import from the library by adding and entry to
src/index.js
export { MyComponent } from './MyComponent'
- When you're really done with the component, create some type defs in
src/React/index.d.ts
- This lets people using your component see what props are available, and get auto completion on enum type props. For an example, check the variant prop of Button.
- Create
.svg
file insrc/assets/svg
- run
npx @svgr/cli --template src/utils/svgr.js -d src/components/Svg src/assets/svg
in terminal - Make your component available to import from the library by adding and entry to
src/Svg/index.js
export * from './Component'
- Component will be available to import with
Svg
prefiximport { SvgComponent } from @txstate-mws/txstate-react
Storybook is a framework that allows us to develop components in an isolated environment. It acts as a living set of documentation and is extremely useful for development since you don't have to link this library with another project in order to develop with it. When you've written your component and ready to test it using Storybook, do the following:
- Add a file to
src/stories
calledMyComponent.stories.jsx
- Add an entry to
src/stories/index.js
to import your component's stories. - Write a story.
Increment the minor version if you changed anything and you want other people to have it.
If you've added a new component the major version should be incremented.
If you've changed the way a component is used increment the major version and explain to the rest of the team why this change is needed (cookies help).
The easiest way to communicate changes is to update CHANGELOG.md
The version number is in package.json
- Run
yarn build
ornpm run build
- You can either publish the new version, or use it locally:
- To use locally, run
npm pack
and install the.tgz
file it generates as a dependency in your project. - To publish the package, learn how to publish a package and then write these instructions.
- To use locally, run
- When making a commit to the master branch, travis CI will automatically build the library and deploy it to https://txstate-etc.github.io/txstate-components/