From e331078ac8ab9d640544064184cd78630227a87e Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Mon, 4 Mar 2024 14:35:58 +0000 Subject: [PATCH] feat(npm): reload rc file after npm commands --- package-lock.json | 12 ++++++------ package.json | 4 ++-- src/helpers/command/Npm.ts | 21 +++++++++++++++++++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33aa2b7..d42d02c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/artisan", - "version": "4.38.0", + "version": "4.39.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/artisan", - "version": "4.38.0", + "version": "4.39.0", "license": "MIT", "dependencies": { "chalk-rainbow": "^1.0.0", @@ -21,7 +21,7 @@ }, "devDependencies": { "@athenna/common": "^4.35.0", - "@athenna/config": "^4.18.0", + "@athenna/config": "^4.19.0", "@athenna/ioc": "^4.18.0", "@athenna/logger": "^4.18.0", "@athenna/test": "^4.22.0", @@ -156,9 +156,9 @@ } }, "node_modules/@athenna/config": { - "version": "4.18.0", - "resolved": "https://registry.npmjs.org/@athenna/config/-/config-4.18.0.tgz", - "integrity": "sha512-nAxoFSJoNF63gJY582J42sFFN0NMsk4jL4rtZKfTKb6URICoO/1rv6DqNc6hBSeiJoLDLZTO72QUzyty+iDfKw==", + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/@athenna/config/-/config-4.19.0.tgz", + "integrity": "sha512-RC6gqSIuOaIvMgdhlTaZqgsraJgffx/SgLPUX0ARkJuGHA/R0Tcw5iqtNu6GVfBVRjqSUe1BlP6pi6FXjxSfpg==", "dev": true, "dependencies": { "dotenv": "^16.4.1", diff --git a/package.json b/package.json index 6e622d6..0230de3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/artisan", - "version": "4.38.0", + "version": "4.39.0", "description": "The Athenna CLI application. Built on top of commander and inspired in @adonisjs/ace.", "license": "MIT", "author": "João Lenon ", @@ -77,7 +77,7 @@ }, "devDependencies": { "@athenna/common": "^4.35.0", - "@athenna/config": "^4.18.0", + "@athenna/config": "^4.19.0", "@athenna/ioc": "^4.18.0", "@athenna/logger": "^4.18.0", "@athenna/test": "^4.22.0", diff --git a/src/helpers/command/Npm.ts b/src/helpers/command/Npm.ts index cb942d0..f6f18c7 100644 --- a/src/helpers/command/Npm.ts +++ b/src/helpers/command/Npm.ts @@ -12,6 +12,7 @@ import { type LinkPackageOptions, type InstallPackageOptions } from '@athenna/common' +import { Rc } from '@athenna/config' export class Npm { /** @@ -34,13 +35,29 @@ export class Npm { libraries: string | string[], options?: LinkPackageOptions ) { - return Exec.link(libraries, options) + await Exec.link(libraries, options).then(() => Rc.reload()) } + /** + * Run `npm install` command inside a child process. + * + * @example + * ```ts + * await this.npm.install('@athenna/common') + * ``` + * + * By default the registry used will be `npm`, but you + * can change it by adding your registry in options: + * + * @example + * ```ts + * await this.npm.install('@athenna/common', { registry: 'yarn' }) + * ``` + */ public async install( libraries: string | string[], options?: InstallPackageOptions ) { - return Exec.install(libraries, options) + await Exec.install(libraries, options).then(() => Rc.reload()) } }