
npm install intermix-dashboard-muiA tsdx based react library that implements a dynamic dashboard that can be either used as a standalone application or be integrated into any microfrontend application with distributed applications contributing configurable widgets to the dashboard.
```
yarn
Run inside another terminal:
``
yarn storybook
This loads the stories from ./stories.
> NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.
Then run the example inside another:
``
cd example
yarn to install dependencies
yarn start
This will start up the intermix dashboard app based on create-react-app
Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.
Jest tests are set up to run with npm test or yarn test. This runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.
#### 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.ts
/test
blah.test.tsx
.gitignore
package.json
README.md
tsconfig.json
#### React Testing Library
We do not set up react-testing-library for you yet, we welcome contributions and documentation on this.
TSDX uses Rollup v1.x as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.
tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.
_to be completed_
_to be completed_
Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:
`js
// ./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.
CJS, ESModules, and UMD module formats are supported.
The appropriate paths are configured in package.json and dist/index.js accordingly. Please report if any issues are found.
``
cd example
npm i # or yarn to install dependencies
npm start # or yarn start
The default example imports and live reloads whatever is in /dist, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. No symlinking required!
Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
For vanilla CSS, you can include it at the root directory and add it to the files section in your package.json`, so that it can be imported separately by your users and run through their bundler's loader.
We recommend using https://github.com/sindresorhus/np.