@dentai/ui
v1.1.9
Published
A modern, accessible React component library for dental applications.
Readme
DentAI UI Component Library
A modern, accessible React component library for dental applications.
Installation
npm install @dentai/ui
# or
yarn add @dentai/uiUsage
import { Button } from '@dentai/ui';
function App() {
return (
<Button variant="primary">
Click me
</Button>
);
}Development
- Clone the repository:
git clone https://github.com/your-org/dentai-ui.git
cd dentai-ui- Install dependencies:
npm install- Start Storybook:
npm run storybook- Run tests:
npm testBuilding
To build the library:
npm run build:libTo build Storybook:
npm run build-storybookTesting Local Installation
The npm pack command creates a tarball (.tgz file) that contains exactly what would be published to npm. This is useful for:
- Testing your package locally before publishing
- Verifying the contents of your package
- Creating a portable version for local testing
To test the library in your application:
- Generate a test bundle:
npm run pack:testThis will:
- Build the library (
npm run build:lib) - Create a tarball (e.g.,
dentai-ui-0.1.0.tgz) - Include only the files specified in
package.json'sfilesfield:/dist- Built library filesREADME.md- Documentation
- In your application, install the test bundle:
npm install /path/to/dentai-ui-0.1.0.tgzYou can also inspect the contents of the tarball:
tar -tvf dentai-ui-0.1.0.tgzVersioning and Releasing
The library uses semantic versioning (MAJOR.MINOR.PATCH) with automated version increments based on commit messages:
Commit Convention
Your commit messages determine the version increment:
# Patch Version (0.0.X) - Bug fixes and minor changes
fix(button): resolve click handler not firing
fix(input): correct typing issue
perf(table): improve rendering performance
style(dialog): fix padding inconsistency
# Minor Version (0.X.0) - New features
feat(dropdown): add search functionality
feat(input): add phone number formatting
# Major Version (X.0.0) - Breaking changes
# Method 1: Using BREAKING CHANGE in commit body
feat(button): redesign button API
BREAKING CHANGE: Button props interface has changed
- removed 'size' prop
- 'variant' prop now accepts different values
# Method 2: Using breaking prefix
breaking(input): complete redesign of input componentCommit Scopes
Use these scopes to indicate which component is affected:
buttoninputdialogtabletabsdropdownsidebarphone-inputdocscideps
Examples
# Bug fix (patch)
git commit -m "fix(button): resolve hover state not clearing"
# New feature (minor)
git commit -m "feat(input): add autocomplete support"
# Breaking change (major)
git commit -m "feat(dialog): redesign dialog API
BREAKING CHANGE: Dialog component now uses a new API
- 'open' prop renamed to 'isOpen'
- 'onClose' is now required
- New 'size' prop replaces 'width' and 'height'"Automated Release Process
- Commits to main branch trigger automatic version increment
- Version is determined by commit messages since last release
- CHANGELOG.md is automatically updated
- New GitHub release is created
- Package is published to npm
Manual Version Control
While versions are automatically managed, you can still use these commands if needed:
# Increment patch version (0.0.X)
npm run version:patch
# Increment minor version (0.X.0)
npm run version:minor
# Increment major version (X.0.0)
npm run version:majorTo create a release with changelog manually:
npm run release:patch # For bug fixes
npm run release:minor # For new features
npm run release:major # For breaking changesTesting
- Run tests:
npm test - Watch mode:
npm run test:watch - Coverage report:
npm test -- --coverage
Contributing
- Create a feature branch:
git checkout -b feature/your-feature-name- Make your changes and commit using conventional commits:
git commit -m "feat: add new component"- Push and create a pull request:
git push origin feature/your-feature-nameRelease Process
- Changes are automatically published when merged to main
- Versioning follows semantic versioning
- Releases are automated via GitHub Actions
- Storybook is automatically deployed to Chromatic
Available Scripts
npm run dev- Start Next.js development servernpm run build- Build Next.js applicationnpm run storybook- Start Storybook development servernpm run build-storybook- Build Storybook for deploymentnpm test- Run testsnpm run build:lib- Build the component librarynpm run chromatic- Publish to Chromaticnpm run release- Create a new releasenpm run pack:test- Generate a test bundlenpm run version:patch- Increment patch versionnpm run version:minor- Increment minor versionnpm run version:major- Increment major versionnpm run release:patch- Create patch release with changelognpm run release:minor- Create minor release with changelognpm run release:major- Create major release with changelog
Code Quality
- Linting: The project uses ESLint for code quality
- Testing: Jest and React Testing Library for unit tests
- Coverage: Minimum 80% coverage required for all code
- Commit Messages: Uses conventional commits format
- CI/CD: Automated testing and deployment via GitHub Actions
Project Structure
dentai-ui/
├── src/ # Source code
├── dist/ # Built library output
├── stories/ # Storybook stories
├── tests/ # Test files
└── .github/ # GitHub Actions workflowsLicense
MIT
Publishing to npm
Initial Setup
Create an npm account if you don't have one:
npm adduserLogin to npm:
npm loginCreate an npm organization (if not already done):
# Visit https://www.npmjs.com/org/create # Create the 'dentai' organization
Publishing Process
The package is automatically published to npm when:
- Changes are merged to main branch
- All tests pass
- Version is bumped based on commit messages
To publish manually (if needed):
# Build the library
npm run build:lib
# Publish to npm
npm publishnpm Token Setup
For CI/CD publishing, you need to set up an npm token:
Generate a new access token:
npm token createAdd the token to GitHub Secrets:
- Go to your repository settings
- Navigate to Secrets and Variables > Actions
- Create a new secret named
NPM_TOKEN - Paste your npm token
Scoped Package
This package is published under the @dentai scope:
npm install @dentai/uiThe scope ensures:
- Name uniqueness
- Package grouping
- Access control
- Brand consistency
