Skip to content

Commit ed63bde

Browse files
authored
Merge pull request #8 from SalesforceCommerceCloud/introduceCommerceApps
Introduce Commerce Apps
2 parents c82333d + 026411f commit ed63bde

59 files changed

Lines changed: 13211 additions & 59 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
---
2+
name: compare-app-versions
3+
description: >-
4+
Compare two versions of a commerce app to see what changed. Highlights file additions,
5+
deletions, and modifications between versions. Useful for code review, understanding
6+
updates, and generating changelogs. Use when reviewing version updates or investigating changes.
7+
---
8+
9+
# Compare App Versions
10+
11+
Compare two versions of a commerce app to identify what changed between releases.
12+
13+
## Step 1: Identify versions to compare
14+
15+
Gather information:
16+
- App domain and name (e.g., `tax/avalara-tax`)
17+
- Old version (e.g., `0.2.7`)
18+
- New version (e.g., `0.2.8`)
19+
20+
Verify both ZIPs exist:
21+
```bash
22+
ls -lh <domain>/<isv-name>/<appName>-v<oldVersion>.zip
23+
ls -lh <domain>/<isv-name>/<appName>-v<newVersion>.zip
24+
```
25+
26+
## Step 2: Extract both versions
27+
28+
Extract both versions for comparison:
29+
30+
```bash
31+
cd <domain>/<isv-name>/
32+
33+
# Extract old version
34+
unzip -q <appName>-v<oldVersion>.zip
35+
36+
# Extract new version
37+
unzip -q <appName>-v<newVersion>.zip
38+
```
39+
40+
This creates:
41+
- `commerce-<appName>-app-v<oldVersion>/`
42+
- `commerce-<appName>-app-v<newVersion>/`
43+
44+
## Step 3: High-level file comparison
45+
46+
Compare directory structures:
47+
48+
```bash
49+
# List files in both versions
50+
find commerce-<appName>-app-v<oldVersion>/ -type f | sort > /tmp/old_files.txt
51+
find commerce-<appName>-app-v<newVersion>/ -type f | sort > /tmp/new_files.txt
52+
53+
# Show what changed at file level
54+
diff /tmp/old_files.txt /tmp/new_files.txt
55+
```
56+
57+
**Look for:**
58+
- Files added (lines starting with `>`)
59+
- Files removed (lines starting with `<`)
60+
- Changed file count
61+
62+
## Step 4: Compare key configuration files
63+
64+
### Compare commerce-app.json
65+
66+
```bash
67+
diff -u commerce-<appName>-app-v<oldVersion>/commerce-app.json \
68+
commerce-<appName>-app-v<newVersion>/commerce-app.json
69+
```
70+
71+
**Check for:**
72+
- Version number change (expected)
73+
- Dependency updates
74+
- Publisher information changes
75+
- New or removed fields
76+
77+
### Compare package.json
78+
79+
```bash
80+
diff -u commerce-<appName>-app-v<oldVersion>/cartridges/*/package.json \
81+
commerce-<appName>-app-v<newVersion>/cartridges/*/package.json
82+
```
83+
84+
**Check for:**
85+
- Dependency version bumps
86+
- New dependencies
87+
- Script changes
88+
- DevDependency updates
89+
90+
### Compare hooks.json
91+
92+
```bash
93+
diff -u commerce-<appName>-app-v<oldVersion>/cartridges/*/cartridge/scripts/hooks.json \
94+
commerce-<appName>-app-v<newVersion>/cartridges/*/cartridge/scripts/hooks.json
95+
```
96+
97+
**Check for:**
98+
- New hooks added
99+
- Hook script path changes
100+
- Removed hooks
101+
102+
### Compare services.xml
103+
104+
```bash
105+
diff -u commerce-<appName>-app-v<oldVersion>/impex/install/services.xml \
106+
commerce-<appName>-app-v<newVersion>/impex/install/services.xml
107+
```
108+
109+
**Check for:**
110+
- Service configuration changes
111+
- New service endpoints
112+
- Credential structure changes
113+
114+
## Step 5: Detailed code comparison
115+
116+
Compare source code directories:
117+
118+
```bash
119+
# Compare all JavaScript files
120+
diff -r commerce-<appName>-app-v<oldVersion>/cartridges/ \
121+
commerce-<appName>-app-v<newVersion>/cartridges/ \
122+
--exclude="node_modules" --exclude="*.log"
123+
```
124+
125+
For better visualization, use git diff style:
126+
```bash
127+
# Create a temporary git repo for diffing
128+
cd commerce-<appName>-app-v<oldVersion>/
129+
git init
130+
git add .
131+
git commit -m "Old version"
132+
133+
# Copy new files over
134+
cp -r ../commerce-<appName>-app-v<newVersion>/* .
135+
136+
# Show diff
137+
git diff
138+
```
139+
140+
## Step 6: Generate comparison report
141+
142+
Create a structured comparison report:
143+
144+
```markdown
145+
## Version Comparison Report
146+
147+
**App:** <displayName>
148+
**Old Version:** v<oldVersion>
149+
**New Version:** v<newVersion>
150+
**Comparison Date:** <current_date>
151+
152+
### Summary of Changes
153+
154+
**Files Modified:** <count>
155+
**Files Added:** <count>
156+
**Files Deleted:** <count>
157+
**Total Files:** <old_count> → <new_count>
158+
159+
### Configuration Changes
160+
161+
#### commerce-app.json
162+
- Version: <oldVersion> → <newVersion>
163+
- [List other changes if any]
164+
165+
#### Dependencies
166+
- [List dependency updates from package.json]
167+
168+
#### Hooks
169+
- [List new/modified/removed hooks from hooks.json]
170+
171+
#### Services
172+
- [List service configuration changes from services.xml]
173+
174+
### Code Changes
175+
176+
#### Modified Files
177+
<list files with brief description of changes>
178+
179+
#### New Files
180+
<list newly added files>
181+
182+
#### Deleted Files
183+
<list removed files>
184+
185+
### Breaking Changes
186+
<list any breaking changes found>
187+
188+
### Security Considerations
189+
<note any security-relevant changes>
190+
191+
### Recommendations
192+
<suggestions for reviewers or deployers>
193+
```
194+
195+
## Step 7: Focused comparisons
196+
197+
### Compare specific file types
198+
199+
**JavaScript files only:**
200+
```bash
201+
diff -ur commerce-<appName>-app-v<oldVersion>/cartridges/ \
202+
commerce-<appName>-app-v<newVersion>/cartridges/ \
203+
--include="*.js"
204+
```
205+
206+
**JSON files only:**
207+
```bash
208+
diff -ur commerce-<appName>-app-v<oldVersion>/ \
209+
commerce-<appName>-app-v<newVersion>/ \
210+
--include="*.json"
211+
```
212+
213+
**XML files only:**
214+
```bash
215+
diff -ur commerce-<appName>-app-v<oldVersion>/impex/ \
216+
commerce-<appName>-app-v<newVersion>/impex/ \
217+
--include="*.xml"
218+
```
219+
220+
### Compare file sizes
221+
222+
Check if any files grew or shrank significantly:
223+
224+
```bash
225+
# Compare file sizes
226+
find commerce-<appName>-app-v<oldVersion>/ -type f -exec wc -c {} \; | sort > /tmp/old_sizes.txt
227+
find commerce-<appName>-app-v<newVersion>/ -type f -exec wc -c {} \; | sort > /tmp/new_sizes.txt
228+
229+
diff /tmp/old_sizes.txt /tmp/new_sizes.txt
230+
```
231+
232+
Large size changes might indicate:
233+
- Added/removed dependencies
234+
- New features or removed code
235+
- Added assets or documentation
236+
237+
## Step 8: Semantic comparison
238+
239+
Look for specific types of changes:
240+
241+
### API changes
242+
```bash
243+
# Search for function definitions in old version
244+
grep -rn "function\|module.exports" commerce-<appName>-app-v<oldVersion>/cartridges/
245+
246+
# Compare with new version
247+
grep -rn "function\|module.exports" commerce-<appName>-app-v<newVersion>/cartridges/
248+
```
249+
250+
### Configuration changes
251+
```bash
252+
# Compare all configuration files
253+
diff -r commerce-<appName>-app-v<oldVersion>/app-configuration/ \
254+
commerce-<appName>-app-v<newVersion>/app-configuration/
255+
```
256+
257+
### Test changes
258+
```bash
259+
# Compare test files
260+
diff -r commerce-<appName>-app-v<oldVersion>/cartridges/*/test/ \
261+
commerce-<appName>-app-v<newVersion>/cartridges/*/test/
262+
```
263+
264+
## Step 9: Side-by-side comparison
265+
266+
For visual comparison, use side-by-side diff:
267+
268+
```bash
269+
diff -y commerce-<appName>-app-v<oldVersion>/commerce-app.json \
270+
commerce-<appName>-app-v<newVersion>/commerce-app.json
271+
```
272+
273+
Or use a diff tool:
274+
```bash
275+
# macOS
276+
opendiff commerce-<appName>-app-v<oldVersion>/ \
277+
commerce-<appName>-app-v<newVersion>/
278+
279+
# Linux with meld
280+
meld commerce-<appName>-app-v<oldVersion>/ \
281+
commerce-<appName>-app-v<newVersion>/
282+
```
283+
284+
## Step 10: Clean up after comparison
285+
286+
**Always** remove extracted directories after comparison:
287+
288+
```bash
289+
cd <domain>/<isv-name>/
290+
rm -rf commerce-<appName>-app-v<oldVersion>/
291+
rm -rf commerce-<appName>-app-v<newVersion>/
292+
rm /tmp/old_files.txt /tmp/new_files.txt
293+
```
294+
295+
**IMPORTANT:**
296+
- Extracted directories should NEVER be committed to the repository
297+
- They are for comparison and inspection only
298+
- Only ZIP and catalog.json belong in the app directory
299+
- Root manifest (commerce-apps-manifest/manifest.json) must be updated separately
300+
- Always verify with `git status` that no extracted directories are staged
301+
302+
## Use cases
303+
304+
### Use case 1: PR Review
305+
Compare versions to understand what changed in a PR before approving.
306+
307+
### Use case 2: Changelog Generation
308+
Generate a changelog by comparing versions and documenting changes.
309+
310+
### Use case 3: Regression Investigation
311+
Compare versions to find what changed that might have caused a regression.
312+
313+
### Use case 4: Migration Planning
314+
Compare versions to plan migration steps and identify breaking changes.
315+
316+
### Use case 5: Learning
317+
Compare versions of reference apps to learn best practices and patterns.
318+
319+
## Quick comparison commands
320+
321+
**Quick file count:**
322+
```bash
323+
find commerce-<appName>-app-v<oldVersion>/ -type f | wc -l
324+
find commerce-<appName>-app-v<newVersion>/ -type f | wc -l
325+
```
326+
327+
**Quick size comparison:**
328+
```bash
329+
du -sh commerce-<appName>-app-v<oldVersion>/
330+
du -sh commerce-<appName>-app-v<newVersion>/
331+
```
332+
333+
**Quick code diff (summary only):**
334+
```bash
335+
diff -rq commerce-<appName>-app-v<oldVersion>/ \
336+
commerce-<appName>-app-v<newVersion>/ \
337+
--exclude="node_modules"
338+
```
339+
340+
## Comparison checklist
341+
342+
- [ ] Both versions extracted successfully
343+
- [ ] File structure comparison completed
344+
- [ ] Configuration files compared (commerce-app.json, package.json, hooks.json)
345+
- [ ] Code changes identified and reviewed
346+
- [ ] New/deleted files documented
347+
- [ ] Breaking changes identified
348+
- [ ] Security implications considered
349+
- [ ] Report generated (if needed)
350+
- [ ] Extracted directories cleaned up
351+
352+
## Tips for effective comparisons
353+
354+
1. **Start high-level** - File counts and structure before diving into code
355+
2. **Focus on what matters** - Prioritize hooks, services, and business logic
356+
3. **Ignore noise** - Skip generated files, logs, and dependencies
357+
4. **Document findings** - Create a report for future reference
358+
5. **Use visual tools** - GUI diff tools are great for detailed code review
359+
6. **Test before and after** - If possible, test both versions to validate changes

0 commit comments

Comments
 (0)