From 925ac92b1a0ceffb7103f0427043625d56c5f508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Wed, 30 Mar 2022 15:53:55 -0300 Subject: [PATCH 1/2] feat: remove console.log --- src/Factories/AthennaFactory.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Factories/AthennaFactory.ts b/src/Factories/AthennaFactory.ts index 7d9064a..7c27ad0 100644 --- a/src/Factories/AthennaFactory.ts +++ b/src/Factories/AthennaFactory.ts @@ -86,8 +86,6 @@ export class AthennaFactory { secConfig.load(Path.config(`app${AthennaFactory.extension}`)) process.env.NODE_ENV = SecConfig.get('app.environment') - console.log(process.env.NODE_ENV) - resolveEnvFile() secConfig.load(Path.config(`app${AthennaFactory.extension}`)) From 3d3fc4a486179dd92693bcc7cf2f3da8ae40d2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Wed, 30 Mar 2022 16:07:56 -0300 Subject: [PATCH 2/2] feat: remove ignite from index --- index.ts | 2 -- package.json | 2 +- src/Factories/AthennaFactory.ts | 53 ++++++++++++++------------------- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/index.ts b/index.ts index 348140f..0c2fa13 100644 --- a/index.ts +++ b/index.ts @@ -7,7 +7,5 @@ * file that was distributed with this source code. */ -export * from 'src/Ignite' - export * from 'src/Modules/HttpRoute' export * from 'src/Modules/HttpServer' diff --git a/package.json b/package.json index 07374c0..b067f9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "1.0.0", + "version": "1.0.1", "description": "", "license": "MIT", "author": "João Lenon ", diff --git a/src/Factories/AthennaFactory.ts b/src/Factories/AthennaFactory.ts index 7c27ad0..25c0d62 100644 --- a/src/Factories/AthennaFactory.ts +++ b/src/Factories/AthennaFactory.ts @@ -17,52 +17,41 @@ export class AthennaFactory { private static logger: Logger private static extension: '.js' | '.ts' - private static bootProviders() { + private static getProviders() { const providers = Config.get('app.providers') + const providersNormalized: any[] = [] providers.forEach(Provider => { if (Is.Class(Provider)) { - AthennaFactory.logger.log(`Booting ${Provider.name}`) + providersNormalized.push(Provider) - return new Provider().boot() + return } if (Is.Object(Provider) && !Provider.default) { const firstProviderKey = Object.keys(Provider)[0] - AthennaFactory.logger.log(`Booting ${firstProviderKey}`) - return new Provider[firstProviderKey]().boot() - } + providersNormalized.push(Provider[firstProviderKey]) - AthennaFactory.logger.log(`Booting ${Provider.default.name}`) + return + } - // eslint-disable-next-line new-cap - return new Provider.default().boot() + providersNormalized.push(Provider.default()) }) - } - - private static registerProviders() { - const providers = Config.get('app.providers') - providers.forEach(Provider => { - if (Is.Class(Provider)) { - AthennaFactory.logger.log(`Registering ${Provider.name}`) - - return new Provider().register() - } + providersNormalized.forEach(Provider => + AthennaFactory.logger.log(`Registering ${Provider.name}`), + ) - if (Is.Object(Provider) && !Provider.default) { - const firstProviderKey = Object.keys(Provider)[0] - AthennaFactory.logger.log(`Registering ${firstProviderKey}`) - - return new Provider[firstProviderKey]().register() - } + return providersNormalized + } - AthennaFactory.logger.log(`Registering ${Provider.default.name}`) + private static bootProviders(providers: any[]) { + providers.forEach(Provider => new Provider().boot()) + } - // eslint-disable-next-line new-cap - return new Provider.default().register() - }) + private static registerProviders(providers: any[]) { + providers.forEach(Provider => new Provider().register()) } private static preloadFiles() { @@ -97,8 +86,10 @@ export class AthennaFactory { }, }) - AthennaFactory.registerProviders() - AthennaFactory.bootProviders() + const providers = AthennaFactory.getProviders() + + AthennaFactory.registerProviders(providers) + AthennaFactory.bootProviders(providers) AthennaFactory.preloadFiles() }