Sharing in case others find it useful
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor exercise map generation to use a default exercise value and update comments for clarity

+110 -107
+104 -102
exercise-map.ts
··· 1 1 // exercise-map.ts 2 - // Run generate-template-list.ts first, then fill in each value using HEVY_EXERCISES.KEY 2 + // Run generate-template-list.ts first, then fill in each value using H.KEY 3 3 // e.g. "Running": H.RUNNING 4 4 import { HEVY_EXERCISES as H } from './HEVY_EXERCISES.ts'; 5 5 6 - export const EXERCISE_MAP: Record<string, string> = { 7 - "Running": H.RUNNING, 8 - "Rowing": H.ROWING, 9 - "Dumbbell Row": H.DUMBBELL_ROW, 10 - "Dumbbell Bicep Curl": H.DUMBBELL_BICEP_CURL, 11 - "Dumbbell Skullcrusher": H.DUMBBELL_SKULLCRUSHER, 12 - "Dumbbell Fly": H.DUMBBELL_FLY, 13 - "Dumbbell Incline Bench Press": "", 14 - "Bench Dip": "", 15 - "Dumbbell Goblet Squat": "", 16 - "Dumbbell Bulgarian Split Squat": "", 17 - "Kettlebell Sumo Squat": "", 18 - "Dumbbell Lunge": "", 19 - "Standing Dumbbell Calf Raise": "", 20 - "Crunches": "", 21 - "Dumbbell Bench Press": "", 22 - "Dumbbell Bent Over Row": "", 23 - "Weighted Ball Hyperextension": "", 24 - "Walking": "", 25 - "Dumbbell Shoulder Press": "", 26 - "Dumbbell Front Raise": "", 27 - "Exercise Ball Crunch": "", 28 - "Dumbbell Rear Delt Raise": "", 29 - "Dumbbell Squat": "", 30 - "Stability Ball Back Extension": "", 31 - "Jumping Jack": "", 32 - "Dumbbell Romanian Deadlift": "", 33 - "Russian Twist": "", 34 - "Ab Rollout": "", 35 - "Plank": "", 36 - "Swimming": "", 37 - "Running - Treadmill": "", 38 - "Gorilla Rows": "", 39 - "Dumbbell Tricep Extension": "", 40 - "Dumbbell Kickbacks": "", 41 - "Dumbbell Squat To Shoulder Press": "", 42 - "Single Leg Romanian Deadlift": "", 43 - "Kettlebell Swing": "", 44 - "Bicycle Crunch": "", 45 - "Iron Cross": "", 46 - "Single Leg Hip Thrust": "", 47 - "Dumbbell Superman": "", 48 - "Hammer Curls": "", 49 - "Superman with Scaption": "", 50 - "Dumbbell Hip Thrust": "", 51 - "Dumbbell Glute Bridge": "", 52 - "Loop Band Romanian Deadlift": "", 53 - "Alternating Superman": "", 54 - "Sit Up": "", 55 - "Burpee": "", 56 - "Tricep Push Up": "", 57 - "Kettlebell Single Arm Farmer Walk": "", 58 - "Cross Body Hammer Curls": "", 59 - "Push Up": "", 60 - "Lunge": "", 61 - "Single Dumbbell Sumo Squat": "", 62 - "Single Leg Glute Bridge": "", 63 - "Superman Hold": "", 64 - "Kettlebell Row": "", 65 - "Lunge Twist": "", 66 - "Standing Leg Side Circle": "", 67 - "Butt Kick": "", 68 - "Inchworm": "", 69 - "Single Arm Overhead Dumbbell Lunge": "", 70 - "Dumbbell Shrug": "", 71 - "Superman": "", 72 - "Handle Band Forward Raise": "", 73 - "Handle Band Squat": "", 74 - "Scissor Kick": "", 75 - "Dumbbell Squeeze Press": "", 76 - "Side Lunge": "", 77 - "Handle Band Rear Deltoid Fly": "", 78 - "Leg Pull-In": "", 79 - "Jump Rope": "", 80 - "Mini Loop Band Overhead Fly": "", 81 - "Mini Loop Band Lateral Shoulder Raise": "", 82 - "Handle Band Upright Row": "", 83 - "Handle Band Tricep Extension": "", 84 - "Handle Band Bicep Curl": "", 85 - "Seated Dumbbell Curl": "", 86 - "Alternating Dumbbell Bench Press": "", 87 - "Incline Tricep Push Up": "", 88 - "Mini Loop Band Kneeling Bicep Curl": "", 89 - "Leg Raise": "", 90 - "Oblique Crunch": "", 91 - "Mountain Climber": "", 92 - "Mini Loop Band Single Leg Romanian Deadlift with Row": "", 93 - "Walking Lunge": "", 94 - "Handle Band Bent Over Row": "", 95 - "Lunge Jump": "", 96 - "Handle Band Lat Pulldown": "", 97 - "Jackknife Sit-Up": "", 98 - "Cycling": "", 99 - "Single Arm Dumbbell Tricep Extension": "", 100 - "Dumbbell No Money Curls": "", 101 - "Flutter Kicks": "", 102 - "Dumbbell Lateral Raise": "", 103 - "Incline Push Up": "", 104 - "Kettlebell Upright Row": "", 105 - "Mini Loop Band Kneeling Row": "", 106 - "Air Squats": "", 6 + const DEFAULT_EXERCISE = undefined; 7 + 8 + export const EXERCISE_MAP: Record<string, string | undefined> = { 9 + "Running": DEFAULT_EXERCISE, 10 + "Rowing": DEFAULT_EXERCISE, 11 + "Dumbbell Row": DEFAULT_EXERCISE, 12 + "Dumbbell Bicep Curl": DEFAULT_EXERCISE, 13 + "Dumbbell Skullcrusher": DEFAULT_EXERCISE, 14 + "Dumbbell Fly": DEFAULT_EXERCISE, 15 + "Dumbbell Incline Bench Press": DEFAULT_EXERCISE, 16 + "Bench Dip": DEFAULT_EXERCISE, 17 + "Dumbbell Goblet Squat": DEFAULT_EXERCISE, 18 + "Dumbbell Bulgarian Split Squat": DEFAULT_EXERCISE, 19 + "Kettlebell Sumo Squat": DEFAULT_EXERCISE, 20 + "Dumbbell Lunge": DEFAULT_EXERCISE, 21 + "Standing Dumbbell Calf Raise": DEFAULT_EXERCISE, 22 + "Crunches": DEFAULT_EXERCISE, 23 + "Dumbbell Bench Press": DEFAULT_EXERCISE, 24 + "Dumbbell Bent Over Row": DEFAULT_EXERCISE, 25 + "Weighted Ball Hyperextension": DEFAULT_EXERCISE, 26 + "Walking": DEFAULT_EXERCISE, 27 + "Dumbbell Shoulder Press": DEFAULT_EXERCISE, 28 + "Dumbbell Front Raise": DEFAULT_EXERCISE, 29 + "Exercise Ball Crunch": DEFAULT_EXERCISE, 30 + "Dumbbell Rear Delt Raise": DEFAULT_EXERCISE, 31 + "Dumbbell Squat": DEFAULT_EXERCISE, 32 + "Stability Ball Back Extension": DEFAULT_EXERCISE, 33 + "Jumping Jack": DEFAULT_EXERCISE, 34 + "Dumbbell Romanian Deadlift": DEFAULT_EXERCISE, 35 + "Russian Twist": DEFAULT_EXERCISE, 36 + "Ab Rollout": DEFAULT_EXERCISE, 37 + "Plank": DEFAULT_EXERCISE, 38 + "Swimming": DEFAULT_EXERCISE, 39 + "Running - Treadmill": DEFAULT_EXERCISE, 40 + "Gorilla Rows": DEFAULT_EXERCISE, 41 + "Dumbbell Tricep Extension": DEFAULT_EXERCISE, 42 + "Dumbbell Kickbacks": DEFAULT_EXERCISE, 43 + "Dumbbell Squat To Shoulder Press": DEFAULT_EXERCISE, 44 + "Single Leg Romanian Deadlift": DEFAULT_EXERCISE, 45 + "Kettlebell Swing": DEFAULT_EXERCISE, 46 + "Bicycle Crunch": DEFAULT_EXERCISE, 47 + "Iron Cross": DEFAULT_EXERCISE, 48 + "Single Leg Hip Thrust": DEFAULT_EXERCISE, 49 + "Dumbbell Superman": DEFAULT_EXERCISE, 50 + "Hammer Curls": DEFAULT_EXERCISE, 51 + "Superman with Scaption": DEFAULT_EXERCISE, 52 + "Dumbbell Hip Thrust": DEFAULT_EXERCISE, 53 + "Dumbbell Glute Bridge": DEFAULT_EXERCISE, 54 + "Loop Band Romanian Deadlift": DEFAULT_EXERCISE, 55 + "Alternating Superman": DEFAULT_EXERCISE, 56 + "Sit Up": DEFAULT_EXERCISE, 57 + "Burpee": DEFAULT_EXERCISE, 58 + "Tricep Push Up": DEFAULT_EXERCISE, 59 + "Kettlebell Single Arm Farmer Walk": DEFAULT_EXERCISE, 60 + "Cross Body Hammer Curls": DEFAULT_EXERCISE, 61 + "Push Up": DEFAULT_EXERCISE, 62 + "Lunge": DEFAULT_EXERCISE, 63 + "Single Dumbbell Sumo Squat": DEFAULT_EXERCISE, 64 + "Single Leg Glute Bridge": DEFAULT_EXERCISE, 65 + "Superman Hold": DEFAULT_EXERCISE, 66 + "Kettlebell Row": DEFAULT_EXERCISE, 67 + "Lunge Twist": DEFAULT_EXERCISE, 68 + "Standing Leg Side Circle": DEFAULT_EXERCISE, 69 + "Butt Kick": DEFAULT_EXERCISE, 70 + "Inchworm": DEFAULT_EXERCISE, 71 + "Single Arm Overhead Dumbbell Lunge": DEFAULT_EXERCISE, 72 + "Dumbbell Shrug": DEFAULT_EXERCISE, 73 + "Superman": DEFAULT_EXERCISE, 74 + "Handle Band Forward Raise": DEFAULT_EXERCISE, 75 + "Handle Band Squat": DEFAULT_EXERCISE, 76 + "Scissor Kick": DEFAULT_EXERCISE, 77 + "Dumbbell Squeeze Press": DEFAULT_EXERCISE, 78 + "Side Lunge": DEFAULT_EXERCISE, 79 + "Handle Band Rear Deltoid Fly": DEFAULT_EXERCISE, 80 + "Leg Pull-In": DEFAULT_EXERCISE, 81 + "Jump Rope": DEFAULT_EXERCISE, 82 + "Mini Loop Band Overhead Fly": DEFAULT_EXERCISE, 83 + "Mini Loop Band Lateral Shoulder Raise": DEFAULT_EXERCISE, 84 + "Handle Band Upright Row": DEFAULT_EXERCISE, 85 + "Handle Band Tricep Extension": DEFAULT_EXERCISE, 86 + "Handle Band Bicep Curl": DEFAULT_EXERCISE, 87 + "Seated Dumbbell Curl": DEFAULT_EXERCISE, 88 + "Alternating Dumbbell Bench Press": DEFAULT_EXERCISE, 89 + "Incline Tricep Push Up": DEFAULT_EXERCISE, 90 + "Mini Loop Band Kneeling Bicep Curl": DEFAULT_EXERCISE, 91 + "Leg Raise": DEFAULT_EXERCISE, 92 + "Oblique Crunch": DEFAULT_EXERCISE, 93 + "Mountain Climber": DEFAULT_EXERCISE, 94 + "Mini Loop Band Single Leg Romanian Deadlift with Row": DEFAULT_EXERCISE, 95 + "Walking Lunge": DEFAULT_EXERCISE, 96 + "Handle Band Bent Over Row": DEFAULT_EXERCISE, 97 + "Lunge Jump": DEFAULT_EXERCISE, 98 + "Handle Band Lat Pulldown": DEFAULT_EXERCISE, 99 + "Jackknife Sit-Up": DEFAULT_EXERCISE, 100 + "Cycling": DEFAULT_EXERCISE, 101 + "Single Arm Dumbbell Tricep Extension": DEFAULT_EXERCISE, 102 + "Dumbbell No Money Curls": DEFAULT_EXERCISE, 103 + "Flutter Kicks": DEFAULT_EXERCISE, 104 + "Dumbbell Lateral Raise": DEFAULT_EXERCISE, 105 + "Incline Push Up": DEFAULT_EXERCISE, 106 + "Kettlebell Upright Row": DEFAULT_EXERCISE, 107 + "Mini Loop Band Kneeling Row": DEFAULT_EXERCISE, 108 + "Air Squats": DEFAULT_EXERCISE, 107 109 };
+6 -5
generate-map.ts
··· 34 34 } 35 35 36 36 let fileContent = `// exercise-map.ts\n`; 37 - fileContent += `// Run generate-template-list.ts first, then fill in each value using HEVY_EXERCISES.KEY\n`; 38 - fileContent += `// e.g. "Running": HEVY_EXERCISES.RUNNING\n`; 39 - fileContent += `import { HEVY_EXERCISES } from './HEVY_EXERCISES.ts';\n\n`; 40 - fileContent += `export const EXERCISE_MAP: Record<string, string> = {\n`; 37 + fileContent += `// Run generate-template-list.ts first, then fill in each value using H.KEY\n`; 38 + fileContent += `// e.g. "Running": H.RUNNING\n`; 39 + fileContent += `import { HEVY_EXERCISES as H } from './HEVY_EXERCISES.ts';\n\n`; 40 + fileContent += `const DEFAULT_EXERCISE = undefined;\n\n`; 41 + fileContent += `export const EXERCISE_MAP: Record<string, string | undefined> = {\n`; 41 42 42 43 for (const ex of uniqueExercises) { 43 - fileContent += ` "${ex}": "",\n`; 44 + fileContent += ` "${ex}": DEFAULT_EXERCISE,\n`; 44 45 } 45 46 46 47 fileContent += `};\n`;