Skip to content

Commit 63ef259

Browse files
committed
refactor: rename PACKAGE_MIN_BYTES to FRAMEWORK_MIN_BYTES and simplify validation logic for framework directories
1 parent 15b078e commit 63ef259

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

packages/igniteui-mcp/igniteui-doc-mcp/scripts/validate-package.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const DB_PATH = join(PKG_ROOT, "dist", "igniteui-docs.db");
77
const DB_MIN_BYTES = 20 * 1024 * 1024; // 20 MB minimum for the SQLite DB
88
const DOCS_ROOT = join(PKG_ROOT, "docs");
99
const FRAMEWORK_DIRS = ["angular-api", "react-api", "webcomponents-api", "blazor-api"];
10-
const PACKAGE_MIN_BYTES = 300 * 1024; // 300 KB minimum for each package
10+
const FRAMEWORK_MIN_BYTES = 300 * 1024; // 300 KB minimum for each docs/<framework>-api directory
1111

1212
const errors: string[] = [];
1313

@@ -86,19 +86,11 @@ for (const framework of FRAMEWORK_DIRS) {
8686
errors.push(`Docs framework dir missing: ${frameworkDir}`);
8787
continue;
8888
}
89-
const packages = readdirSync(frameworkDir, { withFileTypes: true }).filter(e => e.isDirectory());
90-
if (packages.length === 0) {
91-
errors.push(`No package subfolders in ${frameworkDir}`);
92-
continue;
93-
}
94-
for (const pkg of packages) {
95-
const pkgDir = join(frameworkDir, pkg.name);
96-
const size = dirSize(pkgDir);
97-
if (size < PACKAGE_MIN_BYTES) {
98-
errors.push(`Package too small: ${framework}/${pkg.name} = ${formatSize(size)} < ${formatSize(PACKAGE_MIN_BYTES)}`);
99-
} else {
100-
console.log(`OK pkg ${formatSize(size).padStart(10)} ${framework}/${pkg.name}`);
101-
}
89+
const size = dirSize(frameworkDir);
90+
if (size < FRAMEWORK_MIN_BYTES) {
91+
errors.push(`Docs framework dir too small: ${framework} = ${formatSize(size)} < ${formatSize(FRAMEWORK_MIN_BYTES)}`);
92+
} else {
93+
console.log(`OK dir ${formatSize(size).padStart(10)} ${framework}`);
10294
}
10395
}
10496

0 commit comments

Comments
 (0)