@schandlergarcia/sf-web-components 1.9.24 → 1.9.26
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.
|
@@ -13,6 +13,10 @@ These rules are non-negotiable for all dashboard files in `src/pages/` and works
|
|
|
13
13
|
|
|
14
14
|
You MUST load the **command-center-builder** and **component-library** skills before writing or editing dashboard pages. These skills contain the full component API reference and builder rules. Do not proceed without them.
|
|
15
15
|
|
|
16
|
+
## When writing files
|
|
17
|
+
|
|
18
|
+
**Write COMPLETE files only.** Every file you write must be syntactically valid from the first import to the final closing brace. Do NOT stop writing mid-file, mid-function, or mid-line. Every opened JSX tag must be closed. Every opened string must be closed. Every className attribute must be complete. Incomplete files cause build failures.
|
|
19
|
+
|
|
16
20
|
## Critical constraints
|
|
17
21
|
|
|
18
22
|
1. **File extension MUST be `.tsx`** — This is a TypeScript project. All React components MUST use `.tsx` extension, never `.jsx`. All type definitions are available from the component library.
|
|
@@ -15,7 +15,7 @@ These rules apply when building dashboards rendered by `CommandCenter.tsx`. For
|
|
|
15
15
|
|
|
16
16
|
**Every time you build a dashboard, you MUST follow these non-negotiable rules. Violations are the #1 cause of rejected dashboards.**
|
|
17
17
|
|
|
18
|
-
1. **Actually write files to disk.** Use the file-writing tools to create `.tsx` files (NOT `.jsx`) in `src/pages/` and update `CommandCenter.tsx` to import your dashboard. This is a TypeScript project - all React components MUST use `.tsx` extension. If you only describe what you would build without creating the files, the dashboard will not render. Verify the files exist after writing them.
|
|
18
|
+
1. **Actually write COMPLETE files to disk.** Use the file-writing tools to create `.tsx` files (NOT `.jsx`) in `src/pages/` and update `CommandCenter.tsx` to import your dashboard. This is a TypeScript project - all React components MUST use `.tsx` extension. **CRITICAL: Write the ENTIRE file from import statements through the closing brace `}` of the export statement. Do NOT stop mid-file, mid-function, or mid-line. Every JSX tag you open must be closed. Every string you open must be closed. Every className attribute must be complete.** If you only describe what you would build without creating the files, the dashboard will not render. Verify the files exist after writing them.
|
|
19
19
|
|
|
20
20
|
2. **Use ONLY library components** from `@/components/library` for all cards, charts, tables, lists, and feeds. The library has 30+ components — there is no reason to hand-roll HTML. See the component table below.
|
|
21
21
|
|
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -256,12 +256,25 @@ if (fs.existsSync(packageJsonPath)) {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
// Add the reset:command-center script if it doesn't exist
|
|
259
|
+
let scriptsAdded = [];
|
|
259
260
|
if (!packageJson.scripts['reset:command-center']) {
|
|
260
261
|
packageJson.scripts['reset:command-center'] = 'bash node_modules/@schandlergarcia/sf-web-components/scripts/reset-command-center.sh';
|
|
262
|
+
scriptsAdded.push('reset:command-center');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Add the validate:dashboard script if it doesn't exist
|
|
266
|
+
if (!packageJson.scripts['validate:dashboard']) {
|
|
267
|
+
packageJson.scripts['validate:dashboard'] = 'bash node_modules/@schandlergarcia/sf-web-components/scripts/validate-dashboard.sh';
|
|
268
|
+
scriptsAdded.push('validate:dashboard');
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (scriptsAdded.length > 0) {
|
|
261
272
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
262
|
-
|
|
273
|
+
scriptsAdded.forEach(script => {
|
|
274
|
+
console.log(` ✓ Added "${script}" script to package.json`);
|
|
275
|
+
});
|
|
263
276
|
} else {
|
|
264
|
-
console.log(' ℹ
|
|
277
|
+
console.log(' ℹ Scripts already exist');
|
|
265
278
|
}
|
|
266
279
|
} catch (error) {
|
|
267
280
|
console.error(` ✗ Failed to update package.json: ${error.message}`);
|
|
@@ -21,8 +21,8 @@ else
|
|
|
21
21
|
fi
|
|
22
22
|
cd "$ROOT"
|
|
23
23
|
|
|
24
|
-
PAGES_DIR="src/
|
|
25
|
-
|
|
24
|
+
PAGES_DIR="src/pages"
|
|
25
|
+
WORKSPACE_DIR="src/components/workspace"
|
|
26
26
|
ERRORS=0
|
|
27
27
|
WARNINGS=0
|
|
28
28
|
|
|
@@ -40,8 +40,11 @@ echo ""
|
|
|
40
40
|
|
|
41
41
|
echo "── Wiring ──"
|
|
42
42
|
|
|
43
|
-
WRAPPER="$
|
|
44
|
-
if
|
|
43
|
+
WRAPPER="$WORKSPACE_DIR/CommandCenter.tsx"
|
|
44
|
+
if [ ! -f "$WRAPPER" ]; then
|
|
45
|
+
red "CommandCenter.tsx not found at $WORKSPACE_DIR/"
|
|
46
|
+
ERRORS=$((ERRORS + 1))
|
|
47
|
+
elif grep -q 'BlankDashboard' "$WRAPPER"; then
|
|
45
48
|
red "CommandCenter.tsx still imports BlankDashboard — no dashboard is wired up"
|
|
46
49
|
ERRORS=$((ERRORS + 1))
|
|
47
50
|
else
|
|
@@ -51,19 +54,17 @@ echo ""
|
|
|
51
54
|
|
|
52
55
|
# ── 2. Find all dashboard files to scan ──────────────────────────────────────
|
|
53
56
|
|
|
54
|
-
# Collect all .
|
|
57
|
+
# Collect all .tsx in pages/ dir (excluding BlankDashboard, Home, NotFound, Search)
|
|
55
58
|
SCAN_FILES=()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
fi
|
|
66
|
-
done
|
|
59
|
+
if [ -d "$PAGES_DIR" ]; then
|
|
60
|
+
while IFS= read -r f; do
|
|
61
|
+
base=$(basename "$f")
|
|
62
|
+
case "$base" in
|
|
63
|
+
BlankDashboard.*|Home.*|NotFound.*|Search.*) continue ;;
|
|
64
|
+
*) SCAN_FILES+=("$f") ;;
|
|
65
|
+
esac
|
|
66
|
+
done < <(find "$PAGES_DIR" -maxdepth 1 -name "*.tsx" | sort)
|
|
67
|
+
fi
|
|
67
68
|
|
|
68
69
|
if [ ${#SCAN_FILES[@]} -eq 0 ]; then
|
|
69
70
|
yellow "No dashboard files found to scan"
|
|
@@ -234,14 +235,14 @@ echo ""
|
|
|
234
235
|
|
|
235
236
|
# ── 10. Check file extensions ─────────────────────────────────────────────────
|
|
236
237
|
|
|
237
|
-
echo "── File extensions (dashboard pages
|
|
238
|
+
echo "── File extensions (dashboard pages MUST be .tsx) ──"
|
|
238
239
|
|
|
239
240
|
for f in "${SCAN_FILES[@]}"; do
|
|
240
241
|
base=$(basename "$f")
|
|
241
242
|
|
|
242
|
-
if [[ "$f" == *.
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
if [[ "$f" == *.jsx ]]; then
|
|
244
|
+
red "$base: dashboard uses .jsx — this is a TypeScript project, all React components MUST use .tsx"
|
|
245
|
+
ERRORS=$((ERRORS + 1))
|
|
245
246
|
fi
|
|
246
247
|
done
|
|
247
248
|
echo ""
|