1.1.19 • Published 2 years ago

@mongez/react-wizard v1.1.19

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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

OptionDescriptionRequiredCacheable
--appApplication directory name that will contain the moduleYes If not cachedYes
--styleDefines the generated component style mode, it can be styled | scss | all, defaults to allNoYes

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

OptionDescriptionRequiredCacheable
--appApplication directory name that will contain the moduleYes If not cachedYes
--moduleModule name in the app directory.Yes If not cachedYes
--styleDefines the generated component style mode, it can be styled | scss | all, defaults to allNoYes

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.
1.1.19

2 years ago

1.1.18

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.17

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.2

2 years ago