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

quick-library

v1.0.3

Published

A CLI tool to generate React, Angular, Vue library (React for now)

Downloads

6

Readme

Quick Library

A CLI tool to generate React, Angular and Vue library and publish it on npm.

npm npm David

preview

Right now, this tool only supports creation of React library. I am working on others.

Install CLI tool

npm install --global quick-library

Use quick-library --help to see command line options.

$ quick-library --help

Usage: quick-library [options]

Options:
  -v, --version  output the version number
  --no-install   Do not install npm dependencies
  --no-git       Do not initialize git repository
  -h, --help     output usage information

Create new library

Use command quick-library which will prompt some options for library configuration. You can also provide --no-install flag to prevent installation of npm packages as wll as --no-git flag to prevent initialization of git repository.

$ quick-library

? Enter library name new-react-lib
? Enter library description library description
? Select a library template React
? Include CSS in JavaScript bundle? No, extract to another file?
? Select git reposiory host GitHub
? Enter github username thatisuday
? Enter GitHub repository name new-react-lib
✔ Initialized git repository new-react-lib
➤ Installing npm packages

Start developing your library

Once library is created, you will be shown following instructions.

Congratulations, new-react-lib library has been created. 
Use bellow commands to start working on your project.
$ cd new-react-lib/			‣ enter directory
$ npm run start				‣ start build and watch
$ npm run start:demo		        ‣ start demo server
$ npm publish				‣ publish library

Once you enter the library directory, you have following files to work with

new-react-lib
├── babel.config.js
├── demo
|  ├── index.html
|  ├── index.js
|  └── webpack.config.js
├── dist
|  ├── index.js
|  └── index.js.map
├── package-lock.json
├── package.json
├── postcss.config.js
├── src
|  ├── MyComponent.js
|  ├── index.js
|  └── styles.scss
└── webpack.config.js

Open terminal window and use command npm run start start webpack build which will watch file changes in src and output to dist. At the same time, use command npm run start:demo which will watch files from demo/ directory and run preview in browser.

Publish your library

Once you are done with your development, dist directory contains your release ready library files. You can use npm publish command to publish your library to npm official registry.

Using your library

Once you publish your library, people can install your library using below command

npm install --save library-name

You should only import named components like for example, in React library, a component can be imported like

import { MyComponent } from 'library-name'; 

const App = (props) => <MyComponent message={props.message} />;

If you have opted for Include CSS in JavaScript bundle command line option while creating the library, then library users don't have to worry about importing css separately. But if you had extracted css to different file, then library users must include css either by importing in their JavaScript like import 'library-name/styles.css'; or in their sass like @import '~library-name/styles.css';


Contribute to this tool

I have managed to create React template but I need help with Angular and Vue to integrate these templates in this tool. Fork this repository and give merge request in you have worked on it.