@doccov/cli 0.4.5 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +15 -1
  2. 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
- const workspacePatterns = Array.isArray(rootPackageJson.workspaces) ? rootPackageJson.workspaces : rootPackageJson.workspaces?.packages || [];
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()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doccov/cli",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "DocCov CLI - Documentation coverage and drift detection for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",