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

@mimodev/new-component

v1.0.0

Published

Automatically generate React components

Downloads

2

Readme

new-component

Automatically generate boilerplate for new React component

~~Shamelessly stolen~~ heavily influenced by Josh Comeau's new-component. Create's a new component in your components folder.

Features

  • Simple CLI interface for adding React components.
  • Uses Prettier to stylistically match the existing project.
  • Offers global config, which can be overridden on a project-by-project basis.
  • Colourful terminal output!

Installation


Install via NPM:

# Using NPM:
npm i -g @mimodev/new-component

# Using Yarn:
yarn global add @mimodev/new-component

Usage


  nc Button

This will create the below files:

src/components/Button/index.js

  export const Button = () => {
  return <div />
}

src/components/Button/Button.jsx

export * from './Button'

Configuration


Configuration can be done accompolished in 3 different ways:

  • Creating a global .nc-config.json in your home directory (~/.nc-config.json).
  • Creating a local .nc-config.json in your project's root directory.
  • Command-line arguments.

The resulting values are merged, with command-line values overwriting local values, and local values overwriting global ones.

Options


Type

Control the type of component created:

  • functional for a functional component (default)
  • class for traditional class-based component
  • pure for a PureComponent class

Usage

Command line: --type <value> or -t <value>
JSON Config: { "type": <value> }

Directory

Controls the directory for the created component. Defaults to src/components

Usage

Command line: --dir <value> or -d <value>
JSON Config: { "dir": <value> }

Add Default export

Adds a Default export to the component. Defaults to false

Usage

Command line: --default
JSON Config: { "default": true }

File Type

Determine file extension type to use.

  • javascript Standard javascript extensions (default)
  • typescript Use typescript extensions

Usage

Command line: --extension <value> or -x <value>
JSON Config: { "extension": <value> }

Prettier Config

Set Prettier configuration so component is formatted as you like. Defaults to Prettier defaults.

JSON Config: { "prettierConfig": { "key": "value" } }

Platform Support


This has only been tested on Windows. I think it should be fine for macOS and linux, but it has yet to be tested.