Skip to content

Commit efde545

Browse files
jaumardjaumard
authored andcommitted
Fix merge configs, change build-dictionary.aggragate to include-all solution
1 parent 9823900 commit efde545

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

libs/config.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22
* Load config from a directory into a Sails app
33
*/
44

5-
var buildDictionary = require('sails-build-dictionary');
65
var _ = require('lodash');
76
module.exports = function (sails, dir) {
8-
buildDictionary.aggregate({
7+
var configs = require('include-all')({
98
dirname: dir,
109
exclude: ['locales', 'local.js', 'local.json', 'local.coffee', 'local.litcoffee'],
11-
excludeDirs: /(locales|env)$/,
1210
filter: /(.+)\.(js|json|coffee|litcoffee)$/,
13-
identity: false
14-
}, function (err, configs) {
15-
sails.config = _.merge(configs, sails.config, function (a, b) {
16-
if (_.isArray(a)) {
17-
return a.concat(b);
18-
}
19-
});
11+
excludeDirs: /(locales|env)$/,
12+
});
13+
14+
sails.config = _.merge(configs, sails.config, function (a, b) {
15+
if (_.isArray(a)) {
16+
return a.concat(b);
17+
}
2018
});
2119
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sails-util-mvcsloader",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "Load models, controllers, services, policies and config from specified directories and inject them into the main Sails app.",
55
"main": "index.js",
66
"scripts": {
@@ -47,6 +47,7 @@
4747
"homepage": "https://github.com/leeroybrun/sails-util-mvcsloader",
4848
"dependencies": {
4949
"async": "^0.9.0",
50+
"include-all": "^0.1.6",
5051
"lodash": "^3.5.0",
5152
"sails-build-dictionary": "^0.10.1",
5253
"sails-util": "^0.10.6"

0 commit comments

Comments
 (0)