From fbf1d8df3330a9f30427cf8f9f3377ada07066bd Mon Sep 17 00:00:00 2001 From: Utkarsh Kumar Date: Thu, 26 Aug 2021 13:52:06 +0600 Subject: [PATCH] Fixed an issue that caused multiple packages to be seleceted --- packages/.DS_Store | Bin 0 -> 6148 bytes packages/cli/src/run.ts | 9 +++++---- packages/cli/src/utils.ts | 11 +++++++++++ yarn.lock | 8 ++++---- 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 packages/.DS_Store diff --git a/packages/.DS_Store b/packages/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a2d1fa60a4c00738221a1637b4808464d5b4ebcd GIT binary patch literal 6148 zcmeHK%}T>S5Z<*_w-vDmp&oPb)P}u`{sy&FswVWYMdzdmN>9;v}=U=S(lrI(3q< ztM#)e3O;qmJ@-fHps{@vg^A;bqp3{xy%B_5UHG9FrM+ktda<0xRt_O*qBdwWv#i}R z_RUV-GBWdE4~%ZNljk+j+%*qRhIbE-*;D@fqUhzozLYJECA@;7tGlihypskB@hjb zmc~LMctE&H1yreAKQXvUhjBy4SsDw4DxGn;GR&h_E*~#kt`6gd3}@U@NIfw?49qi7 zQDy_r|6}-N7C!RlQ^+C)h=G5`0I&A#eh-S$XY04}@T@hU4WXf6T!9J*=yR6 { - return ( - pkg.packageJson.name.includes(args[0]) || - path.relative(root.dir, pkg.dir).includes(args[0]) - ); + const prefixed = `${GetPrefix(pkg.packageJson)}/${args[0]}` + + if (prefixed === pkg.packageJson.name) + return prefixed }); if (matchingPackages.length > 1) { diff --git a/packages/cli/src/utils.ts b/packages/cli/src/utils.ts index cde8851..a7954a2 100644 --- a/packages/cli/src/utils.ts +++ b/packages/cli/src/utils.ts @@ -31,3 +31,14 @@ export async function install(tool: Tool, cwd: string) { { cwd, stdio: "inherit" } ); } + +export function GetPrefix(packagejson: Package["packageJson"]){ + const name = packagejson.name + const splitName = name.split("/") + + + if(splitName.length === 0) + throw new Error("Invalid package name. Please use '/' to separate the package with it's scope") + + return splitName[0] +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 840cf54..e13cdb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14074,10 +14074,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== +typescript@^4.0.3: + version "4.3.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" + integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== ua-parser-js@^0.7.18: version "0.7.20"