Comparing version 0.1.3 to 0.1.4
@@ -29,3 +29,3 @@ var dirname = require('path').dirname; | ||
// The plugin is a package on the disk. We need to load it. | ||
if (plugin.hasOwnProperty("packagePath")) { | ||
if (plugin.hasOwnProperty("packagePath") && !plugin.hasOwnProperty("setup")) { | ||
plugin.packagePath = resolvePackageSync(base, plugin.packagePath); | ||
@@ -40,5 +40,5 @@ var packageConf = require(plugin.packagePath); | ||
plugin.setup = require(dirname(plugin.packagePath)); | ||
plugin.consumes = plugin.consumes || []; | ||
plugin.provides = plugin.provides || []; | ||
} | ||
plugin.consumes = plugin.consumes || []; | ||
plugin.provides = plugin.provides || []; | ||
}); | ||
@@ -185,2 +185,9 @@ return config; | ||
Architect.prototype.getService = function(name) { | ||
if (!this.services[name]) { | ||
throw new Error("Service '" + name + "' not found in architect app!"); | ||
} | ||
return this.services[name]; | ||
} | ||
// Returns an event emitter that represents the app. It can emit events. | ||
@@ -194,25 +201,33 @@ // event: ("service" name, service) emitted when a service is ready to be consumed. | ||
function createApp(config, callback) { | ||
var app = new Architect(config); | ||
if (callback) { | ||
app.on("error", onError); | ||
app.once("ready", onReady); | ||
try { | ||
var app = new Architect(config); | ||
if (callback) { | ||
app.on("error", onError); | ||
app.once("ready", onReady); | ||
function onError(err) { | ||
app.removeListener("ready", done); | ||
app.destroy(); | ||
done(err, app); | ||
} | ||
function onError(err) { | ||
app.removeListener("ready", done); | ||
app.destroy(); | ||
done(err, app); | ||
} | ||
function onReady() { | ||
done(null, app); | ||
} | ||
function onReady() { | ||
done(null, app); | ||
} | ||
var called = false; | ||
function done(err) { | ||
if (called) return; | ||
called = true; | ||
callback(err, app); | ||
var called = false; | ||
function done(err) { | ||
if (called) return; | ||
called = true; | ||
callback(err, app); | ||
} | ||
} | ||
return app; | ||
} catch(err) { | ||
if (callback) { | ||
callback(err); | ||
} else { | ||
throw err; | ||
} | ||
} | ||
return app; | ||
} | ||
@@ -219,0 +234,0 @@ |
{ | ||
"name": "architect", | ||
"description": "A Simple yet powerful plugin system for node applications", | ||
"version": "0.1.3", | ||
"author": "ajax.org B.V. <info@ajax.org>", | ||
"contributors": [ | ||
{ | ||
"name": "Tim Caswell", | ||
"email": "tim@c9.io" | ||
"name": "architect", | ||
"description": "A Simple yet powerful plugin system for node applications", | ||
"version": "0.1.4", | ||
"author": "ajax.org B.V. <info@ajax.org>", | ||
"contributors": [ | ||
{ | ||
"name": "Tim Caswell", | ||
"email": "tim@c9.io" | ||
}, | ||
{ | ||
"name": "Fabian Jakobs", | ||
"email": "fabian@c9.io" | ||
}, | ||
{ | ||
"name": "Christoph Dorn", | ||
"email": "christoph@christophdorn.com" | ||
} | ||
], | ||
"main": "architect.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/c9/architect.git" | ||
}, | ||
{ | ||
"name": "Fabian Jakobs", | ||
"email": "fabian@c9.io" | ||
}, | ||
{ | ||
"name": "Christoph Dorn", | ||
"email": "christoph@christophdorn.com" | ||
} | ||
], | ||
"main": "architect.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/c9/architect.git" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"optionalDependencies": {}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/c9/architect/raw/master/LICENSE" | ||
} | ||
] | ||
} | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"optionalDependencies": {}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/c9/architect/raw/master/LICENSE" | ||
} | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21557
381