@synergyerp/frontend-standards 1.6.2 → 1.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergyerp/frontend-standards",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "SynergyERP frontend standards — ESLint, Prettier, commitlint, Husky, Vitest, TypeScript configs, modularization enforcement, and PR templates.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -78,8 +78,9 @@
78
78
  "lint": "eslint .",
79
79
  "format": "prettier --write .",
80
80
  "format:check": "prettier --check .",
81
- "check-modularization": "node scripts/check-modularization.mjs; exit 0",
82
- "check-types": "tsc --noEmit; exit 0",
81
+ "check-modularization": "node scripts/check-modularization.mjs",
82
+ "check-types": "tsc --noEmit",
83
+ "check-documentation": "node scripts/check-documentation.mjs",
83
84
  "test:ci": "exit 0",
84
85
  "test": "exit 0"
85
86
  }
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Documentation Validation Script
4
+ * Validates that child projects in apps/* have required documentation files
5
+ * with minimum content size to prevent empty/blank documentation.
6
+ */
7
+
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+
11
+ const MIN_DOC_SIZE = 500; // Minimum bytes for documentation files
12
+ const REQUIRED_DOCS = [
13
+ 'README.md',
14
+ 'REQUIREMENTS.md',
15
+ 'WORKFLOW.md'
16
+ ];
17
+
18
+ const APPS_DIR = 'apps';
19
+
20
+ function checkDocumentation(projectRoot = '.') {
21
+ const appsPath = path.join(projectRoot, APPS_DIR);
22
+
23
+ if (!fs.existsSync(appsPath)) {
24
+ console.log('✅ No apps/ directory found - skipping documentation check');
25
+ return { valid: true, errors: [] };
26
+ }
27
+
28
+ const apps = fs.readdirSync(appsPath).filter(name => {
29
+ const fullPath = path.join(appsPath, name);
30
+ return fs.statSync(fullPath).isDirectory();
31
+ });
32
+
33
+ if (apps.length === 0) {
34
+ console.log('✅ No child projects found in apps/ - skipping documentation check');
35
+ return { valid: true, errors: [] };
36
+ }
37
+
38
+ const errors = [];
39
+ let valid = true;
40
+
41
+ for (const app of apps) {
42
+ const appPath = path.join(appsPath, app);
43
+
44
+ for (const docFile of REQUIRED_DOCS) {
45
+ const docPath = path.join(appPath, docFile);
46
+
47
+ if (!fs.existsSync(docPath)) {
48
+ errors.push(`❌ ${app}/${docFile}: Missing required documentation file`);
49
+ valid = false;
50
+ continue;
51
+ }
52
+
53
+ const stats = fs.statSync(docPath);
54
+ if (stats.size < MIN_DOC_SIZE) {
55
+ errors.push(
56
+ `❌ ${app}/${docFile}: Documentation too small (${stats.size} bytes, minimum ${MIN_DOC_SIZE} bytes)`
57
+ );
58
+ valid = false;
59
+ continue;
60
+ }
61
+
62
+ // Check for meaningful content (not just whitespace)
63
+ const content = fs.readFileSync(docPath, 'utf-8').trim();
64
+ if (content.length < MIN_DOC_SIZE / 2) {
65
+ errors.push(
66
+ `❌ ${app}/${docFile}: Documentation appears to be mostly whitespace (${content.length} chars after trim)`
67
+ );
68
+ valid = false;
69
+ continue;
70
+ }
71
+
72
+ console.log(`✅ ${app}/${docFile}: Valid (${stats.size} bytes)`);
73
+ }
74
+ }
75
+
76
+ return { valid, errors };
77
+ }
78
+
79
+ function main() {
80
+ console.log('📚 Checking child project documentation...\n');
81
+
82
+ const projectRoot = process.argv[2] || '.';
83
+ const { valid, errors } = checkDocumentation(projectRoot);
84
+
85
+ if (!valid) {
86
+ console.log('\n❌ Documentation validation failed:');
87
+ errors.forEach(err => console.log(` ${err}`));
88
+ console.log('\n💡 Each child project in apps/* must have:');
89
+ console.log(' - README.md (project overview & setup)');
90
+ console.log(' - REQUIREMENTS.md (functional & technical requirements)');
91
+ console.log(' - WORKFLOW.md (user flows, business processes, API interactions)');
92
+ console.log(`\n Minimum size: ${MIN_DOC_SIZE} bytes per file`);
93
+ process.exit(1);
94
+ } else {
95
+ console.log('\n✅ All child project documentation validated successfully');
96
+ }
97
+ }
98
+
99
+ main();