From 60ae76cf4059de341c97b1ae7bd60086cb31dc71 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Mon, 17 Jun 2024 13:47:18 -0500 Subject: [PATCH] refactor: simplify logic for PackagingDir --- src/sfProject.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sfProject.ts b/src/sfProject.ts index 77f0c04a7..c297d6840 100644 --- a/src/sfProject.ts +++ b/src/sfProject.ts @@ -729,10 +729,14 @@ export class SfProject { /** differentiate between the Base PackageDir (path, maybe default) and the Packaging version (package and maybe a LOT of other fields) by whether is has the `package` property */ export const isPackagingDirectory = (packageDir: PackageDir): packageDir is PackagePackageDir => - 'package' in packageDir && typeof packageDir.package === 'string'; + isPackagingDir(packageDir); + +/** differentiate between the Base PackageDir (path, maybe default) and the Packaging version (package and maybe a LOT of other fields) by whether is has the `package` property */ export const isNamedPackagingDirectory = (packageDir: NamedPackageDir): packageDir is NamedPackagingDir => - 'package' in packageDir && typeof packageDir.package === 'string'; + isPackagingDir(packageDir); +const isPackagingDir = (packageDir: PackageDir | NamedPackageDir): boolean => + 'package' in packageDir && typeof packageDir.package === 'string'; /** * there is no notion of uniqueness in package directory entries * so an attempt of matching an existing entry is a bit convoluted