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

@mongez/react-wizard

v1.1.19

Published

A Wizard Tool For React Js

Downloads

12

Readme

Mongez React Wizard

A Wizard tool to generate and handle react apps.

Installation

yarn add @mongez/react-wizard

OR

npm i @mongez/react-wizard

Please note that a .mongez directory will be created if not found to store cached configurations.

Usage

The package works through command line for the time being, Here are the available commands.

Generate New Module Command

npx engez module contact-us --app front-office

This command will create a new module in src/apps/front-office.

The --app option must be sent otherwise an error will raise.

The structure of the created module will be as follows:

|--- src
  |--- apps
     |-- front-office
        |-- contact-us
            |-- components
                |-- ContactUsPage
                    |-- index.ts
                    |-- ContactUsPage.tsx
                    |-- index.module.scss
                    |-- styled.tsx
                    |-- types.ts
            |-- services
                |-- service.ts
            |-- utils
                |-- data.ts
            |-- hooks
                |-- index.ts
            |-- locales.ts
            |-- routes.ts
            |-- provider.ts

The locales.ts and routes.ts files are imported to provider.ts

Utils and hooks directories their names express themselves, hooks for react hooks, utils for flags / data / functions / helpers...etc.

The services directory is for ajax requests, by default it creates a Restful Service Class.

routes.ts is generated and assuming there is apps/{appName}/helpers/urls which exports an object that contains all application routes.

Also, publicRoutes function which is imported from apps/{appName}/helpers/router.

For component structure, check the following section.

Available Options

| Option | Description | Required | Cacheable | |----------- |------------------------------------------------------------------------------------------------------ |---------- |---------- | | --app | Application directory name that will contain the module | Yes If not cached | Yes | | --style | Defines the generated component style mode, it can be styled | scss | all, defaults to all | No | Yes |

Generate New Component Command

similarly to generating new module, except this command will generate only component structure.

npx engez component ContactUsForm --module contact-us --app front-office

This will generate a new component directory inside src/apps/front-office/contact-us/components called ContactUsForm.

Please note all generated components names are transformed into StudlyCase automatically.

Each Component Structure Looks Like:

|-- ComponentName
    |-- index.ts
    |-- ComponentName.tsx
    |-- index.module.scss
    |-- styled.tsx
    |-- types.ts

Let's see in depth the previous structure.

  • index.ts: is just for exposing the component to be used outside, this file exports the component and its types.
  • index.module.scss: the scss module file to ensure component encapsulation.
  • styled.tsx: If you're using styled components, put it here.
  • types.ts: Component props and any other related types to the component, by default it has the ComponentProps type and is exported to be used in the component file.
  • ComponentName.tsx: is the actual component file where you put your jsx code inside it, that file automatically imports the sass module file and types file.

The final generated module and component will be like:

|--- src
  |--- apps
     |-- front-office
        |-- contact-us
            |-- components
                |-- ContactUsPage
                    |-- index.ts
                    |-- ContactUsPage.tsx
                    |-- index.module.scss
                    |-- styled.tsx
                    |-- types.ts
                |-- ContactUsForm
                    |-- index.ts
                    |-- ContractUsForm.tsx
                    |-- index.module.scss
                    |-- styled.tsx
                    |-- types.ts
            |-- services
                |-- service.ts
            |-- utils
                |-- data.ts
            |-- hooks
                |-- index.ts
            |-- locales.ts
            |-- routes.ts
            |-- provider.ts

Available Options

| Option | Description | Required | Cacheable | |----------- |------------------------------------------------------------------------------------------------------ |---------- |---------- | | --app | Application directory name that will contain the module | Yes If not cached | Yes | | --module | Module name in the app directory. | Yes If not cached | Yes | | --style | Defines the generated component style mode, it can be styled | scss | all, defaults to all | No | Yes |

Cached Data

By default, the --app --module and --style values are cached from the last command you created, this will make it easier to not pass the option every time you want to create a module or a component.

Change Log

  • V1.1.10 (10 May 2022)
    • Beta Version

TODO

  • Create mongez-wizard.js file for advanced configurations.
  • Allow more customization on the generated files.
  • Expose stub generator so developers can make their own generated files.
  • Introduce @mongez/react-atom to the generated module.
  • Allow generating components inside components.
  • Add tests to the module.
  • Add tests and storybook to the component.