An opinionated UI Workbench featuring tools like react, styled components, typescript, webpack, jest and storybook all bundled into an easy to use interface
-
Build UI components/pages in isolation
-
Display test coverage and documentation for each component
-
Complete control of dynamic input values for each component for edge case testing
-
Easily view all device sizes
-
Performance metrics for both server and client
-
ADA accessibility audit for each component
-
Easily create a new component from a CLI
-
Mock API
-
DOM Events
-
Client Render
-
Micro Frontend Render
-
Server Side Render
-
Static Site Generation
Introducing Module Federation in Webpack 5
The starting point for learning TypeScript
How to Test React Components in TypeScript
styled-components: Documentation
- Run $ git clone https://github.com/SketchLagoon/rocket-science.git
- Run $ cd rocket-science
- Run $ yarn setup
- Run $ yarn launch
- deletes ./dist folder holding previous builds
- runs webpack build in watch mode
- leaves the node process running to listen for changes
- generates new build on saved changes
- starts storybook
- starts federated module CDN server
- Run $ npx create-rs-app
- Provide the CLI prompt the name you want to give your project
- Run $ cd your-project-name to change directories into your new project
- Install dependencies by running $ yarn
- Generate test results for storybook tests addon by running $ yarn test
- Start the Rocket Science workbench by running $ yarn story
- deletes ./dist folder holding previous builds
- runs webpack build in watch mode
- leaves the node process running to listen for changes
- generates new build on saved changes
- starts storybook
- starts federated module CDN server
- Tab should open in your browser on localhost:6006 with storybook
- Run $ yarn generate-component
- Provide the CLI prompt the name you want to give your component
- example: yourComponentNameHere
- Check for the following files under ./src/components/yourComponentNameHere
- index.ts
- yourComponentNameHere.tsx
- yourComponentNameHere.styles.ts
- yourComponentNameHere.test.ts
- yourComponentNameHere.stories.tsx
- README.md
If the component (ex: yourComponentNameHere) is intended to be of Organism (Atomic Design) or Feature level of value add to the user, you may want to add this as an exposed module within the ModuleFederationPlugin in the webpack.config.js file. This will enable runtime sharing of this component from one deployed application or CDN to a separate consuming application.
-
Open webpack.config.js file in your code editor
-
Under the ModuleFederationPlugin configuration object in the Plugins array, find the exposes object
-
Add a key/value pair where the key is akin to a route for the exposed module and the value is the file path to the module you want to expose.
//webpack.config.js // ... // Required assets from external sources for webpack configuration, plugins, etc // ... module.exports = { // ... // configuration for output, resolve, devServer, module, etc // ... plugins: [ new ModuleFederationPlugin({ name: "RocketScience", filename: "remoteEntry.js", remotes: {}, exposes: { "./NewComponentTemplate": "./src/components/NewComponentTemplate", // ================================================================= // Key: similar to concept of a 'route' for your exposed module // Value: file path to the module you want to expose "./yourComponentNameHere": "./src/components/yourComponentNameHere", // ================================================================= }, shared: { ...deps, react: { singleton: true, requiredVersion: deps.react, }, "react-dom": { singleton: true, requiredVersion: deps["react-dom"], }, }, }), ], };
- Contact me via email, listed in package.json