@justinmoto/frontend-guardian-core 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # @justinmoto/frontend-guardian-core
2
2
 
3
- Library (scan engine) for Frontend Guardian. Use this package if you want to call the scanner from your own Node code.
3
+ Library (scan engine) for **Frontend Guardian**.
4
+
5
+ **Frontend Guardian** helps frontend developers keep their UI consistent. After you ship a project it often *looks* good—but when you (or someone else) opens it again later, you notice uneven spacing, inconsistent borders and radii, mixed colors, or copy-pasted components that drifted apart. Frontend Guardian scans your code and flags those issues so you can fix them before they pile up.
6
+
7
+ Use this package if you want to call the scanner from your own Node code.
4
8
 
5
9
  **To run scans from the command line**, use the CLI instead:
6
10
 
@@ -10,6 +10,7 @@ export type Duplicate = {
10
10
  };
11
11
  export type ScanResult = {
12
12
  score: number;
13
+ filesScanned: number;
13
14
  warnings: Warning[];
14
15
  duplicates: Duplicate[];
15
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"scanEngine.d.ts","sourceRoot":"","sources":["../src/scanEngine.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAClF,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;AA+MzF,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAajE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,UAAU,CAG7E"}
1
+ {"version":3,"file":"scanEngine.d.ts","sourceRoot":"","sources":["../src/scanEngine.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7E,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAClF,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;AA+M/G,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAajE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,UAAU,CAG7E"}
@@ -210,7 +210,7 @@ function runAnalysis(fileContents) {
210
210
  }
211
211
  const penalty = warnings.length * 5 + duplicates.length * 10;
212
212
  const score = Math.max(0, Math.min(100, 100 - penalty));
213
- return { score, warnings, duplicates };
213
+ return { score, filesScanned: sourceOnly.length, warnings, duplicates };
214
214
  }
215
215
  export async function scanZip(buffer) {
216
216
  const zip = await JSZip.loadAsync(buffer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justinmoto/frontend-guardian-core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Scan engine for Frontend Guardian. To run scans from the CLI use: npx frontend-guardian .",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/scanEngine.ts CHANGED
@@ -9,7 +9,7 @@ const IGNORE_PATH_PARTS = ["node_modules", ".next", "dist", "build", ".git"];
9
9
 
10
10
  export type Warning = { file: string; message: string; suggestion?: string };
11
11
  export type Duplicate = { files: string[]; reason?: string; suggestion?: string };
12
- export type ScanResult = { score: number; warnings: Warning[]; duplicates: Duplicate[] };
12
+ export type ScanResult = { score: number; filesScanned: number; warnings: Warning[]; duplicates: Duplicate[] };
13
13
 
14
14
  function isCodeFile(path: string): boolean {
15
15
  return EXT.some((e) => path.toLowerCase().endsWith(e));
@@ -213,7 +213,7 @@ function runAnalysis(fileContents: { path: string; code: string }[]): ScanResult
213
213
 
214
214
  const penalty = warnings.length * 5 + duplicates.length * 10;
215
215
  const score = Math.max(0, Math.min(100, 100 - penalty));
216
- return { score, warnings, duplicates };
216
+ return { score, filesScanned: sourceOnly.length, warnings, duplicates };
217
217
  }
218
218
 
219
219
  export async function scanZip(buffer: Buffer): Promise<ScanResult> {