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

generator-wow-react

v2.0.7

Published

yeoman generator nextjs project & react tsx components, inspired by https://github.com/TonyDotDev/generator-react-tsx-component

Downloads

62

Readme

Generator Wow React - (Module NPM)

This module will help you to create structural directory folder for generating component, feature. Our case we work on SBDUI Library.

Environment requirement

  • yarn package
  npm install -g yarn
  • node version > 16.17

Concept

When using generator-wow-react you can simply generate your component or feature on your react project application

Generator Settings

You can configure the generator settings by modifying the .yo-rc.json file. Here are the available options:

componentGeneratedDirPath: The directory path where generated components will be placed (e.g., "src/app/components").

featureDirPath: The base directory for feature modules (e.g., "src/app/features").

featureGeneratedFolders: A comma-separated list of subfolders within each feature module (e.g., "services, components, hooks, types"). Use this to segment your code logically.

generateStorybookComponent: Set to true if you want to generate Storybook stories for your components.

generateTestComponent: Set to true if you want to generate test files for your components.

storyFolder: The folder where Storybook stories will be created (e.g., "src/stories").

generateHelperComponent: Set to true if you want to generate helper components.

Register the command

Register the command on your package.json file to recognize the generator as part of your cli

  • open package.json

  • add these line under scripts property

    "scripts": {
      ...
      "wow:component": "yo wow-react:component",
      "wow:feature": "yo wow-react:feature",
    }
  • save the modification

  • run the command using yarn or npm run

    yarn wow:component YourComponentName.Prefix --path /your/custom/path

Basic syntax making component

  yarn wow-component ComponentName

it will make directory folder like this

└── src/
    └── ui/
        └── component/
            └── ComponentName/
                ├── _test_/
                │   └── ComponentName.test.tsx
                ├── story/
                │   ├── ComponentName.story.mdx
                │   └── ComponentName.story.tsx
                ├── ComponentName.module.scss
                ├── ComponentName.tsx
                ├── ComponentNameHelper.ts
                └── index.ts

Custom Path syntax making component

If you want to make a root component grouping example Chart/BarChart, you can use syntax like this

  yarn wow-component RootComponentName/ComponentName

it will make directory folder like this

└── src/
    └── ui/
        └── component/
            └── RootComponentName/
                └── ComponentName/
                    ├── _test_/
                    │   └── ComponentName.test.tsx
                    ├── story/
                    │   ├── ComponentName.story.mdx
                    │   └── ComponentName.story.tsx
                    ├── ComponentName.module.scss
                    ├── ComponentName.tsx
                    ├── ComponentNameHelper.ts
                    └── index.ts

Basic syntax making feature

  yarn wow-feature NameFeature

it will make directory folder like this

└── src/
    └── features/
        └── component/
            ├── FeatureName/
            │   ├── _test_/
            │   │   └── FeatureName.test.tsx
            │   ├── story/
            │   │   ├── FeatureName.story.mdx
            │   │   └── FeatureName.story.tsx
            │   ├── FeatureName.module.scss
            │   ├── FeatureName.tsx
            │   ├── FeaHelpertureName.ts
            │   └── index.ts
            ├── hooks/
            │   └── chart.hook.ts
            ├── services/
            │   └── chart.service.ts
            ├── types/
            │   └── chart.type.ts
            └── index.ts
yarn wow-component OtherFeatureComponent --path src/features/RootFeature

it will make directory folder like this

└── src/
    └── features/
        └── component/
            ├── FeatureName/
            │   ├── _test_/
            │   │   └── FeatureName.test.tsx
            │   ├── story/
            │   │   ├── FeatureName.story.mdx
            │   │   └── FeatureName.story.tsx
            │   ├── FeatureName.module.scss
            │   ├── FeatureName.tsx
            │   ├── FeaHelpertureName.ts
            │   └── index.ts
            ├── hooks/
            │   └── chart.hook.ts
            ├── services/
            │   └── chart.service.ts
            ├── types/
            │   └── chart.type.ts
            └── index.ts
                └── component/
            ├── OtherFeatureComponent/
            │   ├── _test_/
            │   │   └── OtherFeatureComponent.test.tsx
            │   ├── story/
            │   │   ├── OtherFeatureComponent.story.mdx
            │   │   └── OtherFeatureComponent.story.tsx
            │   ├── OtherFeatureComponent.module.scss
            │   ├── OtherFeatureComponent.tsx
            │   ├── FeaHelpertureName.ts
            │   └── index.ts
            ├── hooks/
            │   └── chart.hook.ts
            ├── services/
            │   └── chart.service.ts
            ├── types/
            │   └── chart.type.ts
            └── index.ts

Syntax for making component on specific feature directory

example

yarn wow-component Test --path src\features\AccountInformation\components

How to Use

on your project root directory

1. Installing

using npm

  npm install yo generator-wow-react

using yarn

  yarn add -D yo generator-wow-react

2. Generate component

    yo wow-react:component <ComponentName> -path <AlternativePath>

3. Generate Feature

    yo wow-react:feature <FeatureName> -path <AlternativePath>

4. Store your configuration

generator-wow-react initially save the configuration in yo-rc.json

"generator-wow-react": {
    "featureDirPath": "src/main/webapp/app/modules",
    "featureGeneratedFolders": "services, components, hooks, types, utils, __tests__",
    "componentGeneratedDirPath": "src/main/webapp/app/components",
    "generateTestComponent": true,
    "generateStorybookComponent": false
  }

update the configuration based on your needs

How to Enhance

1. Clone from git

git clone https://github.com/awim/generator-wow-react.git

2. Clone from git

yarn install

3. Connect to your local project

  • Go to your root directory generator-wow-react, and in terminal type "yarn link". This section is to register our package (generator-wow-react) to yarn registry local.
yarn link
  • Go to our root directory of your project (our case is SBDUI root directory), and in terminal type "yarn link generator-wow-react". This section is to use our package (generator-wow-react) on our project (SBDUI)
yarn link generator-wow-react