lib/core.js
function(next) {
            core.allowPackages.forEach(function(pkg) {
                try {
                    var mod = path.dirname(require.resolve(pkg)).replace(/\/lib$/, "");
                    core.packages[pkg] = { path: mod };
                    if (lib.statSync(mod + "/etc").isDirectory()) {
                        core.packages[pkg].etc = 1;
                        var cfg = lib.readFileSync(mod + "/etc/config");
                        if (cfg) {
                            config = cfg + "\n" + config;
                            core.packages[pkg].config = 1;
                            core.parseConfig(cfg, 1);
                        }
                    }
                    ["modules","locales","views","web"].forEach(function(x) {
                        if (lib.statSync(mod + "/" + x).isDirectory()) {
                            core.path[x].unshift(mod + "/" + x);
                            core.packages[pkg][x] = 1;
                        }
                    });
                    logger.debug("init:", "npm package:", pkg, core.packages[pkg]);
                } catch(e) {
                    logger.error("init:", "npm package:", pkg, e);
                }
            });
            next();
        }
function(next) {
            core.allowPackages.forEach(function(pkg) {
                try {
                    var mod = path.dirname(require.resolve(pkg)).replace(/\/lib$/, "");
                    core.packages[pkg] = { path: mod };
                    if (lib.statSync(mod + "/etc").isDirectory()) {
                        core.packages[pkg].etc = 1;
                        var cfg = lib.readFileSync(mod + "/etc/config");
                        if (cfg) {
                            config = cfg + "\n" + config;
                            core.packages[pkg].config = 1;
                            core.parseConfig(cfg, 1);
                        }
                    }
                    ["modules","locales","views","web"].forEach(function(x) {
                        if (lib.statSync(mod + "/" + x).isDirectory()) {
                            core.path[x].unshift(mod + "/" + x);
                            core.packages[pkg][x] = 1;
                        }
                    });
                    logger.debug("init:", "npm package:", pkg, core.packages[pkg]);
                } catch(e) {
                    logger.error("init:", "npm package:", pkg, e);
                }
            });
            next();
        }
function ( next ) { core . allowPackages . forEach ( function ( pkg ) { try { var mod = path . dirname ( require . resolve ( pkg ) ) . replace ( / \/lib$ / , "" ) ; core . packages [ pkg ] = { path : mod } ; if ( lib . statSync ( mod + "/etc" ) . isDirectory ( ) ) { core . packages [ pkg ] . etc = 1 ; var cfg = lib . readFileSync ( mod + "/etc/config" ) ; if ( cfg ) { config = cfg + "\n" + config ; core . packages [ pkg ] . config = 1 ; core . parseConfig ( cfg , 1 ) ; } } [ "modules" , "locales" , "views" , "web" ] . forEach ( function ( x ) { if ( lib . statSync ( mod + "/" + x ) . isDirectory ( ) ) { core . path [ x ] . unshift ( mod + "/" + x ) ; core . packages [ pkg ] [ x ] = 1 ; } } ) ; logger . debug ( "init:" , "npm package:" , pkg , core . packages [ pkg ] ) ; } catch ( e ) { logger . error ( "init:" , "npm package:" , pkg , e ) ; } } ) ; next ( ) ; }
Load NPM packages and auto configure paths from each package, config files inside packages will be used as well
Load NPM packages and auto configure paths from each package config files inside packages will be used as well