Commit Graph

5 Commits

Author SHA1 Message Date
Miroslav Bajtoš 230360ef28 executor: remove direct reference to loopback
Modify the executor to access the loopback object via `app.loopback`.

Fall back to `require('loopback')` only when `app.loopback` is not set
(loopback versions before 1.9).
2014-06-25 14:12:53 +02:00
Miroslav Bajtoš c3a9a09941 Drop peer dep on loopback; add a runtime check
Replace peerDependency with a run-time check based on
`app.loopback.version`.
2014-06-16 15:23:32 +02:00
Miroslav Bajtoš 5f85971d11 Implement compileToBrowserify and bootBrowserApp
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.
2014-06-03 14:08:34 +02:00
Miroslav Bajtoš b14800416a Split the boot process into two steps
Split bootLoopBackApp into two steps:
 - compile
 - execute

Most of the changes are just shuffling the existing code around.

What has changed:

 - `loopback.autoAttach()` is called after `models/*` are required.
   The calls were made in the opposite order before this commit.
2014-06-03 08:13:14 +02:00
Miroslav Bajtoš c1743dc2ff Load datasources and app cfg from multiple files
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.
2014-05-27 14:08:58 +02:00