-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths2s.config.js
61 lines (59 loc) · 1.76 KB
/
s2s.config.js
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
53
54
55
56
57
58
59
60
61
// @flow
const path = require('path')
const cwd = process.cwd()
const getRootDir = (...x) => path.resolve(cwd, 'src', ...x)
const getTyepDir = x => getRootDir('types', x)
const rootReducerPath = getRootDir('reducer.js')
const rootActionPath = getTyepDir('action.js')
const rootStatePath = getTyepDir('state.js')
module.exports = {
watch: './**/*.js',
plugins: [
{
test: /actionTypes.js$/,
plugin: ['s2s-action-types', { removePrefix: 'src/containers' }],
},
{
test: /actionTypes.js$/,
output: 'actions.js',
plugin: ['s2s-action-creater'],
},
{
test: /actionTypes.js$/,
input: rootActionPath,
output: rootActionPath,
plugin: [
's2s-action-root',
{ input: 'src/**/actionTypes.js', output: rootActionPath },
],
},
{
test: /containers\/.+reducer.js/,
input: rootStatePath,
output: rootStatePath,
plugin: [
's2s-state-root',
{ input: 'src/containers/**/reducer.js', output: rootStatePath },
],
},
{
test: /containers\/.+reducer.js/,
input: rootReducerPath,
output: rootReducerPath,
plugin: [
's2s-reducer-root',
{ input: 'src/containers/**/reducer.js', output: rootReducerPath },
],
},
],
templates: [
{ test: /containers\/.*\/index.js/, input: 'containers.js' },
{ test: /components\/.*\/index.js/, input: 'components.js' },
{ test: /components\/.*\/index.test.js/, input: 'component.test.js' },
{ test: /reducer.js/, input: 'reducer.js' },
{ test: /reducer.test.js/, input: 'reducer.test.js' },
{ test: /selectors.js/, input: 'selectors.js' },
{ test: /selectors.test.js/, input: 'selectors.test.js' },
{ test: /logic.js/, input: 'logic.js' },
],
}