Skip to content

Commit

Permalink
Merge pull request #43 from wednesday-solutions/feat/remove-useInject…
Browse files Browse the repository at this point in the history
…Saga

remove useInjectSaga
  • Loading branch information
alichherawalla authored Feb 1, 2022
2 parents cde8ada + ff205c8 commit 2fc717a
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 377 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ A CLI tool that works with the react template and allows you to scaffold tests,
- [Container](generated-files/container)
- [Component](generated-files/component)
- [Loadable](generated-files/loadable)
- [InjectSaga utils](generated-files/inject-saga)
- [Test-util](generated-files/test-util)

## Generating containers with tests and stories
Expand Down
5 changes: 0 additions & 5 deletions bin/react-generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const CONTAINER = 'container';
const WEBPACK_BASE_BABEL = 'webpackBaseBabel';
const TEST_UTIL = 'tUtil';
const LOADABLE = 'loadable';
const INJECT_SAGA = 'injectSaga';

const generator = path.join(__dirname, '../generators/index.js');
const plopGen = ['--plopfile', generator];
Expand Down Expand Up @@ -124,9 +123,6 @@ switch (commandLineArgs[0]) {
case 'gloadable':
execShell(['-f', ...plopGen, LOADABLE, ..._.drop(commandLineArgs)]);
break;
case 'ginjectsaga':
execShell(['-f', ...plopGen, INJECT_SAGA, ..._.drop(commandLineArgs)]);
break;
case '--help':
shell.echo(
`Generate tests for existing and new react components\n\n` +
Expand All @@ -146,7 +142,6 @@ switch (commandLineArgs[0]) {
`--all: Adding tests for all existing containers or components.\n` +
`gtutil: Create a test util file with some test utility functions.\n` +
`gloadable: Create a loadable utility file that uses lazy and Suspense from React to lazyload your containers.\n` +
`ginjectsaga: Create an injector for sagas that work with hooks.\n\n` +
`-------\n\n` +
`Creating a test by specifying type, path and name: react-generate gt component src/app Button\n` +
`Creating a test for an existing component by specifying path and name: react-generate gtcon src/app Button\n` +
Expand Down
13 changes: 7 additions & 6 deletions generated-files/container/HomeContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ import { Helmet } from 'react-helmet';

import { createStructuredSelector } from 'reselect';
import { compose } from 'redux';
import { useInjectSaga } from '@utils/injectSaga';
import selectHomeContainerDomain from './selectors'
import { injectSaga } from 'redux-injectors';
import selectHomeContainerDomain from './selectors';
import saga from './saga';

export function HomeContainer() {
useInjectSaga({ key: 'homeContainer', saga });

return (
<div>
<Helmet>
Expand All @@ -34,7 +32,7 @@ HomeContainer.propTypes = {};

const mapStateToProps = createStructuredSelector({
homeConatiner: selectHomeContainerDomain(),
})
});

function mapDispatchToProps(dispatch) {
return {
Expand All @@ -47,6 +45,9 @@ const withConnect = connect(
mapDispatchToProps,
);

export default compose(withConnect)(HomeContainer);
export default compose(
withConnect,
injectSaga({ key: 'homeContainer', saga }),
)(HomeContainer);

export const HomeContainerTest = compose(injectIntl)(HomeContainer);
60 changes: 0 additions & 60 deletions generated-files/inject-saga/injectSaga.js

This file was deleted.

90 changes: 0 additions & 90 deletions generated-files/inject-saga/sagaInjectors.js

This file was deleted.

2 changes: 0 additions & 2 deletions generators/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const containerGenerator = require(`./container/${
}/index.js`);
const testUtilGenerator = require(`./testUtil/index.js`);
const loadableUtilGenerator = require(`./loadable/index.js`);
const injectSagaUtilGenerator = require(`./injectSaga/index.js`);
const webpackBaseBabelGenerator = require(`./webpack/base/babel/index.js`);

/**
Expand All @@ -31,7 +30,6 @@ module.exports = plop => {
plop.setGenerator('container', containerGenerator);
plop.setGenerator('tUtil', testUtilGenerator);
plop.setGenerator('loadable', loadableUtilGenerator);
plop.setGenerator('injectSaga', injectSagaUtilGenerator);
plop.setGenerator('webpackBaseBabel', webpackBaseBabelGenerator);

plop.addHelper('directory', comp => {
Expand Down
42 changes: 0 additions & 42 deletions generators/injectSaga/index.js

This file was deleted.

60 changes: 0 additions & 60 deletions generators/injectSaga/injectSaga.js.hbs

This file was deleted.

Loading

0 comments on commit 2fc717a

Please sign in to comment.