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

@qbnq/ui

v0.0.1

Published

Example React UI Library built with Rollup.js

Downloads

1

Readme

React UI Library

This is template for creating React JS library. The library can be all TypeScript, all JavaScript, or a mix of both. It also shows how you can manage a SCSS theme in your library for consumption across applications. You can remove this if you don't have a need for this and opt to include CSS inside your components.

It demonstrates the following:

  1. Using Rollup.js to build ES and Common JS modules.
  2. Bundling images in a library.
  3. Demonstrates one approach for managing a CSS theme across consumers of this library.
  4. A demo application that uses the library.
  5. NPM scripts for live reload of the library during development.
  6. Use of jest and @testing/library for React.

I try to update the dependencies frequently, but if you need to use older version of things like React, you should be able to downgrade.

How to use.

This library isn't published publicly, but can be experimented with locally. Here are the steps:

  1. Run npm i in the root folder.
  2. Run npm link to add the library to your local npm modules.
  3. Run npm run build:watch to build the library and watch for changes.
  4. Run npm i in the demo folder.
  5. Run npm link @pcalouche/react-ui-lib in the demo folder to link the library to your local npm modules.
  6. Run npm run start in the demo folder to load the demo.

Run npm run build from the root folder to build the library. This creates dist folder which contains everything that would be published to npm.

Note: If this library was available in a repository, demo's package.json would include "@pcalouche/react-ui-lib": "1.0.0" as a dependency.

Avoiding Multiple Instances Warning With React Hooks

When using npm link @pcalouche/react-ui-lib to develop your library with the demo or another consuming application you may run across React invalid hook call errors.

React Invalid Hook call

This happens when you're using React hooks in your consuming application. The application becomes confused between the React installed under node_modules folder and React under the node_modules/@pcalouche-react-ui-lib/node_modules folder. The latter is created by the npm link @pcalouche/react-ui-lib command. The solution is to give your consuming application a hint on which instance of React to use when you have are using npm link. This is not an issue when you install the library from a npm repository. Only when using npm link. The demo uses Create React App. I don't want to eject the config because I like the default setup it provides for me. Thankfully Craco - Create React App Configuration Override exists. See the script configuration in package.json and the craco.config.js on how it's configured. If you're using your own webpack configuration and not Create React App, that's ok too. You'll just need to add an alias references to your webpack config. You'll need to do this for any other library that you bring that has React hooks if your application accesses those hooks. Some common ones are react-router-dom and formik.

TypeScript Only Library Steps

  1. No changes needed.

JavaScript Only Library Steps

  1. Set allowJs to true in tsconfig.json
  2. Convert or remove the TypeScript files.

Mix of TypeScript and JavaScript Library Steps

  1. Set allowJs to true in tsconfig.json
  2. Convert or remove the TypeScript files as needed.