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 🙏

© 2024 – Pkg Stats / Ryan Hefner

estoesunapruebaojalafunca

v0.1.0

Published

Template and quick-starter to create modern React libraries using Rollup.

Downloads

1

Readme

React component library template/boilerplate

Template and quick-starter to create your own modern React library includes awesome features and bandled using Rollup.

Note: At date of writing this (April 2023), since the create-react-library tool is no longer actively maintained (https://github.com/transitive-bullshit/create-react-library#readme) then I thought about creating this boilerplate to help bootstrap a modern react library with some nice features

Note

This repository created for:

  1. Help to bootstrap your own react library with some nice features and without bothering with configuration and saving time.
  2. Learning purposes (especially how to bundle complicated things with Rollup).

Intro

  • This boilerplate uses Rollup as a bundler https://rollupjs.org/

As mentioned in readme of create-react-library there are some others tools(you can use it as a bundler) as an alternative to Rollup like tsup, tsdx, or microbundle.

see also this artice https://transitivebullsh.it/javascript-dev-tools-in-2022#823feddaa1bb4edea19042852b0a5b54

Features

  • Rollup for bundling
  • Bundles commonjs and es module formats
  • Jest & React Testing Library : For testing our components
  • Support for TypeScript
  • Sourcemap creation
  • Support of CSS/SASS: For exporting components with style
  • Storybook: For testing our components within the library itself as we design them
  • Supports complicated peer-dependencies (example here is Antd so here the power of rollup-plugin-peer-deps-external we can use complicated peer dependency such Antd without having it bundled as a part of your module.)
  • Optimizing bundle size: @rollup/plugin-terser A Rollup plugin to generate a minified bundle with terser.
  • Automatically externalize peerDependencies in a rollup bundle, thanks to rollup-plugin-peer-deps-external
  • Eslint
  • Deploy Storybook to GitHub Pages

Getting started

  • Copy over the template by cloning this repository and install its dependencies:
git clone https://github.com/MidoAhmed/rollup-react-library-starter.git
cd rollup-react-library-starter
npm install

Development:

  • Storybook:
    • Storybook gives you an easy way to see and use your components while working on them in your library project, without having to build an unnecessary testing page just to display them.

      npm run storybook # runs the host Storybook application locally for quick and easy testing

Now, anytime you make a change to your library or the stories, the storybook will live-reload your local dev server so you can iterate on your component in real-time.

  • Rollup watch and build:

    • for Local development run rollup to watch your src/ module and automatically recompile it into dist/ whenever you make changes.

      npm run dev # runs rollup with watch flag

Scripts:

  • npm run build : builds the library to dist
  • npm run dev : builds the library, then keeps rebuilding it whenever the source files change.
  • npm test : tests the library and show the coverage.
  • npm run lint : runs eslint.
  • npm run storybook : runs the host Storybook application locally for quick and easy testing
  • npm run build-storybook : builds a static HTML/JS bundle that can easily be hosted on a remote server, so all members of your team can try your components.
  • npm run deploy-storybook : build & deploy the storybook to GitHub Pages

Publishing to npm:

publish to GitHub Packages registry:

  • you need to have this in your ~/.npmrc
registry=https://registry.npmjs.org/
@YOUR_GITHUB_USERNAME:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_AUTH_TOKEN

and run:

npm publish

Tutorials and inspirations used to create this boilerplate

  • big thanks to this tuto and his author : https://dev.to/alexeagleson/how-to-create-and-publish-a-react-component-library-2oe#adding-scss

License

MIT.