When executor passes the instruction to loopback methods,
loopback modifies the data. Since we are loading the data using
`require` such changes affects also code that calls
`require` for one of the instructions files.
This change adds a deep clone step to prevent this issue.
Hide `compile` and `execute` and provide a better API for browserified
applications:
- `boot.compileToBrowserify(options, bundler)` calls `compile` under
the hood and adds all instructions and scripts to the bundler.
- `bootBrowserApp(app)` is exported by loopback-boot when the module
is loaded in a browser, the function loads the instructions as
bundled by `compileToBrowserify`.
This new API hides all implementation details from the user and makes
it easy to add loopback-boot to any build script.
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/`.
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