@schandlergarcia/sf-web-components 1.9.50 → 1.9.52

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.
@@ -254,6 +254,63 @@ if (fs.existsSync(dataSourceDir)) {
254
254
  console.error(` ✗ Failed to install engine-sample-data.js: ${error.message}`);
255
255
  }
256
256
  }
257
+
258
+ // Copy schema.graphql
259
+ const schemaSource = path.join(dataSourceDir, 'schema.graphql');
260
+ const schemaTarget = path.join(cwd, 'schema.graphql');
261
+
262
+ if (fs.existsSync(schemaSource)) {
263
+ try {
264
+ fs.copyFileSync(schemaSource, schemaTarget);
265
+ console.log(' ✓ Installed schema.graphql (pre-built from sample data)');
266
+ dataFilesInstalled++;
267
+ } catch (error) {
268
+ console.error(` ✗ Failed to install schema.graphql: ${error.message}`);
269
+ }
270
+ }
271
+
272
+ // Copy engine-command-center-prd.md
273
+ const prdSource = path.join(dataSourceDir, 'engine-command-center-prd.md');
274
+ const prdTarget = path.join(cwd, 'engine-command-center-prd.md');
275
+
276
+ if (fs.existsSync(prdSource)) {
277
+ try {
278
+ fs.copyFileSync(prdSource, prdTarget);
279
+ console.log(' ✓ Installed engine-command-center-prd.md');
280
+ dataFilesInstalled++;
281
+ } catch (error) {
282
+ console.error(` ✗ Failed to install engine-command-center-prd.md: ${error.message}`);
283
+ }
284
+ }
285
+ }
286
+
287
+ // Copy GraphQL schema generator script
288
+ const scriptsSourceDir = path.join(packageRoot, 'scripts');
289
+ const targetScriptsDir = path.join(cwd, 'scripts');
290
+
291
+ console.log('\n📝 Installing GraphQL scripts...\n');
292
+
293
+ let scriptsInstalled = 0;
294
+
295
+ if (fs.existsSync(scriptsSourceDir)) {
296
+ // Create target scripts directory if it doesn't exist
297
+ if (!fs.existsSync(targetScriptsDir)) {
298
+ fs.mkdirSync(targetScriptsDir, { recursive: true });
299
+ }
300
+
301
+ // Copy generate-schema-from-sample.mjs
302
+ const generatorSource = path.join(scriptsSourceDir, 'generate-schema-from-sample.mjs');
303
+ const generatorTarget = path.join(targetScriptsDir, 'generate-schema-from-sample.mjs');
304
+
305
+ if (fs.existsSync(generatorSource)) {
306
+ try {
307
+ fs.copyFileSync(generatorSource, generatorTarget);
308
+ console.log(' ✓ Installed generate-schema-from-sample.mjs');
309
+ scriptsInstalled++;
310
+ } catch (error) {
311
+ console.error(` ✗ Failed to install generate-schema-from-sample.mjs: ${error.message}`);
312
+ }
313
+ }
257
314
  }
258
315
 
259
316
  // Copy routes.tsx template with full configuration
@@ -297,6 +354,12 @@ if (fs.existsSync(packageJsonPath)) {
297
354
  scriptsAdded.push('validate:dashboard');
298
355
  }
299
356
 
357
+ // Add the graphql:schema:sample script if it doesn't exist
358
+ if (!packageJson.scripts['graphql:schema:sample']) {
359
+ packageJson.scripts['graphql:schema:sample'] = 'node scripts/generate-schema-from-sample.mjs';
360
+ scriptsAdded.push('graphql:schema:sample');
361
+ }
362
+
300
363
  if (scriptsAdded.length > 0) {
301
364
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
302
365
  scriptsAdded.forEach(script => {
@@ -388,7 +451,8 @@ console.log('\n📊 Summary:');
388
451
  console.log(` - Copied ${componentsCopied} UI components`);
389
452
  console.log(` - Updated ${filesUpdated} files`);
390
453
  console.log(` - Installed ${templatesInstalled} page templates`);
391
- console.log(` - Installed ${dataFilesInstalled} sample data files`);
454
+ console.log(` - Installed ${dataFilesInstalled} sample data files (including schema.graphql)`);
455
+ console.log(` - Installed ${scriptsInstalled} GraphQL scripts`);
392
456
  console.log(` - Installed CommandCenter.tsx for dashboard management`);
393
457
  console.log(` - Added "npm run reset:command-center" script`);
394
458
  console.log(` - Installed AI assistant rules for command center building`);
@@ -648,7 +648,7 @@ GLOBAL_CSS_EOF
648
648
  echo " ✓ Engine branding restored"
649
649
  echo ""
650
650
 
651
- # ── 10. Restore Engine sample data ──────────────────────────────────────────
651
+ # ── 10. Restore Engine sample data and schema ──────────────────────────────
652
652
 
653
653
  # Ensure src/data directory exists
654
654
  mkdir -p src/data
@@ -659,19 +659,54 @@ echo "→ Restoring ${ENGINE_DATA}..."
659
659
  # Detect package location
660
660
  if [ -d "node_modules/@schandlergarcia/sf-web-components/data" ]; then
661
661
  PACKAGE_DATA="node_modules/@schandlergarcia/sf-web-components/data/engine-sample-data.js"
662
+ PACKAGE_SCHEMA="node_modules/@schandlergarcia/sf-web-components/data/schema.graphql"
662
663
  elif [ -f "$SCRIPT_DIR/../data/engine-sample-data.js" ]; then
663
664
  # Running from package source
664
665
  PACKAGE_DATA="$SCRIPT_DIR/../data/engine-sample-data.js"
666
+ PACKAGE_SCHEMA="$SCRIPT_DIR/../data/schema.graphql"
665
667
  else
666
668
  echo " ⚠ Could not find engine-sample-data.js in package"
667
669
  PACKAGE_DATA=""
670
+ PACKAGE_SCHEMA=""
668
671
  fi
669
672
 
670
673
  if [ -n "$PACKAGE_DATA" ] && [ -f "$PACKAGE_DATA" ]; then
671
674
  cp "$PACKAGE_DATA" "$ENGINE_DATA"
672
675
  echo " ✓ Engine sample data restored"
673
676
  else
674
- echo " ⚠ Skipped (package data not found)"
677
+ echo " ⚠ Skipped sample data (package data not found)"
678
+ fi
679
+
680
+ # Restore schema.graphql
681
+ SCHEMA_FILE="schema.graphql"
682
+ echo "→ Restoring ${SCHEMA_FILE}..."
683
+
684
+ if [ -n "$PACKAGE_SCHEMA" ] && [ -f "$PACKAGE_SCHEMA" ]; then
685
+ cp "$PACKAGE_SCHEMA" "$SCHEMA_FILE"
686
+ echo " ✓ GraphQL schema restored (pre-built from sample data)"
687
+ else
688
+ echo " ⚠ Skipped schema (package schema not found)"
689
+ fi
690
+
691
+ # Restore engine-command-center-prd.md
692
+ PRD_FILE="engine-command-center-prd.md"
693
+ echo "→ Restoring ${PRD_FILE}..."
694
+
695
+ # Detect package location for PRD
696
+ if [ -d "node_modules/@schandlergarcia/sf-web-components/data" ]; then
697
+ PACKAGE_PRD="node_modules/@schandlergarcia/sf-web-components/data/engine-command-center-prd.md"
698
+ elif [ -f "$SCRIPT_DIR/../data/engine-command-center-prd.md" ]; then
699
+ # Running from package source
700
+ PACKAGE_PRD="$SCRIPT_DIR/../data/engine-command-center-prd.md"
701
+ else
702
+ PACKAGE_PRD=""
703
+ fi
704
+
705
+ if [ -n "$PACKAGE_PRD" ] && [ -f "$PACKAGE_PRD" ]; then
706
+ cp "$PACKAGE_PRD" "$PRD_FILE"
707
+ echo " ✓ Engine PRD restored"
708
+ else
709
+ echo " ⚠ Skipped PRD (package PRD not found)"
675
710
  fi
676
711
 
677
712
  echo ""
@@ -687,6 +722,8 @@ echo "║ - Teal brand palette (#5BC8C8) ║"
687
722
  echo "║ - Inter font stack ║"
688
723
  echo "║ - HeroUI Engine theme overrides ║"
689
724
  echo "║ • Engine sample data (engine-sample-data.js)║"
725
+ echo "║ • GraphQL schema (schema.graphql) ║"
726
+ echo "║ • Engine PRD (engine-command-center-prd.md)║"
690
727
  echo "║ • Component library (cards, charts, etc.) ║"
691
728
  echo "║ • HeroUI wrappers & theme providers ║"
692
729
  echo "║ • Salesforce SDK stubs for local dev ║"