Commit Graph

20 Commits

Author SHA1 Message Date
Raymond Feng 3bb519d5e9 Upgrade deps and fix style issues 2017-05-08 14:48:48 -07:00
Raymond Feng ac1571ccf1 Refactor for modular and pluggable design
- refactor logic of processing artifacts into their own classes
- introduce Container as the main class for bootstrapping and build a
  registry of handlers during boot to organize them by a hierarchy
  denoted by path
- adopt middleware like registration and invocation
- container.use(path, handler)
- container.run(context, done)
- allow more phases during boot
- boot is now asynchronous
2016-11-22 13:38:28 -05:00
Ryan Graham 5eaa909006
update copyright notices and license 2016-05-05 21:52:36 -07:00
Miroslav Bajtoš 902005ed8e Use eslint with loopback config
Drop jshint and jscs in favour of eslint.
2016-04-05 15:42:58 +02:00
Pradnya Baviskar 53f51820f5 support 'mixinsources' option
- By default looks for mixinsources in  directory

- Loads only mixins used through models
2015-05-07 14:35:55 +05:30
Pradnya Baviskar 9bb988713e add support for mixins
- [mixinDirs]: List of directories to look for files
 containing model mixin definition.
2015-04-24 12:42:56 +05:30
Krishna Raman 311b892a0f Support for multiple apps in browserified bundle. 2015-03-19 09:57:32 -07:00
Miroslav Bajtoš f8247be23c Configure components via `component-config.json`
Load configuration of components from `component-config`
and configure all components as specified.

Sample JSON:

    {
      "loopback-component-foobar": {
        "option1": "value1",
        "option2": "value2"
      }
    }

The component is expected to export the following function:

    module.exports = function(app, options) { /* ... */ };
2015-01-06 14:00:26 +01:00
Miroslav Bajtoš 5b5071864b Add jscs style check, fix violations found 2014-11-13 15:54:59 +01:00
Miroslav Bajtoš e2aff71bf9 Use `chai` instead of `must`
As of 1.10, chai supports nonary assertions, there are no more reasons
for using a different variant.
2014-11-13 15:31:35 +01:00
bitmage e936deffe2 support coffee-script models and client code
Load models for any filetypes registered in require.extensions.

 - Server side coffee-script requires a `require('coffee-script/register');`

 - Client side coffee-script requires Coffeeify.
2014-10-24 10:42:30 -07:00
Miroslav Bajtoš c04946073f package: update dependency versions 2014-10-21 09:40:52 +02:00
Miroslav Bajtoš 927bee82f7 Use loopback 2.x in unit tests. 2014-10-21 09:38:25 +02:00
Miroslav Bajtoš 0169f22cd0 test: ensure sandbox dir is present
Fix test/browser.test.js failing on CI due to sandbox dir not present
on the first run.
2014-08-19 09:26:57 +02:00
Miroslav Bajtoš 34de593202 test: add `global.navigator` for browser tests
The debug module uses `navigator.userAgent` to detect whether the
browser support colors in console logs.
2014-08-18 14:56:20 +02:00
Miroslav Bajtoš 93bfc3a63a test: increase timeout for browserify 2014-08-18 14:35:19 +02:00
Fabien Franzen f98d2cb89c Implemented modelSources, bootDirs and bootScripts options 2014-08-04 10:33:03 +02:00
Miroslav Bajtoš e7250b6eac test: export Int32Array and DataView for browser
crypto-browserify uses Int32Array, which is not exposed on the VM
context in Node v0.10.
2014-07-17 10:05:08 +02:00
Miroslav Bajtoš a204fdc1c9 Rework model configuration
Rework the way how models are configured, the goal is to allow
loopback-boot to automatically determine the correct order
of the model definitions to ensure base models are defined
before they are extended.

 1. The model .js file no longer creates the model, it exports
 a config function instead:

  ```js
  module.exports = function(Car, Base) {
    // Car is the model constructor
    // Base is the parent model (e.g. loopback.PersistedModel)

    Car.prototype.honk = function(duration, cb) {
      // make some noise for `duration` seconds
      cb();
    };
  };
  ```

 2. The model is created by loopback-boot from model .json file.
  The .js file must have the same base file name.

 3. The `boot()` function has a new parameter `modelSources` to
  specify the list of directories where to look for model definitions.
  The parameter defaults to `['./models']`.

As a side effect, only models configured in `models.json` and their
base clases are defined. This should keep the size of the browserified
bundle small, because unused models are not included.
2014-06-13 19:40:52 +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