mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
* fix(scope,review,ship): recognise Dart and Flutter in diff scope and test detection (#3284) Port of arlophoenix's #3284 onto current main, squashed: - gstack-diff-scope: .dart is frontend and backend; pubspec.lock is config. - lib/frontend-scope.ts mirrors the frontend half; gstack-design-detect never sends .dart to the impeccable engine. - Test bootstrap, coverage audits and review-army detect Dart/Flutter (RUNTIME:dart, FRAMEWORK:flutter, dart_test.yaml, *_test.dart). - Adversarial DIFF_SIZE sums git diff --numstat. On top of the contributor's diff: shorten the bootstrap's ecosystem-marker comment so /design-review stays at its SKILL.md size pin, lower the 31 pins that shrank, and add the CHANGELOG entry. Co-authored-by: arlophoenix <arlo.phoenix@gmail.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.160.0 fix(scope,review,ship): recognise Dart and Flutter in diff scope and test detection (#3300) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: arlophoenix <arlo.phoenix@gmail.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
37 lines
1.8 KiB
TypeScript
37 lines
1.8 KiB
TypeScript
// lib/frontend-scope.ts — which repo paths count as frontend.
|
|
//
|
|
// Pure module: no I/O, no imports from scripts/. The patterns mirror the
|
|
// `m_frontend` arm of bin/gstack-diff-scope (the bash source of truth for
|
|
// SCOPE_FRONTEND); test/frontend-scope.test.ts pins the two against the same
|
|
// sample paths so they cannot drift. bin/gstack-design-detect.ts uses this to
|
|
// derive `scan --changed <base>` targets without consuming a shell-split list.
|
|
|
|
const EXTENSIONS = new Set([
|
|
'.css', '.scss', '.less', '.sass', '.pcss',
|
|
'.tsx', '.jsx', '.vue', '.svelte', '.astro',
|
|
'.erb', '.haml', '.slim', '.hbs', '.ejs',
|
|
'.html',
|
|
// Dart: a Flutter widget and a repository share the extension, so the bash
|
|
// script counts .dart as frontend AND backend; only the frontend half lives here.
|
|
'.dart',
|
|
]);
|
|
|
|
// Root-level only: the bash arm's glob (`tailwind.config.*`) is matched against the
|
|
// whole repo-relative path, so a nested `apps/web/tailwind.config.js` is not frontend there.
|
|
const ROOT_CONFIG_PREFIXES = ['tailwind.config.', 'postcss.config.'];
|
|
|
|
/** Repo-relative path (forward slashes) → is it a frontend file per gstack-diff-scope? */
|
|
export function isFrontendPath(relPath: string): boolean {
|
|
const rel = relPath.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
const base = rel.slice(rel.lastIndexOf('/') + 1);
|
|
const dot = base.lastIndexOf('.');
|
|
const ext = dot >= 0 ? base.slice(dot) : ''; // case-sensitive, exactly like gstack-diff-scope's globs
|
|
if (EXTENSIONS.has(ext)) return true;
|
|
if (!rel.includes('/') && ROOT_CONFIG_PREFIXES.some(p => base.startsWith(p))) return true;
|
|
if (rel.startsWith('app/views/')) return true;
|
|
if (rel.includes('/components/')) return true;
|
|
if (rel.startsWith('styles/') || rel.startsWith('css/')) return true;
|
|
if (rel.startsWith('app/assets/stylesheets/')) return true;
|
|
return false;
|
|
}
|