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

create-phen-component

v0.4.7

Published

Creates React components based on Phenomenon.Studio code style

Downloads

4

Readme

create-phen-component

Simple utility for adding new React component with Phenomenon.Studio style.

Features

  • Creating folder

  • Creating all the component files:

    • Root file
    • Types file
    • Module CSS file
    • index file with exports
  • Typescript only

Quickstart

Install via NPM:

# Using Yarn:
$ yarn global add create-phen-component

# or, using NPM
$ npm i -g create-phen-component

cd into your project's directory, and try creating a new component:

$ create-phen-component MyNewComponent

Your project will now have a new directory at path/to/components/folder/MyNewComponent. This directory has minimum 4 files:

// `MyNewComponent/MyNewComponent.tsx`
import { memo } from 'react';
import clsx from 'clsx';
import type { MyNewComponentProps } from './types';
import s from './MyNewComponent.module.css';

const MyNewComponent: React.FC<MyNewComponentProps> = ({ className }) => {
	return <div className={clsx(s.wrap, className)}>{MyNewComponent}</div>;
};

export default memo(MyNewComponent);
// `MyNewComponent/types.ts`
export type MyNewComponentProps = {
	className?: string;
};
// `MyNewComponent/index.ts`
export * from './MyNewComponent';
export { default } from './MyNewComponent';
export type * from './types';
/* `MyNewComponent/MyNewComponent.module.css` */
.wrap {
}

Storybook Stories If you enable Storybook file creation, it will create Storybook 7.0.7 template;

// `MyNewComponent/MyNewComponent.stories.tsx`
import type { Meta, StoryObj } from '@storybook/react';
import type { MyNewComponentProps } from './types';
import MyNewComponent from './MyNewComponent';

const meta = {
	title: 'ui/MyNewComponent',
	component: MyNewComponent,
	tags: ['autodocs']
} satisfies Meta<typeof MyNewComponent>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Base: Story = {
	args: {} as MyNewComponentProps
};

API Reference

Storybook enable

If you would like to create Storybook template in the component, use:

  • --story — or aliased (--s)

Usage:

Command line: create-phen-component MyNewComponent or create-phen-component MyNewComponent --story in the folder you want the component to be created

Platform Support

This has only been tested in macOS. Windows is a big question mark.