diff --git a/README.md b/README.md index 4f083ec..366b04a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ * [components](docs/component.md) * [middleware](docs/middleware.md) * [reducers](docs/reducer.md) +* [selectors](docs/selector.md) -We're also working on generating _selectors_, _SCSS stylesheets_ and an _initial project setup_ for the redux store. +We're also working on generating _SCSS stylesheets_ and an _initial project setup_ for the redux store. The code generated by *zwen-react* follows our [best practices](docs/introduction.md) at Zweitag and is therefore highly opinionated. @@ -21,6 +22,7 @@ The code generated by *zwen-react* follows our [best practices](docs/introductio - [Components](#components) - [Middleware](#middleware) - [Reducers](#reducers) + - [Selectors](#selectors) 1. [Advanced Usage](#advanced-usage) - [Sorting](#sorting) 1. [Architecture](#architecture) @@ -58,9 +60,9 @@ If you prefer tabs or any other kind of indentation you may define it here. ## Usage ### Actions ``` -zwen action path/to/actionName +zwen action path/to/myAction ``` -This will create or update the action creators (`src/actions/path/to/creators.js`) and tests (`src/actions/path/to/creators.test.js`) with the `actionName`. If you choose to, it will also create or update `src/actions/path/to/types.js` with the type `ACTION_NAME`. +This will create or update the action creators (`src/actions/path/to/creators.js`) and tests (`src/actions/path/to/creators.test.js`) with an action called `myAction`. If you choose to, it will also create or update `src/actions/path/to/types.js` with the type `MY_ACTION`. It will also wire up exports along the path and create new `index.js` files if they don't exist. @@ -68,17 +70,17 @@ It will also wire up exports along the path and create new `index.js` files if t ### Components ``` -zwen component path/to/component +zwen component path/to/myComponent ``` -This will create a new component file (`src/components/path/to/Component.js`). You can choose if the component should be connected to the store, or – if not – should be set up with props. +This will create a new component file (`src/components/path/to/MyComponent.js`). You can choose if the component should be connected to the store, or – if not – should be set up with props. You also have the option to generate a class component by supplying a flag: ``` -zwen component path/to/component --classComp +zwen component path/to/myComponent --classComp ``` or ``` -zwen component path/to/component -c +zwen component path/to/myComponent -c ``` ([More about components](docs/component.md)) @@ -95,15 +97,25 @@ It will also export the new middleware from the folder's `index.js` file. ### Reducers ``` -zwen reducer path/to/reducer +zwen reducer path/to/myReducer ``` -This will create a new reducer file (`src/reducers/path/to/reducer.js`) and a test file (`src/reducers/path/to/reducer.test.js`). +This will create a new reducer file (`src/reducers/path/to/myReducer.js`) and a test file (`src/reducers/path/to/myReducer.test.js`). It will also wire up exports along the path and create new `index.js` files if they don't exist. ([More about reducers](docs/reducer.md)) ([More about selectors](docs/selector.md)) +### Selectors +``` +zwen selector path/to/mySelector +``` +This will create or update the file located at `src/selectors/path/to.js` and a test file (`src/selectors/path/to.test.js`). The new selector will be named `mySelector`. It will also wire up the imports and create new `index.js` files if they don't exist. + +You will get a list with all selectors defined in reducer files (we're working on adding complex selectors to that list as well), from which you choose the ones to use in your new selector. Type `done!` when your selection is complete. + +([More about selectors](docs/selector.md)) + ## Advanced Usage ### Sorting When generating exports in `index.js` files *zwen-react* automatically sorts everything alphabetically. This might become a problem as soon as you want to have a certain order to your exports (e.g. middleware). diff --git a/package-lock.json b/package-lock.json index 15b1e43..d05d197 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "zwen-react", - "version": "0.8.2", + "version": "0.8.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b1e5090..e2e7e58 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zwen-react", "description": "Code generator CLI for projects using react and redux", - "version": "0.8.2", + "version": "0.8.3", "author": "Zweitag GmbH @zweitag", "contributors": [ "Alex Kott ",