All files / scripts check-node.mjs

0% Statements 0/19
0% Branches 0/1
0% Functions 0/1
0% Lines 0/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                                                 
#!/usr/bin/env node
 
const semver = (v) => v.split('.').map((n) => parseInt(n, 10));
 
const compare = (a, b) => {
  for (let i = 0; i < Math.max(a.length, b.length); i += 1) {
    const ai = a[i] || 0;
    const bi = b[i] || 0;
    if (ai > bi) return 1;
    if (ai < bi) return -1;
  }
  return 0;
};
 
const current = semver(process.versions.node);
const min = semver('20.19.0');
 
if (compare(current, min) < 0) {
  console.error(`❌ Version de Node trop ancienne: ${process.versions.node}. Requise: >= 20.19.0`);
  console.error('➡️  Utilisez nvm: nvm use 20 (ou installez: nvm install 20)');
  process.exit(1);
}
 
console.log(`✅ Node ${process.versions.node} OK (>= 20.19.0)`);