🌿 Pure Index
Pure Index is utility for packages. It helps to clean your packages of unused exports with ease.
And it's also very fast ⚡️
Motivation
We will use the @my/ui-kit
package as an example.
export { Button } from './components/button';
export { Text } from './components/text';
export { ThemeProvider, useTheme, type Theme } from './themes';
...
All of its exportable code requires support. But is all of it actually being used?
You can check this manually by just looping through the exports. It's time consuming and there is a chance of error. What if it's code is used by multiple repositories?
Let's automate this process!
Installation
You can use any package manager
npm install -D pure-index
Quick Start
Pure Index can be used either through a command line interface with an optional configuration file, or else through its JavaScript API.
- Add the
check-exports
script in the package.json
of each package that needs to be checked
"scripts": {
+ "check-exports": "pure-index"
}
- Run
npm run check-exports
- Depending on the project, you may need to configure Pure Index.
Documentation
For additional information, guides and api reference visit our documentation site