mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 14:16:28 +03:00
Fix: strip inline YAML comments when reading pnpm workspace globs (#570)
An inline comment on a pnpm-workspace.yaml packages line defeated the end-anchored flow-list regex and the block-list state switch, so workspaces outside apps/ or packages/ went unrecognized. Reuses the engine's existing stripInlineYamlComment, matching context.mjs. Written with AI assistance (Cursor); reviewed by maintainer. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -603,7 +603,7 @@ function readWorkspacePatterns(dir) {
|
||||
try {
|
||||
let inPackages = false;
|
||||
for (const line of fs.readFileSync(path.join(dir, 'pnpm-workspace.yaml'), 'utf-8').split(/\r?\n/)) {
|
||||
const trimmed = line.trim();
|
||||
const trimmed = stripInlineYamlComment(line).trim();
|
||||
if (!trimmed || trimmed.startsWith('#')) continue;
|
||||
const flow = trimmed.match(/^packages:\s*\[(.*)\]\s*$/);
|
||||
if (flow) {
|
||||
|
||||
@@ -117,6 +117,23 @@ describe('detect CLI monorepo DESIGN.md inheritance', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('pnpm flow list with inline comment and non-standard dirs still detected', () => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'impeccable-detect-mono-flow-'));
|
||||
tempRoots.push(dir);
|
||||
fs.writeFileSync(path.join(dir, 'DESIGN.md'), DESIGN_MD);
|
||||
fs.writeFileSync(path.join(dir, 'pnpm-workspace.yaml'), 'packages: ["services/*"] # deploy targets\n');
|
||||
fs.mkdirSync(path.join(dir, 'services/api'), { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, 'services/api/package.json'), '{"name":"api"}');
|
||||
const page = path.join(dir, 'services/api/page.html');
|
||||
fs.writeFileSync(page, PAGE_HTML);
|
||||
|
||||
const findings = runDetect(dir, [page]);
|
||||
assert.ok(
|
||||
fontFindingsFor(findings, page).some((f) => f.ignoreValue === 'verdana'),
|
||||
'inline YAML comment must not defeat workspace-glob recognition',
|
||||
);
|
||||
});
|
||||
|
||||
it('directory target: scan apps/web dir inherits root DESIGN.md', () => {
|
||||
const { dir, page, webDir } = mkPnpmMonorepo();
|
||||
const findings = runDetect(dir, [webDir]);
|
||||
|
||||
Reference in New Issue
Block a user