Skip to content

Commit

Permalink
wp-now: avoid stopping wp-now for lower node versions (#37)
Browse files Browse the repository at this point in the history
- Closes #3

Shows a warning message and avoids stopping `wp-now` for Node versions lower than 18.
  • Loading branch information
sejas authored Jun 1, 2023
1 parent 8a73c11 commit ffa4ed3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/wp-now/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { runCli } from './run-cli';

const requiredMajorVersion = 18;

const currentNodeVersion = parseInt(process.versions.node.split('.')[0]);
const currentNodeVersion = parseInt(process.versions?.node?.split('.')?.[0]);

if (currentNodeVersion < requiredMajorVersion) {
console.error(
`You are running Node.js version ${currentNodeVersion}, but this application requires at least Node.js ${requiredMajorVersion}. Please upgrade your Node.js version.`
console.warn(
`You are running Node.js version ${currentNodeVersion}, but this application recommends at least Node.js ${requiredMajorVersion} and isn't guaranteed to work on lower versions. Please upgrade your Node.js version.`
);
process.exit(1);
}

runCli();

0 comments on commit ffa4ed3

Please sign in to comment.