@schandlergarcia/sf-web-components 1.9.43 → 1.9.45
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/.a4drules/RULES.md +456 -0
- package/ARCHITECTURE.md +112 -0
- package/CHANGELOG.md +424 -0
- package/CONTRIBUTING.md +247 -0
- package/QUICK-REFERENCE.md +212 -0
- package/README.md +76 -14
- package/package.json +8 -2
- package/scripts/pre-publish-check.sh +180 -0
- package/scripts/reset-command-center.sh +18 -10
- package/scripts/verify-consistency.sh +238 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## Critical History: Component Naming Crisis (v1.9.29 - v1.9.42)
|
|
9
|
+
|
|
10
|
+
### The Problem
|
|
11
|
+
|
|
12
|
+
Between versions 1.9.29 and 1.9.42, a critical inconsistency existed that broke consuming applications:
|
|
13
|
+
|
|
14
|
+
**Root Cause:** Component files were renamed from `UIButton.tsx`/`UIInput.tsx` to `Button.jsx`/`Input.jsx`, but:
|
|
15
|
+
- Templates still imported `UIButton` and `UIInput`
|
|
16
|
+
- Documentation in `.a4drules/skills/component-library/ui-primitives.md` still referenced `UIButton` and `UIInput`
|
|
17
|
+
- The barrel export still referenced the old paths
|
|
18
|
+
|
|
19
|
+
**Impact:** New installations failed with "Cannot resolve import" errors because:
|
|
20
|
+
1. NotFound.tsx.template imported `UIButton` from `@/components/library/ui/UIButton`
|
|
21
|
+
2. Home.tsx.template imported `UIButton` and `UIInput` from the same paths
|
|
22
|
+
3. But the package only contained `Button.jsx` and `Input.jsx`
|
|
23
|
+
|
|
24
|
+
**Why This Happened:** Components were renamed to match shadcn naming convention without understanding that:
|
|
25
|
+
- Shadcn components (`Button`, `Input`) are for the **outer application shell**
|
|
26
|
+
- Library components (`UIButton`, `UIInput`) are for **command centers and dashboards**
|
|
27
|
+
- The `.a4drules/skills/component-library/common-mistakes.md` explicitly documents this distinction
|
|
28
|
+
|
|
29
|
+
### Timeline of Issues
|
|
30
|
+
|
|
31
|
+
#### v1.9.25 - v1.9.28 (✅ Golden Versions - Working)
|
|
32
|
+
- **Status:** Fully functional
|
|
33
|
+
- **Components:** `UIButton.tsx`, `UIInput.tsx` (correct names)
|
|
34
|
+
- **Templates:** Import `UIButton` and `UIInput` (matching)
|
|
35
|
+
- **Documentation:** References `UIButton` and `UIInput` (matching)
|
|
36
|
+
- **Evidence:** `/Users/stephan.garcia/reactapp4/` uses v1.9.25 successfully
|
|
37
|
+
|
|
38
|
+
#### v1.9.29 (❌ Broken - Missing Postinstall)
|
|
39
|
+
- **Issue:** Postinstall script referenced in package.json but not included in published package
|
|
40
|
+
- **Error:** "Cannot find module postinstall.mjs"
|
|
41
|
+
- **Cause:** Missing from package.json `files` array
|
|
42
|
+
|
|
43
|
+
#### v1.9.30 - v1.9.38 (❌ Broken - Missing Source Files)
|
|
44
|
+
- **Issue:** Removed `src/` directories from package.json `files` array
|
|
45
|
+
- **Error:** Postinstall couldn't find source files to copy
|
|
46
|
+
- **Cause:** Attempted to publish only dist/ but postinstall needs src/ for templates and components
|
|
47
|
+
|
|
48
|
+
#### v1.9.39 (❌ Broken - Partial Fix)
|
|
49
|
+
- **Issue:** Restored src/ directories but components had wrong names
|
|
50
|
+
- **Components:** `Button.jsx`, `Input.jsx` (wrong - shadcn names)
|
|
51
|
+
- **Templates:** Still importing `UIButton`, `UIInput`
|
|
52
|
+
- **Result:** Import resolution failures
|
|
53
|
+
|
|
54
|
+
#### v1.9.40 (❌ Broken - Missing Glob Dependency)
|
|
55
|
+
- **Issue:** Postinstall script imports `glob` but it wasn't in dependencies
|
|
56
|
+
- **Error:** "Cannot find package 'glob'"
|
|
57
|
+
- **Added:** `"glob": "^11.0.0"` to dependencies
|
|
58
|
+
|
|
59
|
+
#### v1.9.41 - v1.9.42 (❌ Broken - Component Naming Mismatch)
|
|
60
|
+
- **Issue:** All other fixes applied but component names still wrong
|
|
61
|
+
- **Components:** `Button.jsx`, `Input.jsx` (shadcn naming)
|
|
62
|
+
- **Templates:** Importing `UIButton`, `UIInput` (library naming)
|
|
63
|
+
- **Documentation:** References `UIButton`, `UIInput` (library naming)
|
|
64
|
+
- **Result:** "Failed to resolve import @/components/library/ui/UIButton"
|
|
65
|
+
|
|
66
|
+
#### v1.9.43 (✅ Fixed)
|
|
67
|
+
- **Fix:** Restored `UIButton.tsx` and `UIInput.tsx` from golden version
|
|
68
|
+
- **Removed:** Incorrect `Button.jsx` and `Input.jsx` files
|
|
69
|
+
- **Updated:** Barrel export paths to match new file names
|
|
70
|
+
- **Updated:** Internal imports in `ActionList.jsx` and `TableCard.jsx`
|
|
71
|
+
- **Verified:** Templates, components, and documentation all aligned
|
|
72
|
+
- **Result:** Consuming applications install and run successfully
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## [1.9.45] - 2026-04-01
|
|
77
|
+
|
|
78
|
+
### Fixed
|
|
79
|
+
- **scripts/reset-command-center.sh** - Fixed directory structure mismatch
|
|
80
|
+
- Issue: Script tried to create files in `src/components/pages/` (old structure)
|
|
81
|
+
- Cause: Script wasn't updated when postinstall migrated dashboards to `src/pages/`
|
|
82
|
+
- Fix: Updated all paths to use correct structure:
|
|
83
|
+
- `src/components/pages/` → `src/pages/` (for dashboards)
|
|
84
|
+
- `src/components/pages/CommandCenter.tsx` → `src/components/workspace/CommandCenter.tsx`
|
|
85
|
+
- Changed BlankDashboard from `.jsx` to `.tsx` (TypeScript)
|
|
86
|
+
- Added `mkdir -p` to ensure directories exist before writing
|
|
87
|
+
- Updated import paths: `../components/pages/CommandCenter` → `../components/workspace/CommandCenter`
|
|
88
|
+
- Updated import paths: `./BlankDashboard` → `../../pages/BlankDashboard`
|
|
89
|
+
- Error was: "No such file or directory" when trying to create BlankDashboard.jsx
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
- **BlankDashboard** file format from `.jsx` to `.tsx` for consistency with other templates
|
|
93
|
+
|
|
94
|
+
### Context
|
|
95
|
+
The postinstall script (lines 318-356) migrates dashboards from the old location (`src/components/pages/`) to the new location (`src/pages/`) introduced in earlier versions. The reset script wasn't updated to match this change, causing it to try creating files in directories that don't exist in new installations.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## [1.9.44] - 2026-04-01
|
|
100
|
+
|
|
101
|
+
### Added
|
|
102
|
+
- **ARCHITECTURE.md** - Comprehensive documentation of source of truth hierarchy
|
|
103
|
+
- Documents that `.a4drules/skills/component-library/` is authoritative
|
|
104
|
+
- Explains component naming convention (UI prefix for library, plain names for outer app)
|
|
105
|
+
- File structure master reference with clear responsibilities
|
|
106
|
+
|
|
107
|
+
- **CONTRIBUTING.md** - Detailed contribution guidelines
|
|
108
|
+
- Change process with correct order (docs → code → templates → exports)
|
|
109
|
+
- Component naming rules with examples
|
|
110
|
+
- Template import rules
|
|
111
|
+
- Pre-release checklist (9 required steps)
|
|
112
|
+
- Common mistakes and how to avoid them
|
|
113
|
+
- Recovery procedures for bad releases
|
|
114
|
+
|
|
115
|
+
- **CHANGELOG.md** - This file with complete version history
|
|
116
|
+
- Detailed timeline of v1.9.29-v1.9.42 naming crisis
|
|
117
|
+
- Root cause analysis of why templates broke
|
|
118
|
+
- Version-by-version breakdown of issues
|
|
119
|
+
- Documentation standards for future changelog entries
|
|
120
|
+
|
|
121
|
+
- **QUICK-REFERENCE.md** - One-page quick reference card
|
|
122
|
+
- Pre-publish checklist
|
|
123
|
+
- Component naming table
|
|
124
|
+
- Source of truth hierarchy
|
|
125
|
+
- Common errors and fixes
|
|
126
|
+
- Emergency recovery procedures
|
|
127
|
+
|
|
128
|
+
- **.a4drules/RULES.md** - Mandatory project rules
|
|
129
|
+
- 10 enforced rules for all contributors and AI assistants
|
|
130
|
+
- Rule 1: Documentation is source of truth
|
|
131
|
+
- Rule 2: CHANGELOG.md is mandatory
|
|
132
|
+
- Rule 3-10: Component naming, templates, testing, versioning
|
|
133
|
+
- Pre-commit verification hooks
|
|
134
|
+
|
|
135
|
+
- **scripts/verify-consistency.sh** - Automated consistency verification
|
|
136
|
+
- Checks component files exist (UIButton.tsx, UIInput.tsx)
|
|
137
|
+
- Verifies barrel export paths
|
|
138
|
+
- Validates template imports
|
|
139
|
+
- Checks internal library imports
|
|
140
|
+
- Verifies documentation references
|
|
141
|
+
- Validates package.json files array
|
|
142
|
+
- Exit code 0 if all checks pass, 1 if any fail
|
|
143
|
+
|
|
144
|
+
- **scripts/pre-publish-check.sh** - Pre-publish verification script
|
|
145
|
+
- Runs all consistency checks
|
|
146
|
+
- Verifies CHANGELOG has entry for current version
|
|
147
|
+
- Checks component naming conventions
|
|
148
|
+
- Runs build to verify no errors
|
|
149
|
+
- Validates documentation files exist
|
|
150
|
+
- Checks package.json files array
|
|
151
|
+
- Blocks publish if any check fails
|
|
152
|
+
|
|
153
|
+
### Changed
|
|
154
|
+
- **package.json scripts** - Added verification scripts
|
|
155
|
+
- Added `verify`: Run consistency checks
|
|
156
|
+
- Added `prepublish:check`: Run all pre-publish checks
|
|
157
|
+
- Updated `prepublishOnly`: Now runs verification before build
|
|
158
|
+
- Publishing now automatically blocked if verification fails
|
|
159
|
+
|
|
160
|
+
- **package.json files array** - Added documentation files
|
|
161
|
+
- Added CHANGELOG.md
|
|
162
|
+
- Added CONTRIBUTING.md
|
|
163
|
+
- Added ARCHITECTURE.md
|
|
164
|
+
- Added QUICK-REFERENCE.md
|
|
165
|
+
- These files now ship with the package
|
|
166
|
+
|
|
167
|
+
- **README.md** - Updated with contribution and publishing sections
|
|
168
|
+
- Added Contributing section with links to all docs
|
|
169
|
+
- Updated Publishing section to document automated verification
|
|
170
|
+
- Changed import examples to use UIButton (not Button)
|
|
171
|
+
- Added verification command examples
|
|
172
|
+
|
|
173
|
+
### Documentation
|
|
174
|
+
- Created comprehensive documentation system to prevent future naming issues
|
|
175
|
+
- All rules, processes, and guidelines now documented in multiple formats:
|
|
176
|
+
- Detailed guides (CONTRIBUTING.md, ARCHITECTURE.md)
|
|
177
|
+
- Quick reference (QUICK-REFERENCE.md)
|
|
178
|
+
- Mandatory rules (.a4drules/RULES.md)
|
|
179
|
+
- Version history (CHANGELOG.md)
|
|
180
|
+
- Added guide for consuming projects (internal-app-standard-config/.a4drules/sf-web-components-guide.md)
|
|
181
|
+
|
|
182
|
+
### Infrastructure
|
|
183
|
+
- Automated pre-publish verification prevents broken releases
|
|
184
|
+
- Scripts enforce consistency between docs, code, and templates
|
|
185
|
+
- Cannot publish without CHANGELOG entry
|
|
186
|
+
- Cannot publish with naming mismatches
|
|
187
|
+
- Cannot publish if build fails
|
|
188
|
+
|
|
189
|
+
### Purpose
|
|
190
|
+
This release adds comprehensive documentation and automation to ensure the component naming crisis of v1.9.29-v1.9.42 **never happens again**:
|
|
191
|
+
|
|
192
|
+
**The Problem We're Preventing:**
|
|
193
|
+
- Components renamed without updating templates → Import failures
|
|
194
|
+
- Changes made without updating CHANGELOG → Lost history
|
|
195
|
+
- Code changed without checking documentation → Contract violations
|
|
196
|
+
- Published without testing → Broken consuming applications
|
|
197
|
+
|
|
198
|
+
**How We're Preventing It:**
|
|
199
|
+
- Automated verification scripts run on every publish
|
|
200
|
+
- Comprehensive documentation at multiple levels
|
|
201
|
+
- Clear source of truth hierarchy
|
|
202
|
+
- Mandatory CHANGELOG updates
|
|
203
|
+
- Pre-commit hooks (optional but recommended)
|
|
204
|
+
|
|
205
|
+
### Breaking Changes
|
|
206
|
+
None - This is a documentation and tooling release
|
|
207
|
+
|
|
208
|
+
### Migration
|
|
209
|
+
No migration needed. This version adds documentation and verification tools but does not change any component APIs.
|
|
210
|
+
|
|
211
|
+
If you're maintaining or contributing to sf-web-components:
|
|
212
|
+
1. Read CONTRIBUTING.md before making changes
|
|
213
|
+
2. Run `npm run verify` before committing
|
|
214
|
+
3. Update CHANGELOG.md with every change
|
|
215
|
+
4. The `prepublishOnly` hook will enforce these rules
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## [1.9.43] - 2026-04-01
|
|
220
|
+
|
|
221
|
+
### Fixed
|
|
222
|
+
- **CRITICAL:** Restored UIButton.tsx and UIInput.tsx with correct naming convention
|
|
223
|
+
- Component files now match template imports and documentation
|
|
224
|
+
- Fixes "Cannot resolve import @/components/library/ui/UIButton" error
|
|
225
|
+
- Copied from golden version (v1.9.25) at `/Users/stephan.garcia/reactapp4/`
|
|
226
|
+
- Removed incorrect Button.jsx and Input.jsx files (shadcn naming reserved for outer app)
|
|
227
|
+
- Updated barrel export in src/components/library/index.jsx:
|
|
228
|
+
- Changed `from "./ui/Button"` to `from "./ui/UIButton"`
|
|
229
|
+
- Changed `from "./ui/Input"` to `from "./ui/UIInput"`
|
|
230
|
+
- Fixed internal imports in:
|
|
231
|
+
- src/components/library/cards/ActionList.jsx
|
|
232
|
+
- src/components/library/cards/TableCard.jsx
|
|
233
|
+
|
|
234
|
+
### Added
|
|
235
|
+
- ARCHITECTURE.md - Documents source of truth and naming conventions
|
|
236
|
+
- CONTRIBUTING.md - Comprehensive guide to prevent future naming issues
|
|
237
|
+
- scripts/verify-consistency.sh - Automated verification of component/template/doc alignment
|
|
238
|
+
- This CHANGELOG.md - Detailed history and requirements for all future changes
|
|
239
|
+
|
|
240
|
+
### Documentation
|
|
241
|
+
- Confirmed .a4drules/skills/component-library/ui-primitives.md is authoritative source
|
|
242
|
+
- Confirmed .a4drules/skills/component-library/common-mistakes.md prohibits shadcn names in library
|
|
243
|
+
|
|
244
|
+
### Breaking Changes
|
|
245
|
+
None - This version restores functionality that was broken in v1.9.29-v1.9.42
|
|
246
|
+
|
|
247
|
+
### Migration from v1.9.42
|
|
248
|
+
If you're using v1.9.42 (broken version):
|
|
249
|
+
```bash
|
|
250
|
+
# Update to fixed version
|
|
251
|
+
npm install @schandlergarcia/sf-web-components@1.9.43
|
|
252
|
+
|
|
253
|
+
# Re-run postinstall to copy correct components
|
|
254
|
+
rm -rf src/components/library
|
|
255
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## [1.9.42] - 2026-03-31
|
|
261
|
+
|
|
262
|
+
### Known Issues
|
|
263
|
+
- ❌ Button.jsx and Input.jsx exist instead of UIButton.tsx and UIInput.tsx
|
|
264
|
+
- ❌ Templates import UIButton/UIInput but files don't exist
|
|
265
|
+
- ❌ Consuming applications fail to build
|
|
266
|
+
|
|
267
|
+
### Fixed
|
|
268
|
+
- Restored comprehensive postinstall.mjs script
|
|
269
|
+
- Added "data" directory to package.json files array
|
|
270
|
+
- Re-added glob dependency
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## [1.9.40] - 2026-03-31
|
|
275
|
+
|
|
276
|
+
### Added
|
|
277
|
+
- glob dependency to package.json dependencies
|
|
278
|
+
|
|
279
|
+
### Known Issues
|
|
280
|
+
- ❌ Component naming still incorrect (Button.jsx instead of UIButton.tsx)
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## [1.9.29 - 1.9.39] - 2026-03-31
|
|
285
|
+
|
|
286
|
+
### Known Issues
|
|
287
|
+
- Various combinations of missing files, missing dependencies, and incorrect naming
|
|
288
|
+
- All versions in this range are broken for new installations
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## [1.9.28] - 2026-03-31
|
|
293
|
+
|
|
294
|
+
### Status
|
|
295
|
+
✅ Last known working version before naming crisis
|
|
296
|
+
|
|
297
|
+
### Components
|
|
298
|
+
- UIButton.tsx ✅
|
|
299
|
+
- UIInput.tsx ✅
|
|
300
|
+
- All templates import correctly ✅
|
|
301
|
+
- Documentation matches implementation ✅
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## [1.9.25] - 2026-03-30
|
|
306
|
+
|
|
307
|
+
### Status
|
|
308
|
+
✅ Golden reference version
|
|
309
|
+
|
|
310
|
+
### Components
|
|
311
|
+
- UIButton.tsx ✅
|
|
312
|
+
- UIInput.tsx ✅
|
|
313
|
+
- Complete component library
|
|
314
|
+
- Working postinstall script
|
|
315
|
+
- All templates functional
|
|
316
|
+
|
|
317
|
+
### Evidence
|
|
318
|
+
Used successfully in production project at `/Users/stephan.garcia/reactapp4/`
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Versioning Policy
|
|
323
|
+
|
|
324
|
+
### When to Bump Versions
|
|
325
|
+
|
|
326
|
+
#### Patch (1.9.x)
|
|
327
|
+
- Bug fixes
|
|
328
|
+
- Documentation updates
|
|
329
|
+
- Internal refactoring that doesn't affect API
|
|
330
|
+
|
|
331
|
+
#### Minor (1.x.0)
|
|
332
|
+
- New components added
|
|
333
|
+
- New features added
|
|
334
|
+
- Backward-compatible API changes
|
|
335
|
+
|
|
336
|
+
#### Major (x.0.0)
|
|
337
|
+
- Breaking changes to component APIs
|
|
338
|
+
- Component renames that affect imports
|
|
339
|
+
- Removal of deprecated components
|
|
340
|
+
|
|
341
|
+
### Pre-Release Checklist
|
|
342
|
+
|
|
343
|
+
**REQUIRED before every publish:**
|
|
344
|
+
|
|
345
|
+
1. [ ] Run `bash scripts/verify-consistency.sh` (must pass)
|
|
346
|
+
2. [ ] Run `npm run build` (must succeed)
|
|
347
|
+
3. [ ] Update CHANGELOG.md with changes
|
|
348
|
+
4. [ ] Test postinstall in a fresh directory
|
|
349
|
+
5. [ ] Verify component names match .a4drules documentation
|
|
350
|
+
6. [ ] Verify templates import components correctly
|
|
351
|
+
7. [ ] Check package.json files array includes all necessary directories
|
|
352
|
+
|
|
353
|
+
**Never skip these steps.**
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Documentation Standards
|
|
358
|
+
|
|
359
|
+
### Changelog Requirements
|
|
360
|
+
|
|
361
|
+
Every version entry MUST include:
|
|
362
|
+
|
|
363
|
+
1. **Version number and date**
|
|
364
|
+
```markdown
|
|
365
|
+
## [1.9.43] - 2026-04-01
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
2. **Category sections** (as applicable):
|
|
369
|
+
- Added - New features
|
|
370
|
+
- Changed - Changes to existing functionality
|
|
371
|
+
- Deprecated - Soon-to-be removed features
|
|
372
|
+
- Removed - Removed features
|
|
373
|
+
- Fixed - Bug fixes
|
|
374
|
+
- Security - Security fixes
|
|
375
|
+
|
|
376
|
+
3. **Component changes** (if any):
|
|
377
|
+
- List every component file added, removed, or renamed
|
|
378
|
+
- Explain why the change was made
|
|
379
|
+
- Document impact on templates and consuming projects
|
|
380
|
+
|
|
381
|
+
4. **Breaking changes** (if any):
|
|
382
|
+
- Clearly marked with ⚠️ or "BREAKING"
|
|
383
|
+
- Migration instructions
|
|
384
|
+
- Affected versions
|
|
385
|
+
|
|
386
|
+
5. **Known issues** (if any):
|
|
387
|
+
- Marked with ❌
|
|
388
|
+
- Description of the issue
|
|
389
|
+
- Workaround if available
|
|
390
|
+
|
|
391
|
+
### Example Good Changelog Entry
|
|
392
|
+
|
|
393
|
+
```markdown
|
|
394
|
+
## [1.9.43] - 2026-04-01
|
|
395
|
+
|
|
396
|
+
### Fixed
|
|
397
|
+
- **CRITICAL:** Restored UIButton.tsx and UIInput.tsx
|
|
398
|
+
- Fixes "Cannot resolve import" errors in templates
|
|
399
|
+
- Matches documented API in .a4drules/skills/component-library/
|
|
400
|
+
- Removed incorrect Button.jsx and Input.jsx files
|
|
401
|
+
|
|
402
|
+
### Added
|
|
403
|
+
- CONTRIBUTING.md - Contribution guidelines
|
|
404
|
+
- scripts/verify-consistency.sh - Pre-publish validation
|
|
405
|
+
|
|
406
|
+
### Migration
|
|
407
|
+
Update package version and re-run postinstall:
|
|
408
|
+
\`\`\`bash
|
|
409
|
+
npm install @schandlergarcia/sf-web-components@1.9.43
|
|
410
|
+
node node_modules/@schandlergarcia/sf-web-components/scripts/postinstall.mjs
|
|
411
|
+
\`\`\`
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Questions?
|
|
417
|
+
|
|
418
|
+
If you're unsure about:
|
|
419
|
+
- **Naming:** Check `.a4drules/skills/component-library/ui-primitives.md`
|
|
420
|
+
- **Changes:** Review this CHANGELOG for patterns
|
|
421
|
+
- **Testing:** Run `scripts/verify-consistency.sh`
|
|
422
|
+
- **Publishing:** Follow CONTRIBUTING.md checklist
|
|
423
|
+
|
|
424
|
+
**When in doubt, check against golden version 1.9.25-1.9.28.**
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Contributing to sf-web-components
|
|
2
|
+
|
|
3
|
+
## Critical Rules
|
|
4
|
+
|
|
5
|
+
### 1. Documentation is the Source of Truth
|
|
6
|
+
|
|
7
|
+
**Before making ANY changes to component names, check `.a4drules/skills/component-library/` first.**
|
|
8
|
+
|
|
9
|
+
The documentation in `.a4drules/skills/component-library/` defines the contract. Code must match documentation, not the other way around.
|
|
10
|
+
|
|
11
|
+
#### Change Process (ALWAYS follow this order):
|
|
12
|
+
|
|
13
|
+
1. **Update `.a4drules/skills/component-library/` documentation FIRST**
|
|
14
|
+
2. Update the component implementation in `src/components/library/`
|
|
15
|
+
3. Update templates in `src/templates/` to use the new names
|
|
16
|
+
4. Update barrel export in `src/components/library/index.jsx`
|
|
17
|
+
5. Update any internal imports in `src/components/library/`
|
|
18
|
+
6. Run `npm run build` to verify
|
|
19
|
+
7. Test the postinstall script
|
|
20
|
+
8. Publish new version
|
|
21
|
+
|
|
22
|
+
**Never skip step 1.** If you change code without updating docs first, you break the contract.
|
|
23
|
+
|
|
24
|
+
### 2. Component Naming Rules
|
|
25
|
+
|
|
26
|
+
#### Library Components Must Use UI Prefix
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
// ✅ CORRECT
|
|
30
|
+
src/components/library/ui/UIButton.tsx
|
|
31
|
+
src/components/library/ui/UIInput.tsx
|
|
32
|
+
|
|
33
|
+
// ❌ WRONG - These names are reserved for outer app shadcn components
|
|
34
|
+
src/components/library/ui/Button.tsx
|
|
35
|
+
src/components/library/ui/Input.tsx
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
From `.a4drules/skills/component-library/common-mistakes.md`:
|
|
39
|
+
|
|
40
|
+
> "shadcn components (`Button`, `Card`, `Input`, `Select`, `Alert`, `Skeleton`, etc.) exist for the outer app only. In command center pages, use the equivalent library component (`UIButton`, `BaseCard`/`WidgetCard`, `UIInput`, `Select`, `Alert`, `Skeleton`, etc. from `@/components/library`)"
|
|
41
|
+
|
|
42
|
+
#### File Extensions Matter
|
|
43
|
+
|
|
44
|
+
- Use `.tsx` for TypeScript files with JSX
|
|
45
|
+
- Use `.jsx` only for pure JavaScript files with JSX
|
|
46
|
+
- Prefer TypeScript (`.tsx`) for all new components
|
|
47
|
+
|
|
48
|
+
### 3. Template Import Rules
|
|
49
|
+
|
|
50
|
+
Templates in `src/templates/` MUST import components using the exact names from `.a4drules/skills/component-library/`:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
// ✅ CORRECT - Matches ui-primitives.md documentation
|
|
54
|
+
import UIButton from '@/components/library/ui/UIButton';
|
|
55
|
+
import UIInput from '@/components/library/ui/UIInput';
|
|
56
|
+
|
|
57
|
+
// ❌ WRONG - Does not match documentation
|
|
58
|
+
import Button from '@/components/library/ui/Button';
|
|
59
|
+
import Input from '@/components/library/ui/Input';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. Barrel Export Consistency
|
|
63
|
+
|
|
64
|
+
The barrel export at `src/components/library/index.jsx` MUST match both:
|
|
65
|
+
1. The actual file names in `src/components/library/ui/`
|
|
66
|
+
2. The component names in `.a4drules/skills/component-library/ui-primitives.md`
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
// ✅ CORRECT
|
|
70
|
+
export { default as UIButton } from "./ui/UIButton";
|
|
71
|
+
export { default as UIInput } from "./ui/UIInput";
|
|
72
|
+
|
|
73
|
+
// ❌ WRONG
|
|
74
|
+
export { default as UIButton } from "./ui/Button"; // File doesn't exist
|
|
75
|
+
export { default as UIInput } from "./ui/Input"; // File doesn't exist
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Pre-Release Checklist
|
|
79
|
+
|
|
80
|
+
Before publishing any version, verify:
|
|
81
|
+
|
|
82
|
+
### 1. Documentation Check
|
|
83
|
+
- [ ] All component names in code match `.a4drules/skills/component-library/` docs
|
|
84
|
+
- [ ] No new components added without documentation
|
|
85
|
+
- [ ] `common-mistakes.md` updated if new patterns emerge
|
|
86
|
+
|
|
87
|
+
### 2. Component Check
|
|
88
|
+
```bash
|
|
89
|
+
# UIButton and UIInput MUST exist as .tsx files
|
|
90
|
+
ls src/components/library/ui/UIButton.tsx
|
|
91
|
+
ls src/components/library/ui/UIInput.tsx
|
|
92
|
+
|
|
93
|
+
# Button.jsx and Input.jsx should NOT exist in library/ui/
|
|
94
|
+
# (They can exist in heroui/ but not in ui/)
|
|
95
|
+
! ls src/components/library/ui/Button.jsx 2>/dev/null
|
|
96
|
+
! ls src/components/library/ui/Input.jsx 2>/dev/null
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Template Check
|
|
100
|
+
```bash
|
|
101
|
+
# All templates must import UIButton (not Button)
|
|
102
|
+
grep -r "from '@/components/library/ui/UIButton'" src/templates/
|
|
103
|
+
|
|
104
|
+
# No template should import Button from ui/
|
|
105
|
+
! grep -r "from '@/components/library/ui/Button'" src/templates/
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 4. Build Check
|
|
109
|
+
```bash
|
|
110
|
+
npm run build
|
|
111
|
+
# Must succeed with no errors
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 5. Postinstall Check
|
|
115
|
+
```bash
|
|
116
|
+
# Create test directory
|
|
117
|
+
mkdir -p /tmp/test-sf-components && cd /tmp/test-sf-components
|
|
118
|
+
|
|
119
|
+
# Initialize minimal package.json
|
|
120
|
+
cat > package.json << 'EOF'
|
|
121
|
+
{
|
|
122
|
+
"name": "test-project",
|
|
123
|
+
"version": "1.0.0",
|
|
124
|
+
"type": "module"
|
|
125
|
+
}
|
|
126
|
+
EOF
|
|
127
|
+
|
|
128
|
+
# Create minimal structure
|
|
129
|
+
mkdir -p src/pages src/components/library/ui
|
|
130
|
+
|
|
131
|
+
# Install package (will run postinstall)
|
|
132
|
+
npm install @schandlergarcia/sf-web-components@latest
|
|
133
|
+
|
|
134
|
+
# Verify UIButton was copied
|
|
135
|
+
ls src/components/library/ui/UIButton.tsx
|
|
136
|
+
ls src/components/library/ui/UIInput.tsx
|
|
137
|
+
|
|
138
|
+
# Verify templates were installed
|
|
139
|
+
ls src/pages/NotFound.tsx
|
|
140
|
+
|
|
141
|
+
# Verify NotFound imports UIButton
|
|
142
|
+
grep "UIButton" src/pages/NotFound.tsx
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 6. Version and Publish
|
|
146
|
+
```bash
|
|
147
|
+
# Bump version
|
|
148
|
+
npm version patch # or minor, or major
|
|
149
|
+
|
|
150
|
+
# Publish
|
|
151
|
+
npm publish
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Common Mistakes to Avoid
|
|
155
|
+
|
|
156
|
+
### Mistake #1: Renaming Components Without Updating Docs
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# ❌ WRONG - Changed code but not docs
|
|
160
|
+
mv src/components/library/ui/UIButton.tsx src/components/library/ui/Button.tsx
|
|
161
|
+
# Now templates fail because they import UIButton
|
|
162
|
+
|
|
163
|
+
# ✅ CORRECT - Update docs first
|
|
164
|
+
# 1. Edit .a4drules/skills/component-library/ui-primitives.md
|
|
165
|
+
# Change "UIButton" to "Button"
|
|
166
|
+
# 2. Update templates to import Button
|
|
167
|
+
# 3. Then rename the file
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Mistake #2: Using shadcn Names in Library
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# ❌ WRONG - Using shadcn naming convention
|
|
174
|
+
src/components/library/ui/Button.jsx
|
|
175
|
+
src/components/library/ui/Input.jsx
|
|
176
|
+
|
|
177
|
+
# ✅ CORRECT - Using library naming convention
|
|
178
|
+
src/components/library/ui/UIButton.tsx
|
|
179
|
+
src/components/library/ui/UIInput.tsx
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Mistake #3: Inconsistent File Extensions
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# ❌ WRONG - Mixing .jsx and .tsx inconsistently
|
|
186
|
+
src/components/library/ui/UIButton.jsx # JavaScript
|
|
187
|
+
src/components/library/ui/UIInput.tsx # TypeScript
|
|
188
|
+
|
|
189
|
+
# ✅ CORRECT - Consistent TypeScript
|
|
190
|
+
src/components/library/ui/UIButton.tsx
|
|
191
|
+
src/components/library/ui/UIInput.tsx
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Mistake #4: Forgetting to Update Barrel Export
|
|
195
|
+
|
|
196
|
+
```jsx
|
|
197
|
+
// ❌ WRONG - File renamed but export not updated
|
|
198
|
+
// File: src/components/library/ui/UIButton.tsx
|
|
199
|
+
// But index.jsx still has:
|
|
200
|
+
export { default as UIButton } from "./ui/Button"; // ❌ Wrong path
|
|
201
|
+
|
|
202
|
+
// ✅ CORRECT
|
|
203
|
+
export { default as UIButton } from "./ui/UIButton"; // ✅ Matches file
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Mistake #5: Not Testing Postinstall
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# ❌ WRONG - Publishing without testing postinstall
|
|
210
|
+
npm publish
|
|
211
|
+
|
|
212
|
+
# ✅ CORRECT - Test postinstall first
|
|
213
|
+
npm pack
|
|
214
|
+
cd /tmp/test-package
|
|
215
|
+
npm install /path/to/sf-web-components-1.9.43.tgz
|
|
216
|
+
# Verify files copied correctly
|
|
217
|
+
ls src/components/library/ui/UIButton.tsx
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Recovery from Bad Release
|
|
221
|
+
|
|
222
|
+
If a broken version was published:
|
|
223
|
+
|
|
224
|
+
1. **Do NOT use `npm unpublish`** (breaks downstream projects)
|
|
225
|
+
2. Fix the issue following the correct process above
|
|
226
|
+
3. Publish a new patch version immediately
|
|
227
|
+
4. Document the issue in CHANGELOG.md
|
|
228
|
+
|
|
229
|
+
## Golden Reference Version
|
|
230
|
+
|
|
231
|
+
**Version 1.9.25-1.9.28** is the golden reference that works correctly.
|
|
232
|
+
|
|
233
|
+
If you need to verify correct structure:
|
|
234
|
+
```bash
|
|
235
|
+
npm view @schandlergarcia/sf-web-components@1.9.28 --json
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Working consuming project example: `/Users/stephan.garcia/reactapp4/` uses v1.9.25 successfully.
|
|
239
|
+
|
|
240
|
+
## Questions?
|
|
241
|
+
|
|
242
|
+
If you're unsure about naming or structure:
|
|
243
|
+
|
|
244
|
+
1. Check `.a4drules/skills/component-library/` documentation FIRST
|
|
245
|
+
2. Check golden version 1.9.25-1.9.28
|
|
246
|
+
3. Check working example in `/Users/stephan.garcia/reactapp4/`
|
|
247
|
+
4. Ask before making changes
|