Skip to content

Commit

Permalink
Merge pull request #1 from AthennaIO/develop
Browse files Browse the repository at this point in the history
Remove ignite from package index
  • Loading branch information
jlenon7 authored Mar 30, 2022
2 parents 76df7d9 + 3d3fc4a commit a48ced7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 36 deletions.
2 changes: 0 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/core",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
55 changes: 22 additions & 33 deletions src/Factories/AthennaFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

if (Is.Object(Provider) && !Provider.default) {
const firstProviderKey = Object.keys(Provider)[0]
AthennaFactory.logger.log(`Registering ${firstProviderKey}`)
providersNormalized.forEach(Provider =>
AthennaFactory.logger.log(`Registering ${Provider.name}`),
)

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() {
Expand All @@ -86,8 +75,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}`))
Expand All @@ -99,8 +86,10 @@ export class AthennaFactory {
},
})

AthennaFactory.registerProviders()
AthennaFactory.bootProviders()
const providers = AthennaFactory.getProviders()

AthennaFactory.registerProviders(providers)
AthennaFactory.bootProviders(providers)
AthennaFactory.preloadFiles()
}

Expand Down

0 comments on commit a48ced7

Please sign in to comment.