npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

preact-component-scss

v2.0.1

Published

A Preact component library with SCSS styling

Readme

Preact Component Library with SCSS

A modern, responsive component library built with Preact, TypeScript, and SCSS. Features dark/light/auto theme switching, comprehensive documentation, and GitHub Pages deployment.

Features

  • Preact - Fast, lightweight React alternative
  • 🎨 SCSS - Modular styling with CSS custom properties
  • 🌙 Theme Support - Dark, light, and auto themes with localStorage persistence
  • 📱 Responsive - Mobile-first design with fluid typography
  • 🧪 Tested - Comprehensive test suite with JUnit reporting
  • 📚 Documented - TSDoc generated documentation
  • 🚀 CI/CD - GitHub Actions with automated testing and deployment
  • 🔄 Version Management - Automatic version checking and bumping with Husky pre-commit hooks
  • 📦 NPM Publishing - Automated publishing pipeline with version validation

Installation

npm install preact-component-scss

Usage

import { App } from 'preact-component-scss';
import 'preact-component-scss/styles';

function MyApp() {
  return <App />;
}

Theme Configuration

The library includes a theme provider for easy theme switching:

import { ThemeProvider, useTheme } from 'preact-component-scss';

function App() {
  const { theme, setTheme } = useTheme();

  return (
    <div>
      <button onClick={() => setTheme('dark')}>Dark</button>
      <button onClick={() => setTheme('light')}>Light</button>
      <button onClick={() => setTheme('auto')}>Auto</button>
    </div>
  );
}

Version Management & Publishing

The project includes automated version management to ensure safe publishing:

Pre-commit Hooks

  • Husky pre-commit hook automatically runs npm run version-check
  • Prevents commits when local version matches published version
  • Automatically bumps patch version when needed

Publishing Workflow

# Manual version check (optional)
npm run version-check

# Build library for publishing
npm run build:lib

# Publish to NPM (requires NPM_TOKEN)
npm publish

CI/CD Pipeline

  • GitHub Actions automatically publishes on main branch pushes
  • Version validation prevents publishing duplicate versions
  • Automated testing and building before publishing

Development

# Install dependencies (also sets up Husky git hooks)
npm install

# Start development server
npm run dev

# Run tests
npm run test

# Build for production
npm run build

# Generate documentation
npm run docs

Scripts

  • npm run dev - Start Vite dev server
  • npm run build - Build for production
  • npm run build:lib - Build library for NPM publishing
  • npm run test - Run tests with Vitest
  • npm run test:junit - Run tests with JUnit output for CI
  • npm run test:coverage - Run tests with coverage reporting
  • npm run test:ui - Run tests with Vitest UI
  • npm run docs - Generate TSDoc documentation
  • npm run preview - Preview production build
  • npm run version-check - Check and bump version if needed before publishing

Project Structure

src/
├── app.tsx              # Main demo component
├── index.ts             # Library entry point
├── main.tsx             # App bootstrap
├── theme-provider.tsx   # Theme context provider
├── utils.ts             # Utility functions
├── global.d.ts          # TypeScript environment variable declarations
├── styles/
│   ├── _variables.scss  # CSS custom properties and SCSS variables
│   ├── _mixins.scss     # SCSS mixins
│   ├── _base.scss       # Global styles
│   ├── _components.scss # Component styles
│   └── main.scss        # Main stylesheet
├── components/          # Component library
├── test/
│   └── setup.ts         # Test configuration
└── assets/              # Static assets
.husky/
├── pre-commit           # Git pre-commit hook for version checking
└── _/                   # Husky internal files

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Run npm run test to ensure tests pass
  6. Commit your changes (pre-commit hooks will automatically check versions)
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/prachwal/preact-component-scss.git
cd preact-component-scss

# Install dependencies (this also sets up Husky hooks)
npm install

# Start development
npm run dev

Pre-commit Hooks - Description

The project uses Husky to run automated checks before commits:

  • Version validation: Ensures version bumping when needed
  • Code quality: Runs tests and linting (when configured)

To bypass hooks for specific commits (use with caution):

git commit --no-verify -m "Your commit message"

License

MIT - see LICENSE file for details.