Commit a911726b99b0e4c5da2f7dd6d4905059b64b9500
bulk require
Michael Williams committed on 11/28/2015, 8:42:54 AMParent: bd151b3444051218586e6db524d1767d208bc086
Files changed
app/services/index.js | changed |
app/actions/index.js | added |
app/reducers/index.js | added |
package.json | changed |
app/services/index.js | ||
---|---|---|
@@ -1,23 +1,3 @@ | ||
1 | -const fs = require('fs') | |
2 | -const { map, filter, invoker, zip } = require('ramda') | |
3 | -const { join, basename } = require('path') | |
1 | +const bulk = require('bulk-require') | |
4 | 2 | |
5 | -const serviceCreatorNames = filter( | |
6 | - (name) => name !== 'index', | |
7 | - map( | |
8 | - basename, | |
9 | - fs.readdirSync(__dirname) | |
10 | - ) | |
11 | -) | |
12 | - | |
13 | -const serviceCreators = zip( | |
14 | - serviceCreatorNames, | |
15 | - map( | |
16 | - (name) => { | |
17 | - require(join(__dirname, name)) | |
18 | - }, | |
19 | - serviceCreatorNames | |
20 | - ) | |
21 | -) | |
22 | - | |
23 | -module.exports = serviceCreators | |
3 | +module.exports = bulk(__dirname, '!(index.js)') |
app/actions/index.js | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +const bulk = require('bulk-require') | |
2 | + | |
3 | +module.exports = bulk(__dirname, '*.js') |
app/reducers/index.js | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +const bulk = require('bulk-require') | |
2 | + | |
3 | +module.exports = bulk(__dirname, '*.js') |
package.json | ||
---|---|---|
@@ -62,8 +62,10 @@ | ||
62 | 62 | "babel-plugin-transform-object-rest-spread": "^6.1.18", |
63 | 63 | "babel-preset-es2015": "^6.1.18", |
64 | 64 | "babel-preset-react": "^6.1.18", |
65 | 65 | "babelify": "^7.2.0", |
66 | + "bulk-require": "^0.2.1", | |
67 | + "bulkify": "^1.1.1", | |
66 | 68 | "evalify": "^1.0.1", |
67 | 69 | "feathers": "^1.2.0", |
68 | 70 | "lnfs-cli": "^1.0.1", |
69 | 71 | "npm-run-all": "^1.3.2", |
Built with git-ssb-web