dispense-ui-library v0.2.0
Dispense UI Library
Commands
npm run start # or yarn run startRun inside another terminal to start Storybook:
yarn run storybookESLint
Run
yarn run eslintTests
npm run test # or yarn run testPublishing to NPM
npBundle analysis
Calculates the real cost of your library using size-limit with npm run size and visulize it with npm run analyze.
Setup Files
This is the folder structure we set up for you:
/example
index.html
index.tsx # test your component here in a demo app
package.json
tsconfig.json
/src
index.tsx # EDIT THIS
/test
blah.test.tsx # EDIT THIS
/stories
Thing.stories.tsx # EDIT THIS
/.storybook
main.js
preview.js
.gitignore
package.json
README.md # EDIT THIS
tsconfig.jsonReact Testing Library
We do not set up react-testing-library for you yet, we welcome contributions and documentation on this.
Rollup
TSDX uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.
TypeScript
tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.
Continuous Integration
GitHub Actions
Two actions are added by default:
mainwhich installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrixsizewhich comments cost comparison of your library on every pull request using size-limit
Optimizations
Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:
// ./types/index.d.ts
declare var __DEV__: boolean;
// inside your code...
if (__DEV__) {
console.log('foo');
}You can also choose to install and use invariant and warning functions.
Publishing to NPM
We recommend using np.
4 years ago