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

@zaferatli/ra

v1.0.7

Published

React Native Redux Auto Creator CLI Kit

Downloads

1

Readme

Redux Creator Usage

We use this creator for add new request to action, reducer and saga files automatically.

Installation

npm i @zaferatli/ra
npx @zaferatli/ra --actionName='GET_USERS' --dataStatus='true' --requestType='get' --createExample

After install Redux creator, you need add

Be sure of these before tart

Reducer.js

1)//end string on reducer end of the initialState array. Example Image

2)default: string on reducer end of the reducer part. Example Image

Saga.js

1)function* handler() { string on saga function. Example Image

2)export {handler}; string on saga end function. Example Image

After these steps you can create request strings.

Get request for slider and response return data

npx @zaferatli/ra --actionName='GET_SLIDER' --dataStatus='true' --requestType='get' ---clearAllState

Post request for edit user and response not return data

npx @zaferatli/ra --actionName='UPDATE_USER_PROFILE' --dataStatus='false' --requestType='post' --clearAllState

First time of use cli tools ask from you define path of Action, Reducer and Saga files location.

Example Folder Structure:

->my-awesome-project
    ->__tests__
    ->.bundle
    ->android
    ->app
        ->redux
            ->action.js
            ->reducer.js
            ->sagas.js
            ->store.js
    ->ios
    ->node_modules
    etc...

you need to defined like

./app/redux/action.js
./app/redux/reducer.js
./app/redux/sagas.js

as Image

How It Works?

This creator logic:

  1. Create template string for Action, Reducer and Saga

  2. Find locator string

    • Action

      • End of the page
    • Reducer

      • State part we need to add
      //end

      so creator find //end string and change with template string + '//end' string.

      • Reducer part we use
      default:

      string, we find that string and we change template string + 'default:' string

    • Saga

      • Function defined part
      function* handler() {

      string, we find that string and change 'unction* handler() {' + sagaHeader template string

      • Saga function part
      export {handler};

      string, we find that string and change sagaDetail template + 'export {handler};' string

    You can change this locator with parameters.

  3. Rewrite file.

Parameters

| Parametre | Tip | Açıklama | | :-------- | :------- | :-------------------------------- | | --actionName= | string | Action name of request, we use this keyword in action, reducer and saga | | --dataStatus== | string | If you get any data from request, you can set with 'true', default is 'false'. Reducer and saga will be changed | | --requestType== | string | Request type, 'get', 'post', 'put' etc. this will be add axios request type | | --createTemplateLocal | string | When you add this parameter, template files will be create in root dir as ra-template, you can edit templates. After you call this parameter again, files will be overwritted. | | --resetPath | string | RA cli need to define action, reducer and saga files locations. First of time use cli prompt ask to you define this folders. When you need to change that locations add this parameters and cli ask you again. | | --clearAllState | string | This parameter is clear all local config, createTemplateLocal, Files paths etc. everything will be reset | | --reducerStateLocator= | string | Reducer state part locator, default is '//end' string. | | --reducerLocator= | string | Reducer part locator, default is 'default:' string. | | --sagaHeaderLocator= | string | Saga header locator, default is 'function* handler() {' string. | | --sagaLocator= | string | Saga function locator, default is 'export {handler};' string. |

Templates

If you want to change Action, Reducer, Saga string template you can use

npx @zaferatli/ra --actionName='UPDATE_USER_PROFILE' --dataStatus='false' --requestType='post' --createTemplateLocal

After this command, cli tool will be create ra-template folder on root directory. And you change change templates as you wish.

--createTemplateLocal

Parameter overwrite ra-template folder. When you change ra-template/templates you shouldn't use this parameter again.

Locators Change

This tools works with string replace logic. We give some flag locations, cli create template strings and replace flag locations strings. Because of that, you may need to change locators. You can change like that.

Actions

Cli tool add bottom of action.js file. So we don't use any locator on actions.

### Reducer

  1. State Part

Default is //end

if you wish to change

npx @zaferatli/ra --actionName='UPDATE_USER_PROFILE' --dataStatus='false' --requestType='post' --reducerStateLocator='//notToEndOfState'
  1. Reducer Part

Default is default:

if you wish to change

npx @zaferatli/ra --actionName='UPDATE_USER_PROFILE' --dataStatus='false' --requestType='post' --reducerLocator=' default : '

Saga

  1. Function Header Part

Default is function* handler() {

if you wish to change

npx @zaferatli/ra --actionName='UPDATE_USER_PROFILE' --dataStatus='false' --requestType='post' --sagaHeaderLocator='function* notHandler(){'
  1. Saga Function Part

Default is export {handler};

if you wish to change

npx @zaferatli/ra --actionName='UPDATE_USER_PROFILE' --dataStatus='false' --requestType='post' --sagaLocator='export {handler};'

Gif

Example Gif

License

MIT

"Buy Me A Coffee"