Analyze npm dependencies in XM Cloud projects
Analyzes npm dependencies in XM Cloud projects for version alignment, security vulnerabilities, and compatibility issues.
/plugin marketplace add twofoldtech-dakota/claude-marketplace/plugin install twofoldtech-dakota-xm-cloud-analyzer-plugins-xm-cloud-analyzer@twofoldtech-dakota/claude-marketplaceAnalyze npm package compatibility, security vulnerabilities, and JSS version alignment.
Verify all @sitecore-jss/* packages are the same version:
{
"dependencies": {
"@sitecore-jss/sitecore-jss-nextjs": "22.0.0",
"@sitecore-jss/sitecore-jss-dev-tools": "22.0.0",
"@sitecore-jss/sitecore-jss": "22.0.0"
}
}
Flag if versions mismatch:
{
"@sitecore-jss/sitecore-jss-nextjs": "22.0.0",
"@sitecore-jss/sitecore-jss-dev-tools": "21.6.0" // Mismatch!
}
Run npm audit:
npm audit --json
Check Next.js version vs JSS requirements:
| JSS Version | Next.js Support |
|---|---|
| 21.x | 13.x |
| 22.x | 13.x, 14.x |
Check for deprecated packages:
| Deprecated | Replacement |
|---|---|
| @sitecore-jss/sitecore-jss-tracking | Built into core |
| node-fetch | Native fetch (Node 18+) |
| moment | date-fns |
Verify React version matches Next.js requirements:
{
"next": "14.2.0",
"react": "18.2.0", // Must be 18.x for Next.js 14
"react-dom": "18.2.0"
}
Identify large dependencies:
| Package | Size | Impact |
|---|---|---|
| moment | ~300KB | High |
| lodash | ~70KB | Medium |
| date-fns | ~20KB (tree-shakeable) | Low |
Check TypeScript compatibility:
{
"typescript": "5.x", // Should match project requirements
"next": "14.x" // Next.js 14 works best with TS 5.x
}
Check for peer dependency warnings:
npm ls --all
| Code | Severity | Issue | Detection |
|---|---|---|---|
| DEP-001 | Critical | Security vulnerability | npm audit high/critical |
| DEP-002 | Critical | JSS version mismatch | Different versions of @sitecore-jss/* |
| DEP-003 | Warning | Outdated Next.js | Major version behind latest |
| DEP-004 | Warning | Deprecated package | Package in deprecated list |
| DEP-005 | Warning | Large dependency | Package >100KB not tree-shakeable |
| DEP-006 | Info | Package update available | Minor/patch updates pending |
| DEP-007 | Info | Peer dependency warning | Unmet peer dependency |
Read: package.json
Extract all dependencies and devDependencies
Filter @sitecore-jss/* packages
Compare all versions
Flag mismatches
npm audit --json 2>/dev/null
Parse for high and critical vulnerabilities.
npm outdated --json 2>/dev/null
Check known large packages:
- moment, moment-timezone
- lodash (not lodash-es)
- @mui/material (if not tree-shaken)
- chart.js
Check:
- Next.js version vs JSS requirements
- React version vs Next.js requirements
- TypeScript version vs Next.js requirements
## Dependencies Analysis
### Summary
- **Total Dependencies**: 45
- **Dev Dependencies**: 23
- **JSS Version**: 22.0.0
- **Next.js Version**: 14.2.0
### Critical Issues
#### [DEP-001] Security Vulnerability
**Package**: axios@0.21.1
**Severity**: High
**Vulnerability**: CVE-2023-XXXXX - Server-Side Request Forgery
**Fix**:
```bash
npm install axios@1.6.0
Issue: Inconsistent @sitecore-jss/* versions Packages:
{
"@sitecore-jss/sitecore-jss-nextjs": "22.0.0",
"@sitecore-jss/sitecore-jss-dev-tools": "21.6.0" // ← Mismatch
}
Impact: Potential runtime errors, inconsistent behavior Fix:
npm install @sitecore-jss/sitecore-jss-dev-tools@22.0.0
Package: node-fetch@2.6.7 Issue: Deprecated in favor of native fetch (Node 18+) Fix: Use native fetch or update to node-fetch@3.x
Package: moment@2.29.4 Size: ~300KB (not tree-shakeable) Impact: Significant bundle size increase Alternative: date-fns (~20KB, tree-shakeable)
| Category | Count | Issues |
|---|---|---|
| @sitecore-jss/* | 4 | 1 |
| React/Next.js | 5 | 0 |
| TypeScript | 3 | 0 |
| Utilities | 15 | 2 |
| Other | 18 | 1 |
| Package | Current | Latest | Type |
|---|---|---|---|
| next | 14.1.0 | 14.2.0 | Minor |
| typescript | 5.2.0 | 5.4.0 | Minor |
| eslint | 8.50.0 | 8.57.0 | Minor |
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences