Skip to content

Commit

Permalink
Merge pull request #216 from AthennaIO/develop
Browse files Browse the repository at this point in the history
chore(npm): update dependencies
  • Loading branch information
jlenon7 authored Jan 23, 2025
2 parents f399e67 + 7e08071 commit 92f7434
Show file tree
Hide file tree
Showing 19 changed files with 692 additions and 478 deletions.
1,063 changes: 633 additions & 430 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/artisan",
"version": "5.4.0",
"version": "5.5.0",
"description": "The Athenna CLI application. Built on top of commander and inspired in @adonisjs/ace.",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down Expand Up @@ -76,15 +76,15 @@
"ora": "^6.3.1"
},
"devDependencies": {
"@athenna/common": "^5.3.0",
"@athenna/config": "^5.1.0",
"@athenna/ioc": "^5.0.0",
"@athenna/logger": "^5.1.0",
"@athenna/test": "^5.2.0",
"@athenna/common": "^5.7.0",
"@athenna/config": "^5.3.0",
"@athenna/ioc": "^5.1.0",
"@athenna/logger": "^5.2.0",
"@athenna/test": "^5.3.0",
"@athenna/tsconfig": "^5.0.0",
"@athenna/view": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@athenna/view": "^5.2.0",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.1",
Expand Down
4 changes: 2 additions & 2 deletions src/artisan/BaseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
*/

import { Rc } from '@athenna/config'
import { Color } from '@athenna/common'
import { Npm } from '#src/helpers/command/Npm'
import { Color, Macroable } from '@athenna/common'
import { Prompt } from '#src/helpers/command/Prompt'
import { Logger } from '#src/helpers/command/Logger'
import { Annotation } from '#src/helpers/Annotation'
import type { Commander } from '#src/artisan/Commander'
import { Generator } from '#src/helpers/command/Generator'
import { CommanderHandler } from '#src/handlers/CommanderHandler'

export abstract class BaseCommand {
export abstract class BaseCommand extends Macroable {
/**
* The command signature/name. This option will
* define how the command should be called.
Expand Down
4 changes: 2 additions & 2 deletions src/commands/TemplateCustomizeCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { BaseCommand } from '#src'
import { Path, Exec, File } from '@athenna/common'
import { Path, File } from '@athenna/common'
import { resolve, relative, isAbsolute } from 'node:path'

export class TemplateCustomizeCommand extends BaseCommand {
Expand All @@ -26,7 +26,7 @@ export class TemplateCustomizeCommand extends BaseCommand {
const templates: any = {}
const paths = Config.get('rc.templates')

await Exec.concurrently(Object.keys(paths), async key => {
await Object.keys(paths).athenna.concurrently(async key => {
let path = paths[key]

if (!isAbsolute(path)) {
Expand Down
8 changes: 5 additions & 3 deletions src/handlers/ConsoleExceptionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ export class ConsoleExceptionHandler {
* The exception handler of all Artisan commands.
*/
public async handle(error: any): Promise<void> {
error.code = String.toSnakeCase(
`${error.code}` || `${error.name}`
).toUpperCase()
if (error.code === undefined) {
error.code = error.name || 'E_INTERNAL_SERVER'
}

error.code = String.toConstantCase(error.code)

const isException = Is.Exception(error)
const isDebugMode = Config.get('app.debug', true)
Expand Down
6 changes: 4 additions & 2 deletions src/helpers/Action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

import { Log } from '@athenna/logger'
import { Color } from '@athenna/common'
import { Color, Macroable } from '@athenna/common'

export class Action {
export class Action extends Macroable {
/**
* The main action that is being executed.
*
Expand All @@ -30,6 +30,8 @@ export class Action {
private biggestAction: string

public constructor(action: string) {
super()

this.action = action
this.biggestAction = this.getBiggestAction(action)
}
Expand Down
6 changes: 4 additions & 2 deletions src/helpers/Formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

import { Command, type Help } from 'commander'
import { Color, Options } from '@athenna/common'
import { Color, Options, Macroable } from '@athenna/common'

export class Formatter {
export class Formatter extends Macroable {
public static builder(cmd: Command, help: Help) {
return new Formatter(cmd, help)
}
Expand All @@ -34,6 +34,8 @@ export class Formatter {
}

public constructor(cmd: Command, help: Help) {
super()

this.cmd = cmd
this.help = help

Expand Down
3 changes: 2 additions & 1 deletion src/helpers/Instruction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import boxes from 'cli-boxes'
import CliTable3 from 'cli-table3'

import { Table } from '#src/helpers/Table'
import { Macroable } from '@athenna/common'

export class Instruction {
export class Instruction extends Macroable {
/**
* The head of the instruction.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/Sticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import boxes from 'cli-boxes'
import CliTable3 from 'cli-table3'

import { Table } from '#src/helpers/Table'
import { Macroable } from '@athenna/common'

export class Sticker {
export class Sticker extends Macroable {
/**
* The head of the instruction.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import CliTable from 'cli-table3'

import { Log } from '@athenna/logger'
import { Color } from '@athenna/common'
import { Color, Macroable } from '@athenna/common'
import type { TableRow } from '#src/types/TableRow'

export class Table {
export class Table extends Macroable {
/**
* The state of the table. This property will
* have the head and rows of your table.
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import ora, { type Ora } from 'ora'

import type { ChalkInstance } from 'chalk'
import { Is, Color } from '@athenna/common'
import { Is, Color, Macroable } from '@athenna/common'
import type { TaskCallback } from '#src/types/TaskCallback'
import { RunningTaskException } from '#src/exceptions/RunningTaskException'

export type TaskMap = { title: string; cb: TaskCallback }

export class Task {
export class Task extends Macroable {
/**
* The tasks saved by "add" method.
*/
Expand All @@ -30,7 +30,7 @@ export class Task {
* await this.logger
* .task()
* .add('hello', async task => {
* await Exec.sleep(1000)
* await Sleep.for(1).seconds().wait()
* await task.complete('world')
* })
* .run()
Expand All @@ -56,7 +56,7 @@ export class Task {
* await this.logger
* .task()
* .addPromise('hello', async () => {
* await Exec.sleep(1000)
* await Sleep.for(1).seconds().wait()
* })
* .run()
* ```
Expand Down Expand Up @@ -88,7 +88,7 @@ export class Task {
* await this.logger
* .task()
* .add('hello', async task => {
* await Exec.sleep(1000)
* await Sleep.for(1).seconds().wait()
* await task.fail('Something went wrong')
* })
* .run()
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/command/Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
*/

import { View } from '@athenna/view'
import { Path, File, String } from '@athenna/common'
import { sep, resolve, isAbsolute } from 'node:path'
import { Path, File, String, Macroable } from '@athenna/common'
import { AlreadyExistFileException } from '#src/exceptions/AlreadyExistFileException'

export class Generator {
export class Generator extends Macroable {
private _path: string
private _fileName: string
private _dest: string
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/command/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class Logger extends AthennaLogger {
* @example
* ```ts
* async function test() {
* await Exec.sleep(2000)
* await Sleep.for(2).seconds().wait()
* return { hello: 'world' }
* }
*
Expand Down Expand Up @@ -309,7 +309,7 @@ export class Logger extends AthennaLogger {
* await this.logger
* .task()
* .add('hello', async task => {
* await Exec.sleep(1000)
* await Sleep.for(2).seconds().wait()
* await task.complete('world')
* })
* .run()
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/command/Npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

import {
Exec,
Macroable,
type LinkPackageOptions,
type InstallPackageOptions
} from '@athenna/common'

import { Rc } from '@athenna/config'

export class Npm {
export class Npm extends Macroable {
/**
* Run `npm link` command inside a child process.
*
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/command/Prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import type {
CheckboxQuestionOptions
} from 'inquirer'

import { Options } from '@athenna/common'
import { Options, Macroable } from '@athenna/common'
import { InquirerPromptException } from '#src/exceptions/InquirerPromptException'

export class Prompt {
export class Prompt extends Macroable {
/**
* The inquirer prompt API.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/kernels/ConsoleKernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { sep, isAbsolute, resolve } from 'node:path'
import { Path, Exec, File, Is, Module } from '@athenna/common'
import { Path, File, Is, Module } from '@athenna/common'
import { Artisan, CommanderHandler, ConsoleExceptionHandler } from '#src'

export class ConsoleKernel {
Expand Down Expand Up @@ -109,7 +109,7 @@ export class ConsoleKernel {
private async registerAllCommands() {
const keys = Object.keys(Config.get('rc.commands', {}))

return Exec.concurrently(keys, key => {
return keys.athenna.concurrently(key => {
const path = Config.get(`rc.commands.${key}`)

if (Is.String(path)) {
Expand Down
4 changes: 2 additions & 2 deletions src/testing/plugins/command/TestCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

import { Artisan } from '#src'
import { Assert } from '@japa/assert'
import { Path, type CommandOutput } from '@athenna/common'
import { Macroable, Path, type CommandOutput } from '@athenna/common'
import { TestOutput } from '#src/testing/plugins/command/TestOutput'
import type { CallInChildOptions } from '#src/types/CallInChildOptions'

export class TestCommand {
export class TestCommand extends Macroable {
/**
* The Artisan file path that will be used to run commands.
*
Expand Down
6 changes: 4 additions & 2 deletions src/testing/plugins/command/TestOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

import { inspect } from 'node:util'
import type { Assert } from '@athenna/test'
import type { CommandOutput } from '@athenna/common'
import { Macroable, type CommandOutput } from '@athenna/common'

export class TestOutput {
export class TestOutput extends Macroable {
/**
* Japa assert class instance.
*/
Expand All @@ -23,6 +23,8 @@ export class TestOutput {
public output: CommandOutput

public constructor(assert: Assert, output: CommandOutput) {
super()

this.assert = assert
this.output = output
}
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/helpers/TaskTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import { Task } from '#src/helpers/Task'
import { Path, Exec } from '@athenna/common'
import { Path, Sleep } from '@athenna/common'
import { Test, BeforeEach, type Context } from '@athenna/test'
import { RunningTaskException } from '#src/exceptions/RunningTaskException'

Expand Down Expand Up @@ -51,14 +51,14 @@ export default class TaskTest {

await new Task()
.addPromise('Testing 1', async () => {
await Exec.sleep(100)
await Sleep.for(100).milliseconds().wait()
})
.addPromise('Testing 2', async () => {
await Exec.sleep(100)
await Sleep.for(100).milliseconds().wait()
})
.addPromise('Testing 3', async () => {
value = null
await Exec.sleep(100)
await Sleep.for(100).milliseconds().wait()
})
.run()

Expand All @@ -71,10 +71,10 @@ export default class TaskTest {

const task = new Task()
.addPromise('Testing 1', async () => {
await Exec.sleep(100)
await Sleep.for(100).milliseconds().wait()
})
.addPromise('Testing 2', async () => {
await Exec.sleep(100)
await Sleep.for(100).milliseconds().wait()
})
.addPromise('Testing 3', async () => {
throw new Error('Error')
Expand Down

0 comments on commit 92f7434

Please sign in to comment.