shlogg · Early preview
Ramu Narasinga @karthik-m22

Node Version Check In Father CLI: Ensuring Compatibility

checkNodeVersion() checks if node version is >= MIN_NODE_VERSION (except v15 or v17). If not, it logs an error and exits the process with code 1.

There’s a function named checkNodeVersion() in father/src/cli/cli.ts.

This cli file has a function named run and in there, it calls a series of functions:

export async function run(_opts?: IOpts) {
  checkNodeVersion();
  checkLocal();
  setNodeTitle();
  setNoDeprecation();
  ...
}

    
    

    
    




checkNodeVersion
checkLocal
setNodeTitle
setNoDepreciation

We are interested in checkNodeVersion()

  
  
  checkNodeVersion

checkNodeVersion is defined in cli/node.ts

export function checkVersion() {
  const v = parseInt(process.version.slice(1));
  if (v < MIN_NODE_VERSION || v ===...