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

@mihanizm56/webpack-magic-redux-modules

v0.0.7

Published

webpack redux utils

Downloads

4,486

Readme

@mihanizm56/webpack-magic-redux-modules

Webpack loader to magically incapsulate your actions with the your module-name (folder name) prefix

Redux actions, sagas and reducers must be written in the example below (according to the RegExps below)

Files that are watched by replacers

// for actions
const actionsRegExp = /actions\.[jt]s$/;
// for reducers
const reducersRegExp = /reducer\.[jt]s$/;
// for sagas
const sagasRegExp = /saga\.[jt]s$/;
// for constants
const constantsRegExp = /_?constants\.[jt]s$/;

Example of usage

// actions.js (or .ts) in dir redux/some-module/actions.js
export const FETCH_PAYMENTS_ACTION_SAGA = 'FETCH_PAYMENTS_ACTION_SAGA';
// 'FETCH_PAYMENTS_ACTION_SAGA' transforms to 'some-module_FETCH_PAYMENTS_ACTION_SAGA'
export const fetchPaymentsActionSaga = payload => ({
  type: FETCH_PAYMENTS_ACTION_SAGA,
  payload,
});

export const SET_PAYMENTS_LOADING_START = 'SET_PAYMENTS_LOADING_START';
// 'SET_PAYMENTS_LOADING_START' transforms to 'some-module_SET_PAYMENTS_LOADING_START'
export const setPaymentsLoadingStartAction = () => ({
  type: SET_PAYMENTS_LOADING_START,
});
// reducer.js (or .ts) in dir redux/some-module/reducer.js
export const REPORT_INFO_REDUCER_NAME = 'REPORT_INFO_REDUCER_NAME';
// 'REPORT_INFO_REDUCER_NAME' transforms to 'some-module_REPORT_INFO_REDUCER_NAME'
// load-details-list-table-watcher-saga.js (or .ts) in dir redux/some-module/load-details-list-table-watcher-saga.js.js
export const LOAD_DETAILS_LIST_TABLE_WATCHER_SAGA =
  'LOAD_DETAILS_LIST_TABLE_WATCHER_SAGA';
// 'LOAD_DETAILS_LIST_TABLE_WATCHER_SAGA' transforms to 'some-module_LOAD_DETAILS_LIST_TABLE_WATCHER_SAGA'
// webpack.config.js
const ActionsLoaderConfig = require('@mihanizm56/@mihanizm56/webpack-magic-redux-modules/lib/loader-config');

module.exports = {
  // your config ...
  module: {
    rules: [
      // your rules ...
      ActionsLoaderConfig()
    ]
  }
};

Be careful - all redux modules must be placed in dir "redux" or "_redux"

We have a special parameter that adds prefix from package.json "name" field

// webpack.config.js
const ActionsLoaderConfig = require('@mihanizm56/@mihanizm56/webpack-magic-redux-modules/lib/loader-config');

module.exports = {
  // your config ...
  module: {
    rules: [
      // your rules ...
      ActionsLoaderConfig({
        withPkgJsonName: true
      })
    ]
  }
};

// actions.js (or .ts) in dir redux/some-module/actions.js
export const FETCH_PAYMENTS_ACTION_SAGA = 'FETCH_PAYMENTS_ACTION_SAGA';
// 'FETCH_PAYMENTS_ACTION_SAGA' transforms to '<package.json.name>_some-module_FETCH_PAYMENTS_ACTION_SAGA'
export const fetchPaymentsActionSaga = payload => ({
  type: FETCH_PAYMENTS_ACTION_SAGA,
  payload,
});