From 40cbce759882c6948a2b949a4b550280d2d2f35e Mon Sep 17 00:00:00 2001 From: Roberto Hernandez Date: Tue, 10 Sep 2024 08:29:56 -0600 Subject: [PATCH] feat: solving an issue with the getNoPlatformInfo function --- src/util/platform/getNoPlatformInfo.test.ts | 7 ++++--- src/util/platform/getNoPlatformInfo.ts | 11 ++++------- src/util/platform/getPlatformInfo.ts | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/util/platform/getNoPlatformInfo.test.ts b/src/util/platform/getNoPlatformInfo.test.ts index 5cdbbc3..2d87e4c 100644 --- a/src/util/platform/getNoPlatformInfo.test.ts +++ b/src/util/platform/getNoPlatformInfo.test.ts @@ -14,14 +14,15 @@ describe('getNoPlatformInfo', () => { await expect(getNoPlatformInfo()).resolves.toEqual({ name: 'none', platformMajorVersion: 1, - emulsifyParentDirectory: '/home/uname/Projects/cornflake', - root: '/home/uname/Projects/cornflake/', + emulsifyParentDirectory: + '/home/uname/Projects/cornflake/web/themes/custom', + root: '/home/uname/Projects/cornflake', }); }); it('returns void if no project.emulsify.json file is found', async () => { expect.assertions(1); findFileMock.mockReturnValueOnce(undefined); - await expect(getNoPlatformInfo()).resolves.toBe(undefined); + await expect(getNoPlatformInfo()).resolves.toBeUndefined(); }); }); diff --git a/src/util/platform/getNoPlatformInfo.ts b/src/util/platform/getNoPlatformInfo.ts index 98f4ef7..188a362 100644 --- a/src/util/platform/getNoPlatformInfo.ts +++ b/src/util/platform/getNoPlatformInfo.ts @@ -1,7 +1,6 @@ -import type { PlatformInstanceInfo } from '@emulsify-cli/internal'; -import { resolve } from 'path'; +import { dirname, join } from 'path'; import findFileInCurrentPath from '../fs/findFileInCurrentPath.js'; -import { resolveCurrentPath } from '../fs/resolveCurrentPath.js'; +import type { PlatformInstanceInfo } from '@emulsify-cli/internal'; /** * Looks for no platform specified within the cwd, and returns information @@ -12,13 +11,11 @@ export default async function getNoPlatformInfo(): Promise