Custom scripts for Create React App for generating React component projects written in TypeScript.
You must have Create React App installed globally see here for documentation.
Note: These steps will assume your new package is named
create-react-app my-component --scripts-version @dynrl/create-react-comp-scripts
yarn start- Start the Stroybook server for development
yarn test- Run your tests using Jest
yarn run format- Format your source files with Prettier
yarn run export- Build a standalone Storybook for hosting a demo
To launch the Storybook server simply run
yarn start then open a browser and
http://localhost:9000. The Storybook server has hot-reloading
enabled so changing your component or story can be done while the server is
running and the changes will be reflected in the browser.
Stories should be written in TypesScript and the file should end in
and be placed in the
src directory. It is recommended you place them next to
your component with the same name as the component (ex.
has the story
Testing is performed using Jest and Enzyme. Tests should be written in
TypeScript and the file should end in
stories, it is recommended to place the tests next to your component using the
To test simply run
To build simply run