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

Update to new plugin infrastructure #614

Merged
merged 4 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

17 changes: 6 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.DS_Store

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
Expand All @@ -17,19 +18,13 @@ coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

tmp*
.idea/


# The compiled/babelified modules
lib/
# Users Environment Variables
.lock-wscript
6 changes: 2 additions & 4 deletions .istanbul.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
verbose: false
instrumentation:
root: ./src/
excludes:
- lib/
root: ./lib/
include-all-sources: true
reporting:
print: summary
Expand All @@ -14,4 +12,4 @@ reporting:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
branches: [50, 80]
9 changes: 4 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.github
.editorconfig
.jshintrc
.travis.yml
.istanbul.yml
.babelrc
.idea/
src/
.vscode/
test/
!lib/
coverage
.github/
coverage/
.github/
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: node_js
node_js:
- node
- '6'
- '4'
addons:
code_climate:
repo_token: 498707228e4260677935eadfa95a35c24a9c2e9877bf05200d9c3aafb520abf6
Expand Down
13 changes: 6 additions & 7 deletions src/application.js → lib/application.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import makeDebug from 'debug';
import { stripSlashes } from 'feathers-commons';
import Uberproto from 'uberproto';
const debug = require('debug')('feathers:application');
const { stripSlashes } = require('feathers-commons');

import events from './events';
import hooks from './hooks';
const Uberproto = require('uberproto');
const events = require('./events');
const hooks = require('./hooks');

const debug = makeDebug('feathers:application');
const Proto = Uberproto.extend({
create: null
});
Expand Down Expand Up @@ -129,4 +128,4 @@ const application = {
}
};

export default application;
module.exports = application;
16 changes: 8 additions & 8 deletions src/events.js → lib/events.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter } from 'events';
import Proto from 'uberproto';
const { EventEmitter } = require('events');
const Proto = require('uberproto');

export function eventHook () {
const eventHook = exports.eventHook = function eventHook () {
return function (hook) {
const { app, service } = hook;
const eventName = app.eventMappings[hook.method];
Expand All @@ -12,9 +12,9 @@ export function eventHook () {
service.emit(eventName, hook.result, hook);
}
};
}
};

export function eventMixin (service) {
const eventMixin = exports.eventMixin = function eventMixin (service) {
if (service._serviceEvents) {
return;
}
Expand Down Expand Up @@ -54,9 +54,9 @@ export function eventMixin (service) {
service._hookEvents.push(event);
}
});
}
};

export default function () {
module.exports = function () {
return function () {
const app = this;

Expand All @@ -79,4 +79,4 @@ export default function () {

app.mixins.push(eventMixin);
};
}
};
18 changes: 10 additions & 8 deletions src/hooks.js → lib/hooks.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
hooks as commons, validateArguments, isPromise
} from 'feathers-commons';
const {
hooks,
validateArguments,
isPromise
} = require('feathers-commons');

const {
createHookObject, getHooks, processHooks, enableHooks, makeArguments
} = commons;
} = hooks;

export function hookMixin (service) {
const hookMixin = exports.hookMixin = function hookMixin (service) {
if (typeof service.hooks === 'function') {
return;
}
Expand Down Expand Up @@ -102,9 +104,9 @@ export function hookMixin (service) {
});

service.mixin(mixin);
}
};

export default function () {
module.exports = function () {
return function () {
const app = this;

Expand All @@ -119,4 +121,4 @@ export default function () {

app.mixins.push(hookMixin);
};
}
};
18 changes: 18 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const Proto = require('uberproto');
const Application = require('./application');
const version = require('./version');

function createApplication () {
const app = {};

// Mix in the base application
Proto.mixin(Application, app);

app.init();

return app;
}

createApplication.version = version;

module.exports = createApplication;
1 change: 1 addition & 0 deletions lib/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = '3.0.0-pre.0';
1 change: 0 additions & 1 deletion mocha.opts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--recursive test/
--compilers js:babel-core/register
Loading