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

@lr0pb/component

v0.4.2

Published

⚡ Bootstrap React component folder structure using CLI

Downloads

5

Readme

CLI for bootstraping component folder structure for TypeScript React projects that use SCSS Modules for styling and React Cosmos for visual testing

Install

npm i -D @lr0pb/component

Using

Use npx c to create component in the current working directory:

$ npx c ui/Button
            |
            v
src/ui/components/Button

It uses the next pattern for the component path:

$ npx c [folders]/[name]
               |
               v
[sourceDir]/[folders]/components/[name]

You could switch source directory by --source-dir [dir] flag and you could remove adding nested components/ folder by --exact-path (-e) flag

Component file structure

Using next flags you could tweak what files will have your next component:

  --no-types              Separated types file
  -s, --styles            Style files (default: false)
  --no-fixture            Fixtures object file
  -f, --single-fixture    Single fixture file (default: false)
  -d, --decorator         Cosmos decorator (default: false)
  -e, --exact-path        Create exact folder (default: false)

All them you can apply via multi select interface:

Use -y flag to create component immediatelly without operating with select interface

Component have next file structure:

Button
  ├ Button.tsx                 base file
  ├ Button.fixture.tsx         --no-fixture to opt out
  ├ Button.module.scss         --styles
  ├ Button.module.scss.d.ts    --styles
  ├ Button.types.ts            --no-types to opt out
  ├ cosmos.decorator.tsx       --decorator
  └ index.ts                   base file

Types declaration file for styles is the same you get from Typed CSS Modules with --namedExports flag

Project was created using Pastel, Ink, Ink UI and Zod