Sub-directories of `models/` and `boot/` that cannot be required
(they don't have an index.js file) are silently skipped now.
This enables developers to put test files into `models/test/`.
When a script in `models/` or `boot/` exports a function which is not
a loopback.Model constructor, the bootstrapper immediatelly calls
this exported function wit the current `app` object.
This is providing a dependency injection mechanism for boot scripts,
so that they no longer need to know where to find the `app` object.
Note: the dependency injection is optional. Existing code getting
`app` reference via `require('../app')` will continue to work.
Support custom project layouts where model & datasource config files
are located in a different place from the app config.
Example:
# API server
server/app.config.json
server/datasources.json
# shared between server & client
models.json
models/
# isomorphic client
client/app.config.json
client/datasources.json
Modify loading of `appConfig` and `dataSourceConfig` to look for
the following files:
- app.json
- app.local.{js|json}
- app.{$env}.{js|json}
- datasources.json
- datasources.local.{js|json}
- datasources.{$env}.{js|json}
where $env is the value of `app.get('env')`, which usually defaults
to `process.env.NODE_ENV`.
The values in the additional files are applied to the config object,
overwritting any existing values. The new values must be value types
like String or Number; Object and Array are not supported.
Additional datasource config files cannot define new datasources,
only modify existing ones.
The commit includes refactoring of the config-loading code into
a standalone file.
Move `app.boot()` and its tests from loopback.
Fix jshint warnings.
Clean up unit tests - remove dependency on global variables created
by loopback's test/support.js