Comparing version 0.3.2 to 0.4.0
import Event from './SystemEvents' | ||
import dotenv from 'dotenv' | ||
console.log('rodando') | ||
Event.emit('loadCli',process.cwd()) |
@@ -8,3 +8,3 @@ import Event from './SystemEvents' | ||
export default async (file) =>{ | ||
Event.emit('beforeLoad',file) | ||
Event.emit('beforeLoad',file, Organized) | ||
} | ||
@@ -11,0 +11,0 @@ |
@@ -111,13 +111,26 @@ import glob from 'glob' | ||
let orderOfPlugins = resolve(order) | ||
let listOfFunctions = { | ||
cli:{}, | ||
generator:{} | ||
} | ||
for(let j in orderOfPlugins){ | ||
let plugin = orderOfPlugins[j] | ||
if(typeof routerFile == 'object' && routerFile.hasOwnProperty('default')) | ||
if(typeof listOfFiles[plugin] == 'object' && listOfFiles[plugin].hasOwnProperty('default')) | ||
await listOfFiles[plugin].default(Organized) | ||
else if(typeof routerFile == 'function') | ||
else if(typeof listOfFiles[plugin] == 'function') | ||
await listOfFiles[plugin](Organized) | ||
if((typeof listOfFiles[plugin] == 'object' || typeof listOfFiles[plugin] == 'function') && listOfFiles[plugin].hasOwnProperty('generator')){ | ||
let generatorName = listOfFiles[plugin].generator.name | ||
listOfFunctions['generator'][generatorName] = listOfFiles[plugin].generator.action | ||
} | ||
if((typeof listOfFiles[plugin] == 'object' || typeof listOfFiles[plugin] == 'function') && listOfFiles[plugin].hasOwnProperty('cli')){ | ||
let generatorName = listOfFiles[plugin].cli.name | ||
listOfFunctions['cli'][generatorName] = listOfFiles[plugin].cli.action | ||
} | ||
if(orderOfPlugins.length - 1 == j){ | ||
if(cb) cb() | ||
if(cb) cb(listOfFunctions) | ||
} | ||
@@ -204,2 +217,3 @@ | ||
export let loadNpmDependencies = async (folders,cb) => { | ||
@@ -206,0 +220,0 @@ |
{ | ||
"name": "dek", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "entry.js", |
import EventEmitter from 'events' | ||
import {loadAll, loadCli, generator, log, installPackages, loadNpmDependencies, cloneRepositoryList, cloneSkeleton} from './Organized' | ||
import Organized, {loadAll, loadCli, generator, log, loadNpmDependencies, cloneRepositoryList, cloneSkeleton} from './Organized' | ||
import {o} from 'dek' | ||
import minimist from 'minimist' | ||
@@ -51,14 +52,18 @@ | ||
}else{ | ||
loadAll([dir + '/plugins/*/main.js'], async () => { | ||
loadAll([dir + '/plugins/*/main.js'], async (listOfFunctions) => { | ||
if(cliFunc && cliFunc == 'new'){ | ||
if(generator.hasOwnProperty(generatorFunc)){ | ||
generator[generatorFunc](argv) | ||
if(listOfFunctions['generator'].hasOwnProperty(generatorFunc)){ | ||
await listOfFunctions['generator'][generatorFunc](argv) | ||
}else{ | ||
danger('Não existe esse generator') | ||
console.log('') | ||
danger(`Generator ${generatorFunc} não existe`) | ||
} | ||
}else if(cliFunc && listOfFunctions['cli'].hasOwnProperty(cliFunc)){ | ||
await listOfFunctions['cli'][cliFunc](argv) | ||
}else{ | ||
loadCli([dir + '/plugins/*/main.js']) | ||
console.log('') | ||
danger(`CLI ${cliFunc} não existe`) | ||
} | ||
@@ -65,0 +70,0 @@ |
13219
338