@doccov/cli 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +15 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -327,7 +327,21 @@ async function findPackageInMonorepo(rootDir, packageName) {
|
|
|
327
327
|
return null;
|
|
328
328
|
}
|
|
329
329
|
const rootPackageJson = JSON.parse(fs.readFileSync(rootPackageJsonPath, "utf-8"));
|
|
330
|
-
|
|
330
|
+
if (rootPackageJson.name === packageName) {
|
|
331
|
+
return rootDir;
|
|
332
|
+
}
|
|
333
|
+
let workspacePatterns = Array.isArray(rootPackageJson.workspaces) ? rootPackageJson.workspaces : rootPackageJson.workspaces?.packages || [];
|
|
334
|
+
if (workspacePatterns.length === 0) {
|
|
335
|
+
const pnpmWorkspacePath = path2.join(rootDir, "pnpm-workspace.yaml");
|
|
336
|
+
if (fs.existsSync(pnpmWorkspacePath)) {
|
|
337
|
+
const content = fs.readFileSync(pnpmWorkspacePath, "utf-8");
|
|
338
|
+
const packagesMatch = content.match(/packages:\s*\n((?:\s*-\s*.+\n?)+)/);
|
|
339
|
+
if (packagesMatch) {
|
|
340
|
+
workspacePatterns = packagesMatch[1].split(`
|
|
341
|
+
`).map((line) => line.replace(/^\s*-\s*['"]?/, "").replace(/['"]?\s*$/, "")).filter((line) => line.length > 0);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
331
345
|
for (const pattern of workspacePatterns) {
|
|
332
346
|
const searchPath = path2.join(rootDir, pattern.replace("/**", "").replace("/*", ""));
|
|
333
347
|
if (fs.existsSync(searchPath) && fs.statSync(searchPath).isDirectory()) {
|