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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-spa-comp

v1.0.0

Published

My react SPA component library

Readme

react-spa-comp

Uzycie biblioteki

Import komponentow idzie z glownego wejscia paczki:

import { Footer } from 'react-spa-comp';
import 'react-spa-comp/styles.css';

Style z CSS Modules sa podczas buildu wypychane do jednego pliku styles.css. To oznacza, ze konsument biblioteki powinien jawnie zaimportowac react-spa-comp/styles.css, jesli chce dostac gotowe style komponentow.

Publikacja paczki

Minimalny release flow dla tej biblioteki:

  1. Zwieksz wersje w package.json.
  2. Uruchom npm run build.
  3. Uruchom npm run type-check.
  4. Uruchom npm run pack:check.
  5. Opublikuj paczke przez npm publish.

Paczkę publikuje npm jako publiczną, bo manifest zawiera publishConfig.access = public. Do paczki trafiają tylko artefakty z dist, plik README.md i LICENSE.

Jak dodać nowy komponent do biblioteki?

  1. Utwórz katalog i pliki komponentu:

    • Utwórz katalog: src/components/NazwaKomponentu/
    • Dodaj plik komponentu: src/components/NazwaKomponentu/NazwaKomponentu.tsx
    • (Opcjonalnie) Dodaj plik stylów: NazwaKomponentu.module.css
    • Dodaj plik eksportu: src/components/NazwaKomponentu/index.ts
  2. Przykład prostego komponentu:

    src/components/MyButton/MyButton.tsx

    import React from 'react';
    import styles from './MyButton.module.css';
    
    export interface MyButtonProps {
      children?: React.ReactNode;
      onClick?: () => void;
    }
    
    export const MyButton: React.FC<MyButtonProps> = ({ children, onClick }) => (
      <button className={styles.myButton} onClick={onClick}>
    	 {children}
      </button>
    );

    src/components/MyButton/index.ts

    export { MyButton } from './MyButton';
    export type { MyButtonProps } from './MyButton';
  3. Zarejestruj komponent w centralnym eksporcie:

    Dodaj eksport w pliku src/components/index.ts:

    export * from './MyButton';
  4. Zarejestruj komponent w głównym wejściu biblioteki:

    Upewnij się, że w src/index.ts jest:

    export * from './components';
  5. (Opcjonalnie) Dodaj wpis do exports w package.json: Dodaj go tylko wtedy, gdy build rzeczywiscie generuje osobne pliki JS dla tego komponentu:

    "exports": {
      ".": { ... },
      "./MyButton": {
    	 "import": "./dist/components/MyButton/MyButton.js",
    	 "require": "./dist/components/MyButton/MyButton.cjs",
    	 "types": "./dist/components/MyButton/MyButton.d.ts"
      }
    }

    Przy obecnej konfiguracji tego repo publiczne API idzie przez glowne wejscie paczki, a style przez osobny eksport ./styles.css.

  6. Dodaj typy dla CSS Modules (jeśli używasz): Jeśli pojawia się błąd z importem plików .module.css, dodaj plik src/global.d.ts:

    declare module '*.module.css' {
      const classes: { [key: string]: string };
      export default classes;
    }
  7. (Opcjonalnie) Dodaj plik testowy i stories:

    • MyButton.test.tsx — testy komponentu
    • MyButton.stories.tsx — dokumentacja w Storybook
  8. Zbuduj bibliotekę:

    npm run build

Podsumowanie:

  • Każdy komponent ma własny katalog, plik z kodem, eksport i (opcjonalnie) style.
  • Wszystkie komponenty eksportuj przez src/components/index.ts i src/index.ts.
  • Import komponentow dla konsumenta idzie z glownego wejscia paczki, a style z react-spa-comp/styles.css.