Skip to content

Commit

Permalink
Merge pull request #165 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat(configurer): add more logs
  • Loading branch information
jlenon7 authored Dec 10, 2023
2 parents 604253e + 2fe7afa commit 6e84784
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/artisan",
"version": "4.17.0",
"version": "4.18.0",
"description": "The Athenna CLI application. Built on top of commander and inspired in @adonisjs/ace.",
"license": "MIT",
"author": "João Lenon <lenon@athenna.io>",
Expand Down
26 changes: 18 additions & 8 deletions src/commands/ConfigureCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ConfigureCommand extends BaseCommand {
@Argument({
signature: 'libraries...',
description:
'One or more libraries to be configured. (Example: artisan configure @athenna/mail @athenna/database)'
'One or more libraries to be configured. (Example: node artisan configure @athenna/mail @athenna/database)'
})
public libraries: string[]

Expand All @@ -35,17 +35,27 @@ export class ConfigureCommand extends BaseCommand {
}

private async configure(library: string) {
this.logger.simple(`({bold,green} [ CONFIGURING ${library} ])\n`)

const isFile = this.isFile(library)
const isInstalled = await this.isInstalled(library)

if (!isFile && !isInstalled) {
await this.logger.promiseSpinner(Exec.command(`npm install ${library}`), {
text: `Installing ${Color.chalk.magenta(library)} library`,
failText: `Failed to install ${Color.chalk.magenta(library)} library`,
successText: `Library ${Color.chalk.magenta(
library
)} successfully installed`
})
this.logger.warn(
`Library ({dim,yellow} ${library}) is not installed, is recommended to run ({dim,yellow} npm install ${library}) because installing libraries from child process usually don't set the library in your ({dim,yellow} package.json) file.`
)
await this.logger.promiseSpinner(
Exec.command(`npm install ${library}`, { cwd: Path.pwd() }),
{
text: `Installing ${Color.chalk.dim.magenta(library)} library`,
failText: `Failed to install ${Color.chalk.dim.magenta(
library
)} library`,
successText: `Library ${Color.chalk.dim.magenta(
library
)} successfully installed`
}
)
}

const path = isFile
Expand Down

0 comments on commit 6e84784

Please sign in to comment.