Commit Graph

12 Commits

Author SHA1 Message Date
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