@schandlergarcia/sf-web-components 1.9.43 → 1.9.44
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 +401 -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/verify-consistency.sh +238 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Quick Reference Card
|
|
2
|
+
|
|
3
|
+
## Before Publishing - Checklist
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 1. Update CHANGELOG.md
|
|
7
|
+
vim CHANGELOG.md
|
|
8
|
+
|
|
9
|
+
# 2. Run verification
|
|
10
|
+
npm run verify
|
|
11
|
+
|
|
12
|
+
# 3. Run pre-publish checks
|
|
13
|
+
npm run prepublish:check
|
|
14
|
+
|
|
15
|
+
# 4. Bump version
|
|
16
|
+
npm version patch
|
|
17
|
+
|
|
18
|
+
# 5. Publish (verification runs automatically)
|
|
19
|
+
npm publish
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Component Naming
|
|
23
|
+
|
|
24
|
+
| ✅ CORRECT | ❌ WRONG | Reason |
|
|
25
|
+
|-----------|---------|--------|
|
|
26
|
+
| `UIButton.tsx` | `Button.tsx` | Library uses UI prefix |
|
|
27
|
+
| `UIInput.tsx` | `Input.tsx` | Library uses UI prefix |
|
|
28
|
+
| `UIButton.tsx` | `Button.jsx` | Use TypeScript .tsx |
|
|
29
|
+
| Import from `UIButton` | Import from `Button` | Must match file name |
|
|
30
|
+
|
|
31
|
+
## Source of Truth Hierarchy
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
1. .a4drules/skills/component-library/ ← DOCUMENTATION (source of truth)
|
|
35
|
+
2. src/components/library/ ← CODE (must match docs)
|
|
36
|
+
3. src/templates/ ← TEMPLATES (must match docs)
|
|
37
|
+
4. CHANGELOG.md ← HISTORY (must document all changes)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## File Structure
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
src/components/library/ui/
|
|
44
|
+
✅ UIButton.tsx (Library component)
|
|
45
|
+
✅ UIInput.tsx (Library component)
|
|
46
|
+
❌ Button.tsx (Reserved for outer app)
|
|
47
|
+
❌ Input.tsx (Reserved for outer app)
|
|
48
|
+
|
|
49
|
+
src/templates/pages/
|
|
50
|
+
✅ Home.tsx.template (Imports UIButton, UIInput)
|
|
51
|
+
✅ NotFound.tsx.template (Imports UIButton)
|
|
52
|
+
|
|
53
|
+
.a4drules/skills/component-library/
|
|
54
|
+
📚 ui-primitives.md (Documents UIButton, UIInput)
|
|
55
|
+
📚 common-mistakes.md (Lists UIButton vs Button rule)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Import Patterns
|
|
59
|
+
|
|
60
|
+
### ✅ Correct
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
// Template imports
|
|
64
|
+
import UIButton from '@/components/library/ui/UIButton';
|
|
65
|
+
import UIInput from '@/components/library/ui/UIInput';
|
|
66
|
+
|
|
67
|
+
// Barrel export
|
|
68
|
+
export { default as UIButton } from "./ui/UIButton";
|
|
69
|
+
export { default as UIInput } from "./ui/UIInput";
|
|
70
|
+
|
|
71
|
+
// Consuming app imports
|
|
72
|
+
import { UIButton, UIInput, MetricCard } from '@/components/library';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### ❌ Wrong
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
// ❌ Don't import from non-existent files
|
|
79
|
+
import Button from '@/components/library/ui/Button';
|
|
80
|
+
import Input from '@/components/library/ui/Input';
|
|
81
|
+
|
|
82
|
+
// ❌ Don't use wrong paths in barrel export
|
|
83
|
+
export { default as UIButton } from "./ui/Button"; // File doesn't exist
|
|
84
|
+
|
|
85
|
+
// ❌ Don't use shadcn names in library
|
|
86
|
+
import { Button } from '@/components/library';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Verification Commands
|
|
90
|
+
|
|
91
|
+
| Command | Purpose | When to Run |
|
|
92
|
+
|---------|---------|-------------|
|
|
93
|
+
| `npm run verify` | Check consistency | Before committing |
|
|
94
|
+
| `npm run prepublish:check` | Full pre-publish checks | Before publishing |
|
|
95
|
+
| `npm run build` | Build dist/ | After changes |
|
|
96
|
+
| `bash scripts/verify-consistency.sh` | Detailed consistency check | Manual verification |
|
|
97
|
+
|
|
98
|
+
## Common Errors and Fixes
|
|
99
|
+
|
|
100
|
+
### Error: "Cannot resolve import '@/components/library/ui/UIButton'"
|
|
101
|
+
|
|
102
|
+
**Cause:** Component file is named `Button.tsx` but imports expect `UIButton.tsx`
|
|
103
|
+
|
|
104
|
+
**Fix:**
|
|
105
|
+
```bash
|
|
106
|
+
# Rename to correct name
|
|
107
|
+
mv src/components/library/ui/Button.tsx src/components/library/ui/UIButton.tsx
|
|
108
|
+
|
|
109
|
+
# Update barrel export
|
|
110
|
+
# Change: from "./ui/Button"
|
|
111
|
+
# To: from "./ui/UIButton"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Error: "CHANGELOG missing entry for version X.X.X"
|
|
115
|
+
|
|
116
|
+
**Cause:** Version was bumped but CHANGELOG.md not updated
|
|
117
|
+
|
|
118
|
+
**Fix:**
|
|
119
|
+
```bash
|
|
120
|
+
vim CHANGELOG.md
|
|
121
|
+
# Add:
|
|
122
|
+
## [X.X.X] - 2026-04-01
|
|
123
|
+
### Fixed
|
|
124
|
+
- Description of changes
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Error: "Consistency check failed"
|
|
128
|
+
|
|
129
|
+
**Cause:** Mismatch between docs, code, or templates
|
|
130
|
+
|
|
131
|
+
**Fix:**
|
|
132
|
+
```bash
|
|
133
|
+
# Run verification to see details
|
|
134
|
+
npm run verify
|
|
135
|
+
|
|
136
|
+
# Fix reported issues
|
|
137
|
+
# - Check .a4drules/skills/component-library/ui-primitives.md for correct names
|
|
138
|
+
# - Update code to match docs
|
|
139
|
+
# - Update templates to match docs
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Golden Reference
|
|
143
|
+
|
|
144
|
+
**Version 1.9.25-1.9.28** are the golden reference versions.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# View golden version structure
|
|
148
|
+
npm view @schandlergarcia/sf-web-components@1.9.28
|
|
149
|
+
|
|
150
|
+
# Check working example
|
|
151
|
+
ls /Users/stephan.garcia/reactapp4/src/components/library/ui/
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Emergency Recovery
|
|
155
|
+
|
|
156
|
+
If you published a broken version:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# 1. Don't unpublish (breaks downstream)
|
|
160
|
+
# 2. Fix the issue immediately
|
|
161
|
+
# 3. Publish patch version
|
|
162
|
+
|
|
163
|
+
# Example:
|
|
164
|
+
# v1.9.42 published with Button.jsx (wrong)
|
|
165
|
+
|
|
166
|
+
# Fix:
|
|
167
|
+
cd sf-web-components
|
|
168
|
+
git checkout v1.9.28 -- src/components/library/ui/UIButton.tsx
|
|
169
|
+
git checkout v1.9.28 -- src/components/library/ui/UIInput.tsx
|
|
170
|
+
rm src/components/library/ui/Button.jsx
|
|
171
|
+
rm src/components/library/ui/Input.jsx
|
|
172
|
+
|
|
173
|
+
# Update exports
|
|
174
|
+
vim src/components/library/index.jsx
|
|
175
|
+
# Change: from "./ui/Button" → from "./ui/UIButton"
|
|
176
|
+
# Change: from "./ui/Input" → from "./ui/UIInput"
|
|
177
|
+
|
|
178
|
+
# Update changelog
|
|
179
|
+
vim CHANGELOG.md
|
|
180
|
+
# Document the fix
|
|
181
|
+
|
|
182
|
+
# Publish fix
|
|
183
|
+
npm version patch
|
|
184
|
+
npm publish
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Key Documents
|
|
188
|
+
|
|
189
|
+
| Document | Purpose | Read When |
|
|
190
|
+
|----------|---------|-----------|
|
|
191
|
+
| [ARCHITECTURE.md](./ARCHITECTURE.md) | System structure | Starting new work |
|
|
192
|
+
| [CONTRIBUTING.md](./CONTRIBUTING.md) | Contribution guide | Before first commit |
|
|
193
|
+
| [CHANGELOG.md](./CHANGELOG.md) | Version history | Before each release |
|
|
194
|
+
| [.a4drules/RULES.md](./.a4drules/RULES.md) | Mandatory rules | Always follow |
|
|
195
|
+
| [.a4drules/skills/component-library/](./a4drules/skills/component-library/) | Component API docs | When using components |
|
|
196
|
+
|
|
197
|
+
## Questions?
|
|
198
|
+
|
|
199
|
+
1. ❓ "What should I name this component?" → Check `.a4drules/skills/component-library/ui-primitives.md`
|
|
200
|
+
2. ❓ "Can I rename this component?" → NO, unless you update docs first (see CONTRIBUTING.md)
|
|
201
|
+
3. ❓ "Why UIButton not Button?" → See `.a4drules/skills/component-library/common-mistakes.md`
|
|
202
|
+
4. ❓ "What version works?" → 1.9.25-1.9.28 and 1.9.43+
|
|
203
|
+
5. ❓ "Can I skip verification?" → NO, it will fail at publish time anyway
|
|
204
|
+
|
|
205
|
+
## Remember
|
|
206
|
+
|
|
207
|
+
- **Documentation = Contract** - Code must match docs
|
|
208
|
+
- **CHANGELOG = Required** - Update with every change
|
|
209
|
+
- **UI Prefix = Library** - UIButton, UIInput (not Button, Input)
|
|
210
|
+
- **Templates = Must Match** - Imports must match file names
|
|
211
|
+
- **Verify = Always** - Run before committing and publishing
|
|
212
|
+
- **Golden = Reference** - v1.9.25-1.9.28 when in doubt
|
package/README.md
CHANGED
|
@@ -20,18 +20,25 @@ This package requires:
|
|
|
20
20
|
### Import Components
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
|
-
|
|
24
|
-
import {
|
|
23
|
+
// Library components (for command centers/dashboards)
|
|
24
|
+
import { UIButton, MetricCard } from '@/components/library';
|
|
25
|
+
import { cn } from '@/lib/utils';
|
|
25
26
|
|
|
26
|
-
function
|
|
27
|
+
function Dashboard() {
|
|
27
28
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
<MetricCard
|
|
30
|
+
title="Total Sales"
|
|
31
|
+
value="$1.2M"
|
|
32
|
+
trend={{ value: 12, direction: 'up' }}
|
|
33
|
+
footer={<UIButton variant="primary">View Details</UIButton>}
|
|
34
|
+
/>
|
|
31
35
|
);
|
|
32
36
|
}
|
|
33
37
|
```
|
|
34
38
|
|
|
39
|
+
**Note:** After installation, components are copied to `src/components/library/` for Tailwind scanning.
|
|
40
|
+
Import from `@/components/library` (not from the package directly).
|
|
41
|
+
|
|
35
42
|
### Import Styles
|
|
36
43
|
|
|
37
44
|
Add to your main CSS file:
|
|
@@ -105,6 +112,32 @@ npm run build
|
|
|
105
112
|
npm run build:types
|
|
106
113
|
```
|
|
107
114
|
|
|
115
|
+
## Contributing
|
|
116
|
+
|
|
117
|
+
**⚠️ IMPORTANT: Read [CONTRIBUTING.md](./CONTRIBUTING.md) before making changes.**
|
|
118
|
+
|
|
119
|
+
### Key Rules
|
|
120
|
+
- Component names MUST match `.a4drules/skills/component-library/` documentation
|
|
121
|
+
- Library components use **UI prefix** (UIButton, UIInput) - NOT shadcn names
|
|
122
|
+
- Update CHANGELOG.md with EVERY change before publishing
|
|
123
|
+
- Run verification scripts before committing
|
|
124
|
+
|
|
125
|
+
### Quick Checks
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Verify consistency between code, docs, and templates
|
|
129
|
+
npm run verify
|
|
130
|
+
|
|
131
|
+
# Pre-publish verification (runs automatically before publish)
|
|
132
|
+
npm run prepublish:check
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Documentation Structure
|
|
136
|
+
- **[ARCHITECTURE.md](./ARCHITECTURE.md)** - Source of truth hierarchy
|
|
137
|
+
- **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Contribution guidelines and checklists
|
|
138
|
+
- **[CHANGELOG.md](./CHANGELOG.md)** - Detailed version history
|
|
139
|
+
- **[.a4drules/RULES.md](./.a4drules/RULES.md)** - Mandatory project rules
|
|
140
|
+
|
|
108
141
|
## Publishing
|
|
109
142
|
|
|
110
143
|
This package publishes to the **public npm registry** at https://registry.npmjs.org.
|
|
@@ -113,21 +146,50 @@ This package publishes to the **public npm registry** at https://registry.npmjs.
|
|
|
113
146
|
- Be logged in to npm: `npm login`
|
|
114
147
|
- Have publish permissions for the `@schandlergarcia` scope
|
|
115
148
|
|
|
116
|
-
### Publish
|
|
149
|
+
### Publish Process
|
|
150
|
+
|
|
151
|
+
**The `prepublishOnly` script automatically runs verification checks.**
|
|
117
152
|
|
|
118
153
|
```bash
|
|
119
|
-
#
|
|
120
|
-
|
|
121
|
-
npm version minor # 1.9.29 → 1.10.0
|
|
122
|
-
npm version major # 1.9.29 → 2.0.0
|
|
154
|
+
# 1. Update CHANGELOG.md with your changes
|
|
155
|
+
# Add entry under ## [X.X.X] - YYYY-MM-DD
|
|
123
156
|
|
|
124
|
-
#
|
|
157
|
+
# 2. Bump version
|
|
158
|
+
npm version patch # 1.9.43 → 1.9.44
|
|
159
|
+
npm version minor # 1.9.43 → 1.10.0
|
|
160
|
+
npm version major # 1.9.43 → 2.0.0
|
|
125
161
|
|
|
126
|
-
#
|
|
127
|
-
npm run build
|
|
162
|
+
# 3. Publish (verification runs automatically)
|
|
128
163
|
npm publish
|
|
129
164
|
```
|
|
130
165
|
|
|
166
|
+
**The prepublishOnly hook will:**
|
|
167
|
+
1. Run consistency verification (`npm run verify`)
|
|
168
|
+
2. Check CHANGELOG has entry for current version
|
|
169
|
+
3. Verify UIButton.tsx and UIInput.tsx exist
|
|
170
|
+
4. Build the package
|
|
171
|
+
5. Block publish if any checks fail
|
|
172
|
+
|
|
173
|
+
### Manual Verification (Optional)
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Run all pre-publish checks manually
|
|
177
|
+
npm run prepublish:check
|
|
178
|
+
|
|
179
|
+
# Run only consistency checks
|
|
180
|
+
npm run verify
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### If Publish Fails
|
|
184
|
+
|
|
185
|
+
If verification fails:
|
|
186
|
+
1. Read the error output carefully
|
|
187
|
+
2. Fix the reported issues
|
|
188
|
+
3. See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidance
|
|
189
|
+
4. See [.a4drules/RULES.md](./.a4drules/RULES.md) for rules
|
|
190
|
+
5. Run `npm run verify` to check fixes
|
|
191
|
+
6. Try publishing again
|
|
192
|
+
|
|
131
193
|
The package is published as **public** and can be installed by anyone:
|
|
132
194
|
```bash
|
|
133
195
|
npm install @schandlergarcia/sf-web-components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schandlergarcia/sf-web-components",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.44",
|
|
4
4
|
"description": "Reusable Salesforce web components library with Tailwind CSS v4 and shadcn/ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,12 +34,18 @@
|
|
|
34
34
|
"src/types",
|
|
35
35
|
"README.md",
|
|
36
36
|
"INSTALL.md",
|
|
37
|
+
"CHANGELOG.md",
|
|
38
|
+
"CONTRIBUTING.md",
|
|
39
|
+
"ARCHITECTURE.md",
|
|
40
|
+
"QUICK-REFERENCE.md",
|
|
37
41
|
".a4drules"
|
|
38
42
|
],
|
|
39
43
|
"scripts": {
|
|
40
44
|
"build": "vite build && cp -r src/styles dist/",
|
|
41
45
|
"build:types": "tsc --emitDeclarationOnly",
|
|
42
|
-
"
|
|
46
|
+
"verify": "bash scripts/verify-consistency.sh",
|
|
47
|
+
"prepublish:check": "bash scripts/pre-publish-check.sh",
|
|
48
|
+
"prepublishOnly": "npm run prepublish:check && npm run build",
|
|
43
49
|
"postinstall": "node scripts/postinstall.mjs",
|
|
44
50
|
"reset:command-center": "bash scripts/reset-command-center.sh",
|
|
45
51
|
"validate:dashboard": "bash scripts/validate-dashboard.sh",
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Pre-publish verification script
|
|
4
|
+
# Enforces all rules from .a4drules/RULES.md before allowing publish
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
10
|
+
|
|
11
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
12
|
+
echo "🔒 Pre-Publish Verification"
|
|
13
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
14
|
+
echo ""
|
|
15
|
+
|
|
16
|
+
RED='\033[0;31m'
|
|
17
|
+
GREEN='\033[0;32m'
|
|
18
|
+
YELLOW='\033[1;33m'
|
|
19
|
+
NC='\033[0m' # No Color
|
|
20
|
+
|
|
21
|
+
ERRORS=0
|
|
22
|
+
|
|
23
|
+
# Rule 1: Consistency Check
|
|
24
|
+
echo "📋 Rule 1: Verifying consistency between code, docs, and templates..."
|
|
25
|
+
if bash "$ROOT/scripts/verify-consistency.sh"; then
|
|
26
|
+
echo -e "${GREEN}✓ Consistency check passed${NC}"
|
|
27
|
+
else
|
|
28
|
+
echo -e "${RED}✗ Consistency check failed${NC}"
|
|
29
|
+
ERRORS=$((ERRORS + 1))
|
|
30
|
+
fi
|
|
31
|
+
echo ""
|
|
32
|
+
|
|
33
|
+
# Rule 2: CHANGELOG Check
|
|
34
|
+
echo "📝 Rule 2: Verifying CHANGELOG.md is up to date..."
|
|
35
|
+
|
|
36
|
+
# Get current version from package.json
|
|
37
|
+
VERSION=$(node -p "require('$ROOT/package.json').version")
|
|
38
|
+
echo " Current version: $VERSION"
|
|
39
|
+
|
|
40
|
+
# Check if CHANGELOG has entry for current version
|
|
41
|
+
if grep -q "## \[$VERSION\]" "$ROOT/CHANGELOG.md"; then
|
|
42
|
+
echo -e " ${GREEN}✓ CHANGELOG has entry for version $VERSION${NC}"
|
|
43
|
+
else
|
|
44
|
+
echo -e " ${RED}✗ CHANGELOG missing entry for version $VERSION${NC}"
|
|
45
|
+
echo " Add a section to CHANGELOG.md:"
|
|
46
|
+
echo " ## [$VERSION] - $(date +%Y-%m-%d)"
|
|
47
|
+
ERRORS=$((ERRORS + 1))
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Check if any src/ files changed since last commit
|
|
51
|
+
if git diff --name-only HEAD src/ 2>/dev/null | grep -q .; then
|
|
52
|
+
echo -e " ${YELLOW}⚠ src/ files changed, ensure CHANGELOG is updated${NC}"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo ""
|
|
56
|
+
|
|
57
|
+
# Rule 3: Component Naming
|
|
58
|
+
echo "🏷️ Rule 3: Verifying component naming conventions..."
|
|
59
|
+
if [ -f "$ROOT/src/components/library/ui/UIButton.tsx" ]; then
|
|
60
|
+
echo -e " ${GREEN}✓ UIButton.tsx exists (correct)${NC}"
|
|
61
|
+
else
|
|
62
|
+
echo -e " ${RED}✗ UIButton.tsx missing${NC}"
|
|
63
|
+
ERRORS=$((ERRORS + 1))
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [ -f "$ROOT/src/components/library/ui/UIInput.tsx" ]; then
|
|
67
|
+
echo -e " ${GREEN}✓ UIInput.tsx exists (correct)${NC}"
|
|
68
|
+
else
|
|
69
|
+
echo -e " ${RED}✗ UIInput.tsx missing${NC}"
|
|
70
|
+
ERRORS=$((ERRORS + 1))
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
if [ -f "$ROOT/src/components/library/ui/Button.jsx" ] || [ -f "$ROOT/src/components/library/ui/Button.tsx" ]; then
|
|
74
|
+
echo -e " ${RED}✗ Button.jsx/tsx exists (should be UIButton.tsx)${NC}"
|
|
75
|
+
ERRORS=$((ERRORS + 1))
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
if [ -f "$ROOT/src/components/library/ui/Input.jsx" ] || [ -f "$ROOT/src/components/library/ui/Input.tsx" ]; then
|
|
79
|
+
echo -e " ${RED}✗ Input.jsx/tsx exists (should be UIInput.tsx)${NC}"
|
|
80
|
+
ERRORS=$((ERRORS + 1))
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
echo ""
|
|
84
|
+
|
|
85
|
+
# Rule 4: Build Check
|
|
86
|
+
echo "🔨 Rule 4: Verifying build succeeds..."
|
|
87
|
+
if npm run build --silent; then
|
|
88
|
+
echo -e "${GREEN}✓ Build succeeded${NC}"
|
|
89
|
+
else
|
|
90
|
+
echo -e "${RED}✗ Build failed${NC}"
|
|
91
|
+
ERRORS=$((ERRORS + 1))
|
|
92
|
+
fi
|
|
93
|
+
echo ""
|
|
94
|
+
|
|
95
|
+
# Rule 5: Documentation Check
|
|
96
|
+
echo "📚 Rule 5: Verifying documentation files exist..."
|
|
97
|
+
if [ -f "$ROOT/.a4drules/skills/component-library/ui-primitives.md" ]; then
|
|
98
|
+
echo -e " ${GREEN}✓ ui-primitives.md exists${NC}"
|
|
99
|
+
else
|
|
100
|
+
echo -e " ${RED}✗ ui-primitives.md missing${NC}"
|
|
101
|
+
ERRORS=$((ERRORS + 1))
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
if [ -f "$ROOT/CHANGELOG.md" ]; then
|
|
105
|
+
echo -e " ${GREEN}✓ CHANGELOG.md exists${NC}"
|
|
106
|
+
else
|
|
107
|
+
echo -e " ${RED}✗ CHANGELOG.md missing${NC}"
|
|
108
|
+
ERRORS=$((ERRORS + 1))
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
if [ -f "$ROOT/CONTRIBUTING.md" ]; then
|
|
112
|
+
echo -e " ${GREEN}✓ CONTRIBUTING.md exists${NC}"
|
|
113
|
+
else
|
|
114
|
+
echo -e " ${RED}✗ CONTRIBUTING.md missing${NC}"
|
|
115
|
+
ERRORS=$((ERRORS + 1))
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
if [ -f "$ROOT/ARCHITECTURE.md" ]; then
|
|
119
|
+
echo -e " ${GREEN}✓ ARCHITECTURE.md exists${NC}"
|
|
120
|
+
else
|
|
121
|
+
echo -e " ${RED}✗ ARCHITECTURE.md missing${NC}"
|
|
122
|
+
ERRORS=$((ERRORS + 1))
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
if [ -f "$ROOT/.a4drules/RULES.md" ]; then
|
|
126
|
+
echo -e " ${GREEN}✓ RULES.md exists${NC}"
|
|
127
|
+
else
|
|
128
|
+
echo -e " ${RED}✗ RULES.md missing${NC}"
|
|
129
|
+
ERRORS=$((ERRORS + 1))
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
echo ""
|
|
133
|
+
|
|
134
|
+
# Rule 6: Package.json files array check
|
|
135
|
+
echo "📦 Rule 6: Verifying package.json files array..."
|
|
136
|
+
REQUIRED_DIRS=("src/templates" "src/components" "src/lib" "src/types" ".a4drules" "scripts")
|
|
137
|
+
|
|
138
|
+
for dir in "${REQUIRED_DIRS[@]}"; do
|
|
139
|
+
if grep -q "\"$dir\"" "$ROOT/package.json"; then
|
|
140
|
+
echo -e " ${GREEN}✓ $dir included${NC}"
|
|
141
|
+
else
|
|
142
|
+
echo -e " ${RED}✗ $dir missing from files array${NC}"
|
|
143
|
+
ERRORS=$((ERRORS + 1))
|
|
144
|
+
fi
|
|
145
|
+
done
|
|
146
|
+
|
|
147
|
+
echo ""
|
|
148
|
+
|
|
149
|
+
# Rule 7: Git status check
|
|
150
|
+
echo "🔍 Rule 7: Checking git status..."
|
|
151
|
+
if git diff-index --quiet HEAD -- 2>/dev/null; then
|
|
152
|
+
echo -e "${GREEN}✓ No uncommitted changes${NC}"
|
|
153
|
+
else
|
|
154
|
+
echo -e "${YELLOW}⚠ You have uncommitted changes${NC}"
|
|
155
|
+
echo " Consider committing before publishing"
|
|
156
|
+
fi
|
|
157
|
+
echo ""
|
|
158
|
+
|
|
159
|
+
# Summary
|
|
160
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
161
|
+
|
|
162
|
+
if [ $ERRORS -eq 0 ]; then
|
|
163
|
+
echo -e "${GREEN}✅ All pre-publish checks passed!${NC}"
|
|
164
|
+
echo ""
|
|
165
|
+
echo "Safe to publish version $VERSION"
|
|
166
|
+
echo ""
|
|
167
|
+
echo "To publish, run:"
|
|
168
|
+
echo " npm publish"
|
|
169
|
+
echo ""
|
|
170
|
+
exit 0
|
|
171
|
+
else
|
|
172
|
+
echo -e "${RED}❌ Found $ERRORS error(s)${NC}"
|
|
173
|
+
echo ""
|
|
174
|
+
echo "Cannot publish until all errors are fixed."
|
|
175
|
+
echo ""
|
|
176
|
+
echo "See .a4drules/RULES.md for requirements"
|
|
177
|
+
echo "See CONTRIBUTING.md for guidance"
|
|
178
|
+
echo ""
|
|
179
|
+
exit 1
|
|
180
|
+
fi
|