From 2f3f7c663492b6768c17edf1a28dc0817b736d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Sat, 25 Mar 2023 23:54:10 -0300 Subject: [PATCH] chore(ignite): set rc.callPath before loading root path --- package-lock.json | 4 ++-- package.json | 2 +- src/Ignite/Ignite.ts | 10 +++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 485a998..193a423 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/core", - "version": "3.2.0", + "version": "3.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@athenna/core", - "version": "3.2.0", + "version": "3.3.0", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.1", diff --git a/package.json b/package.json index 3ae62bf..0299b3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "3.2.0", + "version": "3.3.0", "description": "The plug and play Node.js framework.", "license": "MIT", "author": "João Lenon ", diff --git a/src/Ignite/Ignite.ts b/src/Ignite/Ignite.ts index 0df23a0..be9baa0 100644 --- a/src/Ignite/Ignite.ts +++ b/src/Ignite/Ignite.ts @@ -220,6 +220,10 @@ export class Ignite { * ``` */ public setApplicationRootPath(): void { + if (!Config.exists('rc.callPath')) { + Config.set('rc.callPath', process.cwd()) + } + if (!process.env.CORE_TESTING) { const __dirname = Module.createDirname(import.meta.url) @@ -303,7 +307,11 @@ export class Ignite { */ public async setRcContentAndAppVars() { const file = new File(this.options.athennaRcPath, '') - const pkgJson = await new File(Path.pwd('package.json')).getContentAsJson() + const pkgJsonFile = new File(Path.pwd('package.json'), '') + + const pkgJson = pkgJsonFile.fileExists + ? await pkgJsonFile.getContentAsJson() + : {} const corePkgJson = await new File('../../package.json').getContentAsJson() const coreSemverVersion = this.parseVersion(corePkgJson.version)