generated from AthennaIO/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from AthennaIO/develop
Commands for compiling, testing and starting code
- Loading branch information
Showing
25 changed files
with
867 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@athenna/artisan", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "", | ||
"license": "MIT", | ||
"author": "João Lenon <[email protected]>", | ||
|
@@ -19,6 +19,8 @@ | |
"typescript" | ||
], | ||
"devDependencies": { | ||
"@types/cli-table": "0.3.0", | ||
"@types/columnify": "1.5.1", | ||
"@types/jest": "27.0.1", | ||
"@types/node": "14.17.0", | ||
"@typescript-eslint/eslint-plugin": "4.31.0", | ||
|
@@ -71,7 +73,9 @@ | |
"ts" | ||
], | ||
"rootDir": ".", | ||
"testRegex": "Test.ts$", | ||
"testMatch": [ | ||
"**/tests/**/*Test.ts" | ||
], | ||
"transform": { | ||
"^.+\\.(t|j)s$": "ts-jest" | ||
}, | ||
|
@@ -160,6 +164,8 @@ | |
"@athenna/logger": "1.1.8", | ||
"@secjs/utils": "1.8.3", | ||
"chalk-rainbow": "1.0.0", | ||
"cli-table": "0.3.11", | ||
"columnify": "1.6.0", | ||
"commander": "9.2.0", | ||
"ejs": "3.1.6", | ||
"figlet": "1.5.2", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @athenna/artisan | ||
* | ||
* (c) João Lenon <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
import { Path } from '@secjs/utils' | ||
import { Command } from 'src/Commands/Command' | ||
import { Command as Commander } from 'commander' | ||
|
||
export class Build extends Command { | ||
/** | ||
* The name and signature of the console command. | ||
*/ | ||
protected signature = 'build' | ||
|
||
/** | ||
* The console command description. | ||
*/ | ||
protected description = 'Compile project from Typescript to Javascript.' | ||
|
||
/** | ||
* Set additional flags in the commander instance. | ||
* This method is executed when registering your command. | ||
* | ||
* @return {void} | ||
*/ | ||
public addFlags(commander: Commander): Commander { | ||
return commander | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return {Promise<void>} | ||
*/ | ||
async handle(_: any, commander: any): Promise<void> { | ||
this.simpleLog('[ BUILDING PROJECT ]', 'rmNewLineStart', 'bold', 'green') | ||
|
||
try { | ||
const rimrafPath = Path.noBuild().pwd('node_modules/.bin/rimraf') | ||
let tscPath = Path.noBuild().pwd('node_modules/.bin/tsc') | ||
|
||
const tscArgs = commander.args.join(' ') | ||
|
||
if (tscArgs) { | ||
tscPath = tscPath.concat(` ${tscArgs}`) | ||
} | ||
|
||
await this.execCommand(`${rimrafPath} dist`) | ||
await this.execCommand(tscPath) | ||
|
||
this.success('Built successfully.') | ||
} catch (error) { | ||
this.error('Failed to build project.') | ||
} | ||
} | ||
} |
Oops, something went wrong.