Skip to content

Commit

Permalink
add suport to devPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
albertosouza committed Jun 20, 2016
1 parent fbd0f91 commit fbb7fa1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
19 changes: 15 additions & 4 deletions lib/PluginManager/index.js
Expand Up @@ -52,11 +52,22 @@ PluginManager.prototype.loadPlugin = function loadPlugin(pluginFile, npmModuleNa
PluginManager.prototype.getPluginsList = function getPluginsList() {
var names = [];

if (this.we.projectPackageJSON.wejs && this.we.projectPackageJSON.wejs.plugins) {
// dev or test modules
if (this.we.env != 'prod') {
if (this.we.projectPackageJSON.wejs && this.we.projectPackageJSON.wejs.devPlugins) {
for (var name in this.we.projectPackageJSON.wejs.devPlugins) {
if (this.we.projectPackageJSON.wejs.devPlugins[name]) {
names.push(name);
}
}
}
}

for (var name in this.we.projectPackageJSON.wejs.plugins) {
if (this.we.projectPackageJSON.wejs.plugins[name]) {
names.push(name);
// modules avaible in all envs
if (this.we.projectPackageJSON.wejs && this.we.projectPackageJSON.wejs.plugins) {
for (var _name in this.we.projectPackageJSON.wejs.plugins) {
if (this.we.projectPackageJSON.wejs.plugins[_name]) {
names.push(_name);
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/PluginManager/index.js
Expand Up @@ -46,8 +46,19 @@ PluginManager.prototype.loadPlugin = function loadPlugin (pluginFile, npmModuleN
PluginManager.prototype.getPluginsList = function getPluginsList () {
let names = [];

if (this.we.projectPackageJSON.wejs && this.we.projectPackageJSON.wejs.plugins) {
// dev or test modules
if (this.we.env != 'prod') {
if (this.we.projectPackageJSON.wejs && this.we.projectPackageJSON.wejs.devPlugins) {
for (let name in this.we.projectPackageJSON.wejs.devPlugins) {
if (this.we.projectPackageJSON.wejs.devPlugins[name]) {
names.push(name)
}
}
}
}

// modules avaible in all envs
if (this.we.projectPackageJSON.wejs && this.we.projectPackageJSON.wejs.plugins) {
for (let name in this.we.projectPackageJSON.wejs.plugins) {
if (this.we.projectPackageJSON.wejs.plugins[name]) {
names.push(name)
Expand Down

0 comments on commit fbb7fa1

Please sign in to comment.