-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrdxf.sh
More file actions
executable file
·52 lines (38 loc) · 898 Bytes
/
rdxf.sh
File metadata and controls
executable file
·52 lines (38 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
Lword=$1
Cword=$(tr a-z A-Z <<<${Lword:0:1})${Lword:1}
mkdir $1
cd $1
# actions
echo "import { $1ActionTypes } from './$1.action.types'
" >>$1.actions.js
# actionTypes
echo "export const $1ActionTypes = {
}
" >>$1.actionTypes.js
# reducer
echo "import { $1ActionTypes } from './$1.action.types'
const initialState = {
}
export const $1 = (state = initialState, { type, payload }) => {
switch (type) {
case $1ActionTypes.:
return { ...state, ...payload }
default:
return state
}
}
" >>$1.reducer.js
# selector
echo "import { createSelector } from 'reselect'
export const select$Cword = store => store.$1
" >>$1.selector.js
# saga
if [[ $2 == "saga" ]]; then
echo "import {all, call} from 'redux-saga/effects'
import { $1ActionTypes } from './$1.action.types'
export function* $1Sagas() {
yield all([call()])
}
" >>$1.saga.js
fi