Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fastboot support for ember-pouch #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,30 @@ module.exports = {
},

included: function included(app) {
var bowerDir = app.bowerDirectory;

app.import(bowerDir + '/pouchdb/dist/pouchdb.js');
app.import(bowerDir + '/relational-pouch/dist/pouchdb.relational-pouch.js');
app.import('vendor/ember-pouch/shim.js', {
type: 'vendor',
exports: {
'pouchdb': [ 'default' ]
}
});
if (isFastBoot()) {
app.import('vendor/ember-pouch/ember-pouch-fastboot.js');
} else {
var bowerDir = app.bowerDirectory;

app.import(bowerDir + '/pouchdb/dist/pouchdb.js');
app.import(bowerDir + '/relational-pouch/dist/pouchdb.relational-pouch.js');
app.import('vendor/ember-pouch/shim.js', {
type: 'vendor',
exports: {
'pouchdb': [ 'default' ]
}
});
}
}
};

// Steal *all the things* from github.com/tomdale/ember-network !

var funnel = require('broccoli-funnel');

// Checks to see whether this build is targeting FastBoot. Note that we cannot
// check this at boot time--the environment variable is only set once the build
// has started, which happens after this file is evaluated.
function isFastBoot() {
return process.env.EMBER_CLI_FASTBOOT === 'true';
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@
"ember-try": "~0.0.8"
},
"dependencies": {
"broccoli-funnel": "^1.0.1",
"ember-cli-babel": "^5.1.5",
"ember-cli-version-checker": "1.1.5"
"ember-cli-version-checker": "1.1.5",
"pouchdb": "^5.2.1",
"relational-pouch": "^1.4.0"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"configPath": "tests/dummy/config",
"fastBootDependencies": ["pouchdb", "relational-pouch"]
}
}
13 changes: 13 additions & 0 deletions vendor/ember-pouch/ember-pouch-fastboot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
;(function() {
'use strict';

define('pouchdb', ['exports'], function (__exports__) {
var PouchDB = FastBoot.require('pouchdb');

// Register plugins!
PouchDB.plugin(FastBoot.require('relational-pouch'));

__exports__['default'] = PouchDB;
});

})();