diff --git a/packages/.DS_Store b/packages/.DS_Store new file mode 100644 index 0000000..a2d1fa6 Binary files /dev/null and b/packages/.DS_Store differ diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index b646c9d..ef132b8 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -2,6 +2,7 @@ import { getPackages } from "@manypkg/get-packages"; import path from "path"; import spawn from "spawndamnit"; import * as logger from "./logger"; +import { GetPrefix } from "./utils"; import { ExitError } from "./errors"; export async function runCmd(args: string[], cwd: string) { @@ -23,10 +24,10 @@ export async function runCmd(args: string[], cwd: string) { } const matchingPackages = packages.filter(pkg => { - 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"