front-end-dev-standards 1.0.0 → 1.1.0

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": "front-end-dev-standards",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Company-wide Angular coding standards for Cursor AI and GitHub Copilot",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -9,6 +9,7 @@ import path from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
10
 
11
11
  const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
12
+ const STANDARDS_DIR = path.join(PACKAGE_ROOT, 'standards');
12
13
 
13
14
  const REQUIRED_PATHS = [
14
15
  'package.json',
@@ -17,14 +18,18 @@ const REQUIRED_PATHS = [
17
18
  'config/default.json',
18
19
  'templates/company.mdc.template',
19
20
  'templates/copilot-instructions.md.template',
20
- 'standards/angular.md',
21
- 'standards/architecture.md',
22
- 'standards/coding-style.md',
23
- 'standards/testing.md',
24
21
  ];
25
22
 
26
23
  const missing = REQUIRED_PATHS.filter((rel) => !fs.existsSync(path.join(PACKAGE_ROOT, rel)));
27
24
 
25
+ const standardsFiles = fs.existsSync(STANDARDS_DIR)
26
+ ? fs.readdirSync(STANDARDS_DIR).filter((file) => file.endsWith('.md') && fs.statSync(path.join(STANDARDS_DIR, file)).isFile())
27
+ : [];
28
+
29
+ if (standardsFiles.length === 0) {
30
+ missing.push('standards/*.md (at least one standards file required)');
31
+ }
32
+
28
33
  if (missing.length > 0) {
29
34
  console.error('[dev-standards] Publish validation failed. Missing files:');
30
35
  missing.forEach((file) => console.error(` - ${file}`));
@@ -38,4 +43,4 @@ if (pkg.private === true) {
38
43
  process.exit(1);
39
44
  }
40
45
 
41
- console.log(`[dev-standards] Publish validation passed (v${pkg.version}).`);
46
+ console.log(`[dev-standards] Publish validation passed (v${pkg.version}, ${standardsFiles.length} standards files).`);
@@ -0,0 +1,138 @@
1
+ # Performance Standards
2
+
3
+ Version: 1.0
4
+ Framework: Angular 20+
5
+ Goal: Fast, Efficient, Scalable Frontend
6
+
7
+ ---
8
+
9
+ # 1. Performance Principles
10
+
11
+ 1. Load Only What Is Needed
12
+ 2. Lazy Load Everything Possible
13
+ 3. Minimize Change Detection
14
+ 4. Reduce Bundle Size
15
+ 5. Optimize API Calls
16
+ 6. Avoid Redundant Rendering
17
+
18
+ ---
19
+
20
+ # 2. Bundle Size Limits
21
+
22
+ | Type | Limit |
23
+ | -------------- | ------- |
24
+ | Initial Bundle | < 500KB |
25
+ | Feature Bundle | < 250KB |
26
+ | Chunk Size | < 150KB |
27
+
28
+ ---
29
+
30
+ # 3. Lazy Loading Standards
31
+
32
+ All features must be lazy loaded:
33
+
34
+ ```typescript
35
+ loadComponent: () =>
36
+ import('./page').then(m => m.Page)
37
+ ```
38
+
39
+ ---
40
+
41
+ # 4. Change Detection
42
+
43
+ Mandatory:
44
+
45
+ ✓ OnPush everywhere
46
+ ✓ Signals for state
47
+
48
+ Avoid default detection.
49
+
50
+ ---
51
+
52
+ # 5. Rendering Optimization
53
+
54
+ Use:
55
+
56
+ ✓ track in @for
57
+ ✓ virtual scrolling
58
+ ✓ memoized computed signals
59
+
60
+ ---
61
+
62
+ # 6. Image Optimization
63
+
64
+ Use:
65
+
66
+ ✓ NgOptimizedImage
67
+ ✓ Lazy loading images
68
+
69
+ ---
70
+
71
+ # 7. API Optimization
72
+
73
+ Rules:
74
+
75
+ * Batch requests when possible
76
+ * Avoid duplicate calls
77
+ * Cache static data
78
+
79
+ ---
80
+
81
+ # 8. Memory Management
82
+
83
+ Avoid:
84
+
85
+ ❌ Memory leaks
86
+ ❌ Unsubscribed observables
87
+
88
+ Use:
89
+
90
+ ✓ Async pipe
91
+ ✓ Signals
92
+
93
+ ---
94
+
95
+ # 9. UI Performance Rules
96
+
97
+ Avoid:
98
+
99
+ ❌ Heavy DOM manipulation
100
+ ❌ Large nested components
101
+
102
+ Prefer:
103
+
104
+ ✓ Component splitting
105
+
106
+ ---
107
+
108
+ # 10. Router Performance
109
+
110
+ * Lazy load routes
111
+ * Preload only critical modules
112
+
113
+ ---
114
+
115
+ # 11. Core Web Vitals Targets
116
+
117
+ | Metric | Target |
118
+ | ------ | ------- |
119
+ | LCP | < 2.5s |
120
+ | FID | < 100ms |
121
+ | CLS | < 0.1 |
122
+
123
+ ---
124
+
125
+ # 12. Profiling Standards
126
+
127
+ Use:
128
+
129
+ * Chrome DevTools
130
+ * Angular DevTools
131
+
132
+ ---
133
+
134
+ # 13. Anti Patterns
135
+
136
+ ❌ DOM queries
137
+ ❌ Inline heavy calculations
138
+ ❌ Large single components