generated from AthennaIO/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
185 additions
and
57 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/core", | ||
"version": "4.30.0", | ||
"version": "4.31.0", | ||
"description": "One foundation for multiple applications.", | ||
"license": "MIT", | ||
"author": "João Lenon <[email protected]>", | ||
|
@@ -57,6 +57,7 @@ | |
"./commands/ServeCommand": "./src/commands/ServeCommand.js", | ||
"./commands/TestCommand": "./src/commands/TestCommand.js", | ||
"./commands/BuildCommand": "./src/commands/BuildCommand.js", | ||
"./commands/InstallCommand": "./src/commands/InstallCommand.js", | ||
"./testing/BaseHttpTest": "./src/testing/BaseHttpTest.js", | ||
"./testing/BaseConsoleTest": "./src/testing/BaseConsoleTest.js" | ||
}, | ||
|
@@ -76,15 +77,15 @@ | |
"semver": "^7.5.4" | ||
}, | ||
"devDependencies": { | ||
"@athenna/artisan": "^4.37.0", | ||
"@athenna/common": "^4.34.0", | ||
"@athenna/config": "^4.16.0", | ||
"@athenna/http": "^4.23.0", | ||
"@athenna/ioc": "^4.16.0", | ||
"@athenna/logger": "^4.17.0", | ||
"@athenna/artisan": "^4.38.0", | ||
"@athenna/common": "^4.35.0", | ||
"@athenna/config": "^4.18.0", | ||
"@athenna/http": "^4.24.0", | ||
"@athenna/ioc": "^4.18.0", | ||
"@athenna/logger": "^4.18.0", | ||
"@athenna/test": "^4.22.0", | ||
"@athenna/tsconfig": "^4.12.0", | ||
"@athenna/view": "^4.18.0", | ||
"@athenna/view": "^4.20.0", | ||
"@typescript-eslint/eslint-plugin": "^6.7.4", | ||
"@typescript-eslint/parser": "^6.7.4", | ||
"commitizen": "^4.2.6", | ||
|
@@ -249,6 +250,9 @@ | |
"path": "#src/commands/BuildCommand", | ||
"tsconfig": "./tests/fixtures/tsconfig.json", | ||
"outDir": "build" | ||
}, | ||
"install": { | ||
"path": "#src/commands/InstallCommand" | ||
} | ||
}, | ||
"providers": [ | ||
|
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
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,75 @@ | ||
/** | ||
* @athenna/core | ||
* | ||
* (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 { File, Module, Path } from '@athenna/common' | ||
import { Argument, BaseCommand, Option } from '@athenna/artisan' | ||
|
||
export class InstallCommand extends BaseCommand { | ||
@Argument({ | ||
signature: '<...libraries>', | ||
description: 'The libraries to install in your project.' | ||
}) | ||
public libraries: string[] | ||
|
||
@Option({ | ||
signature: '--registry', | ||
description: | ||
'Change the package manager that will be used to install the libraries', | ||
default: 'npm' | ||
}) | ||
public registry: string | ||
|
||
@Option({ | ||
signature: '-D, --save-dev', | ||
description: 'Install libraries as devDependencies.', | ||
default: false | ||
}) | ||
public isDev: boolean | ||
|
||
public static signature(): string { | ||
return 'install' | ||
} | ||
|
||
public static description(): string { | ||
return 'Install libraries and automatically run the configurer if it exist.' | ||
} | ||
|
||
public async handle(): Promise<void> { | ||
this.logger.simple('({bold,green} [ INSTALLING LIBRARIES ])\n') | ||
|
||
const task = this.logger.task() | ||
|
||
task.addPromise(`Installing ${this.libraries.join(', ')} libraries`, () => { | ||
return this.npm.install(this.libraries, { | ||
registry: Config.get('rc.commands.install.registry', this.registry), | ||
dev: this.isDev | ||
}) | ||
}) | ||
|
||
for (const library of this.libraries) { | ||
const path = Path.nodeModules(`${library}/configurer/index.js`) | ||
|
||
if (!(await File.exists(path))) { | ||
continue | ||
} | ||
|
||
task.addPromise(`Configuring ${library}`, async () => { | ||
const Configurer = await Module.getFrom(path) | ||
|
||
return new Configurer().setPath(path).configure() | ||
}) | ||
} | ||
|
||
await task.run() | ||
|
||
this.logger.success( | ||
`Successfully installed ${this.libraries.join(', ')} libraries` | ||
) | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.