@schandlergarcia/sf-web-components 1.9.80 → 1.9.82

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.82] - 2026-04-06
9
+
10
+ ### Fixed
11
+ - **Reset script wasn't cleaning Apex classes** — Path detection found a nested `force-app/main/default` directory inside the webapp (created by the demo agent when deploying Apex) instead of the real SFDX project root above it. Fixed by extracting the SFDX path from the webapp's own absolute path instead of searching child directories.
12
+
13
+ ## [1.9.81] - 2026-04-06
14
+
15
+ ### Changed
16
+ - **Reset script metadata cleanup** — Now silently skips when `force-app` directory or metadata folders don't exist. Only prints output when it actually finds and removes files. No more noisy "ℹ No Apex classes to remove" messages.
17
+
8
18
  ## [1.9.80] - 2026-04-04
9
19
 
10
20
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schandlergarcia/sf-web-components",
3
- "version": "1.9.80",
3
+ "version": "1.9.82",
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",
@@ -759,74 +759,58 @@ fi
759
759
 
760
760
  SFDX_DEFAULT=""
761
761
 
762
- # Walk up from webapp root to find force-app/main/default
763
- check="$ROOT"
764
- for i in 1 2 3 4 5; do
765
- if [ -d "$check/force-app/main/default" ]; then
766
- SFDX_DEFAULT="$check/force-app/main/default"
767
- break
768
- fi
769
- parent="$(dirname "$check")"
770
- # Check if we're already inside force-app/main/default
771
- if [[ "$check" == */force-app/main/default/* ]]; then
772
- SFDX_DEFAULT="${check%%/force-app/main/default/*}/force-app/main/default"
773
- break
774
- fi
775
- check="$parent"
776
- done
762
+ # The webapp lives inside force-app/main/default/uiBundles/..., so extract
763
+ # the SFDX default directory from our own path first. Only fall back to
764
+ # searching child directories if the pattern doesn't match (standalone app).
765
+ ROOT_ABS="$(cd "$ROOT" && pwd)"
766
+
767
+ if [[ "$ROOT_ABS" == */force-app/main/default/* ]]; then
768
+ SFDX_DEFAULT="${ROOT_ABS%%/force-app/main/default/*}/force-app/main/default"
769
+ fi
777
770
 
778
771
  if [ -n "$SFDX_DEFAULT" ]; then
779
- echo "→ Cleaning Salesforce metadata…"
772
+ metadata_cleaned=0
780
773
 
781
774
  # Remove all Apex classes (.cls and .cls-meta.xml)
782
775
  CLASSES_DIR="$SFDX_DEFAULT/classes"
783
776
  if [ -d "$CLASSES_DIR" ]; then
784
- cls_count=$(find "$CLASSES_DIR" -maxdepth 1 -name "*.cls" -o -name "*.cls-meta.xml" 2>/dev/null | wc -l | tr -d ' ')
777
+ cls_count=$(find "$CLASSES_DIR" -maxdepth 1 \( -name "*.cls" -o -name "*.cls-meta.xml" \) 2>/dev/null | wc -l | tr -d ' ')
785
778
  if [ "$cls_count" -gt 0 ]; then
779
+ [ "$metadata_cleaned" -eq 0 ] && echo "→ Cleaning Salesforce metadata…"
786
780
  rm -f "$CLASSES_DIR"/*.cls "$CLASSES_DIR"/*.cls-meta.xml
787
- echo " ✓ Removed $cls_count Apex class files from classes/"
788
- else
789
- echo " ℹ No Apex classes to remove"
781
+ echo " ✓ Removed $cls_count Apex class files"
782
+ metadata_cleaned=1
790
783
  fi
791
784
  fi
792
785
 
793
- # Remove custom fields created during the demo (e.g., Weather_Impact__c)
786
+ # Remove custom fields created during the demo
794
787
  OBJECTS_DIR="$SFDX_DEFAULT/objects"
795
788
  if [ -d "$OBJECTS_DIR" ]; then
796
- fields_removed=0
797
789
  for fields_dir in "$OBJECTS_DIR"/*/fields; do
798
790
  if [ -d "$fields_dir" ]; then
799
791
  for f in "$fields_dir"/*.field-meta.xml; do
800
792
  if [ -f "$f" ]; then
793
+ [ "$metadata_cleaned" -eq 0 ] && echo "→ Cleaning Salesforce metadata…"
801
794
  rm "$f"
802
795
  echo " ✓ Removed $(basename "$f")"
803
- fields_removed=$((fields_removed + 1))
796
+ metadata_cleaned=1
804
797
  fi
805
798
  done
806
799
  fi
807
800
  done
808
- if [ "$fields_removed" -eq 0 ]; then
809
- echo " ℹ No custom fields to remove"
810
- fi
811
801
 
812
- # Remove platform event directories (e.g., Travel_Disruption_Alert__e/)
813
- events_removed=0
802
+ # Remove platform event directories
814
803
  for evt_dir in "$OBJECTS_DIR"/*__e; do
815
804
  if [ -d "$evt_dir" ]; then
805
+ [ "$metadata_cleaned" -eq 0 ] && echo "→ Cleaning Salesforce metadata…"
816
806
  rm -rf "$evt_dir"
817
807
  echo " ✓ Removed platform event $(basename "$evt_dir")"
818
- events_removed=$((events_removed + 1))
808
+ metadata_cleaned=1
819
809
  fi
820
810
  done
821
- if [ "$events_removed" -eq 0 ]; then
822
- echo " ℹ No platform events to remove"
823
- fi
824
811
  fi
825
812
 
826
- echo ""
827
- else
828
- echo "→ Skipping metadata cleanup (no force-app directory found)"
829
- echo ""
813
+ [ "$metadata_cleaned" -gt 0 ] && echo ""
830
814
  fi
831
815
 
832
816
  # ── Done ─────────────────────────────────────────────────────────────────────