Skip to content

Commit

Permalink
Merge pull request #7 from AthennaIO/develop
Browse files Browse the repository at this point in the history
refactor: remove compile, test and run commands
  • Loading branch information
jlenon7 authored Apr 22, 2022
2 parents aa94b65 + 32dd74a commit 665fe42
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 252 deletions.
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": "1.0.7",
"version": "1.0.8",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
61 changes: 0 additions & 61 deletions src/Commands/Build.ts

This file was deleted.

7 changes: 1 addition & 6 deletions src/Commands/Eslint/Fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { parse } from 'path'
import { Command } from 'src/Commands/Command'
import { Command as Commander } from 'commander'
import { Path } from '@secjs/utils'
import { existsSync } from 'fs'

export class Fix extends Command {
/**
Expand Down Expand Up @@ -57,11 +56,7 @@ export class Fix extends Command {
const { name } = parse(filePath)

try {
let eslintPath = Path.noBuild().pwd('node_modules/.bin/eslint')

if (!existsSync(eslintPath)) {
eslintPath = './node_modules/.bin/eslint'
}
const eslintPath = Path.noBuild().pwd('node_modules/.bin/eslint')

await this.execCommand(`${eslintPath} ${filePath} --fix --quiet`)

Expand Down
16 changes: 5 additions & 11 deletions src/Commands/Route/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* file that was distributed with this source code.
*/

import { existsSync } from 'fs'
import { Path, String } from '@secjs/utils'
import { Command } from 'src/Commands/Command'
import { Command as Commander } from 'commander'
import { existsSync } from 'fs'

export class List extends Command {
/**
Expand Down Expand Up @@ -53,18 +53,12 @@ export class List extends Command {
return
}

let routePath = Path.pwd('routes/http.ts')
const routePath = Path.pwd('dist/routes/http.js')

if (!existsSync(routePath)) {
if (!existsSync(routePath.replace('ts', 'js'))) {
this.error(
`The file ({yellow} "routes/http") has not been found in any extension (js, ts).`,
)

return
} else {
routePath = routePath.replace('ts', 'js')
}
this.error(
`The file ({yellow} "dist/routes/http.js") has not been found.`,
)
}

await import(routePath)
Expand Down
57 changes: 0 additions & 57 deletions src/Commands/Start.ts

This file was deleted.

60 changes: 0 additions & 60 deletions src/Commands/StartDev.ts

This file was deleted.

56 changes: 0 additions & 56 deletions src/Commands/Test.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/Utils/Exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ export class Exec {
* Execute a command of child process exec as promise.
*
* @param command
* @param ignoreErrors
* @return void
*/
static async command(command: string, ignoreErrors = false): Promise<void> {
if (ignoreErrors) {
try {
await exec(command)
} catch (error) {}

return
}

await exec(command)
Expand Down

0 comments on commit 665fe42

Please sign in to comment.