Skip to content

Commit 661cf61

Browse files
committed
Add edge case check in preFlightChecks
1 parent d3b8014 commit 661cf61

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

packages/cli/src/util/preFlightChecks.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ import * as logger from './logger.js';
33
import packageJson from '../../package.json' with { type: 'json' };
44

55
const CLI_VERSION = packageJson.version;
6+
const REQUIRED_NODE_VERSION = '22.12.0';
67

78
function checkNode() {
89
const nodeVersion = process.version;
9-
const version = nodeVersion.slice(1);
10+
const version = semver.coerce(nodeVersion);
1011

11-
if (semver.lt(version, '22.12.0')) {
12+
if (version === null) {
13+
logger.warn('Unknown version of node detected.');
14+
return;
15+
}
16+
if (semver.lt(version, REQUIRED_NODE_VERSION)) {
1217
logger.error(
13-
`Markbind ${CLI_VERSION} requires Node >=22.12.0. `
14-
+ 'Please update Node or use an older version of MarkBind!'
18+
`Markbind ${CLI_VERSION} requires node >=${REQUIRED_NODE_VERSION}. `
19+
+ 'Please update node or use an older version of Markbind!',
1520
);
1621
process.exit(1);
1722
}

0 commit comments

Comments
 (0)