This project contains both an npm package (React component library) and a demo website.
npm run build:libOutput: dist/ folder
dist/index.js(CommonJS)dist/index.esm.js(ES Modules)dist/index.d.ts(TypeScript definitions)- Source maps
Usage: This build is published to npm.
Note: When you run npm publish, the prepare script automatically runs the build:lib command.
npm run buildOutput: build/ folder
build/index.htmlbuild/static/(CSS, JS, assets)
Usage: This build is deployed to Netlify.
# Update version
npm version patch # or minor, major
# Publish (automatically runs build:lib)
npm publishNetlify automatically:
- Runs
npm install --legacy-peer-deps - Builds the demo site with
npm run build - Serves the
build/folder
npm startThis command runs the demo site at http://localhost:3000.
npm run build:watchAutomatically rebuilds as you modify library files.
brandkit/
├── src/
│ ├── lib/ # Library source (goes to npm package)
│ │ └── index.js
│ ├── demo.js # Demo site entry
│ ├── App.js # Demo site app
│ └── index.js # React entry point
├── public/
│ └── index.html # HTML template
├── dist/ # Library build output (npm)
├── build/ # Demo site build output (Netlify)
└── rollup.config.js # Library build config
- rollup.config.js: Library build configuration
- netlify.toml: Netlify deployment configuration
- .npmignore: Files excluded from npm package (build/, src/, etc.)
- .gitignore: Files excluded from Git (node_modules, build)
dist/folder → Included in npm packagebuild/folder → Served on Netlify, not included in npm packagepreparescript → Automatically builds library before npm publishbuildscript → Builds demo site (for Netlify)build:libscript → Builds library (for npm)