Skip to content

Commit

Permalink
Merge pull request #44 from AthennaIO/develop
Browse files Browse the repository at this point in the history
Update dependencies and change clone URL
  • Loading branch information
jlenon7 authored Jan 9, 2023
2 parents 5b2e2a5 + 4365481 commit 069568f
Show file tree
Hide file tree
Showing 7 changed files with 1,080 additions and 2,704 deletions.
16 changes: 9 additions & 7 deletions app/Console/Commands/Install/DatabaseCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export class InstallDatabaseCommand extends Command {
}

async createDatabaseConfigFile(projectPath, db) {
const databaseConfigFile = `${projectPath}/config/database.js`
const message = 'Creating config/database.js file in project'
const databaseConfigFile = `${projectPath}/config/database.${Path.ext()}`
const message = `Creating config/database.${Path.ext()} file in project`

const spinner = this.createSpinner(message)

Expand All @@ -110,7 +110,9 @@ export class InstallDatabaseCommand extends Command {

try {
await new File(
Path.resources(`scaffolds/databaseComponent/${db}/config/database.js`),
Path.resources(
`scaffolds/databaseComponent/${db}/config/database.${Path.ext()}`,
),
)
.loadSync()
.copy(databaseConfigFile)
Expand All @@ -124,8 +126,8 @@ export class InstallDatabaseCommand extends Command {
}

async addDatabaseProviderToAppConfig(projectPath) {
const appConfigPath = `${projectPath}/config/app.js`
const message = 'Registering DatabaseProvider in config/app.js'
const appConfigPath = `${projectPath}/config/app.${Path.ext()}`
const message = `Registering DatabaseProvider in config/app.${Path.ext()}`

const spinner = this.createSpinner(message)

Expand All @@ -151,8 +153,8 @@ export class InstallDatabaseCommand extends Command {
}

async addDatabaseCommandsToKernel(projectPath) {
const kernelPath = `${projectPath}/app/Console/Kernel.js`
const message = 'Registering commands and templates in Console/Kernel.js'
const kernelPath = `${projectPath}/app/Console/Kernel.${Path.ext()}`
const message = `Registering commands and templates in Console/Kernel.${Path.ext()}`

const spinner = this.createSpinner(message)

Expand Down
12 changes: 7 additions & 5 deletions app/Console/Commands/Install/MailCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export class InstallMailCommand extends Command {
}

async createMailConfigFile(projectPath) {
const mailConfigFile = `${projectPath}/config/mail.js`
const message = 'Creating config/mail.js file in project'
const mailConfigFile = `${projectPath}/config/mail.${Path.ext()}`
const message = `Creating config/mail.${Path.ext()} file in project`

const spinner = this.createSpinner(message)

Expand All @@ -81,7 +81,9 @@ export class InstallMailCommand extends Command {
}

try {
await new File(Path.resources(`scaffolds/mailComponent/config/mail.js`))
await new File(
Path.resources(`scaffolds/mailComponent/config/mail.${Path.ext()}`),
)
.loadSync()
.copy(mailConfigFile)

Expand All @@ -94,8 +96,8 @@ export class InstallMailCommand extends Command {
}

async addMailProviderToAppConfig(projectPath) {
const appConfigPath = `${projectPath}/config/app.js`
const message = 'Registering MailProvider in config/app.js'
const appConfigPath = `${projectPath}/config/app.${Path.ext()}`
const message = `Registering MailProvider in config/app.${Path.ext()}`

const spinner = this.createSpinner(message)

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/NewCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class NewCommand extends Command {
* @type {string}
*/
get url() {
return 'https://github.com/AthennaIO/Scaffold.git'
return 'https://github.com/AthennaIO/AthennaIO.git'
}

/**
Expand Down
29 changes: 22 additions & 7 deletions app/Console/Kernel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CoreLoader } from '@athenna/core'
import { TestLoader } from '@athenna/test'
import { Folder, Path } from '@athenna/common'
import { ArtisanLoader, ConsoleKernel } from '@athenna/artisan'

Expand All @@ -10,20 +9,27 @@ export class Kernel extends ConsoleKernel {
* @return {any[]}
*/
get commands() {
const appCommands = new Folder(Path.console('Commands'))
.loadSync()
.getFilesByPattern(`**/*.${Path.ext()}`, true)
.map(command => import(command.href))

if (Env('NODE_ENV') === 'production') {
return appCommands
}

const internalCommands = [
...CoreLoader.loadCommands(),
...TestLoader.loadCommands(),
...ArtisanLoader.loadCommands(),
]

const appCommands = new Folder(Path.console('Commands'))
const testCommandsPath = Path.nodeModules('@athenna/test/src/Commands')
const testCommands = new Folder(testCommandsPath)
.loadSync()
.getFilesByPattern('**/*.js', true)
.map(command => import(command.href))

if (Env('NODE_ENV') === 'production') {
return appCommands
}
internalCommands.push(...testCommands)

return [...internalCommands, ...appCommands]
}
Expand All @@ -34,6 +40,15 @@ export class Kernel extends ConsoleKernel {
* @return {any[]}
*/
get templates() {
return [...TestLoader.loadTemplates(), ...ArtisanLoader.loadTemplates()]
if (Env('NODE_ENV') === 'production') {
return ArtisanLoader.loadTemplates()
}

const testTemplatesPath = Path.nodeModules('@athenna/test/templates')
const testTemplates = new Folder(testTemplatesPath)
.loadSync()
.getFilesByPattern('**/*.edge', true)

return [...testTemplates, ...ArtisanLoader.loadTemplates()]
}
}
Loading

0 comments on commit 069568f

Please sign in to comment.