Skip to content

Commit

Permalink
Error on incompatible node version (#1867)
Browse files Browse the repository at this point in the history
* error if node too old

* fixes #1678
  • Loading branch information
YaroShkvorets authored Dec 19, 2024
1 parent 71df00e commit f979e55
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-badgers-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': patch
---

error out if node is too old
10 changes: 10 additions & 0 deletions packages/cli/bin/run.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/usr/bin/env node
import process from 'node:process';
import semver from 'semver';
import { execute } from '@oclif/core';
import { nodeVersion } from '../dist/version.js';

if (!semver.satisfies(process.version, nodeVersion)) {
process.stderr.write(
`Node.js version ${nodeVersion} is required. Current version: ${process.version}\n`,
);
process.exit(1);
}

await execute({ dir: import.meta.url });
1 change: 1 addition & 0 deletions packages/cli/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ const packageJson = JSON.parse(
);

export const version = packageJson.version as string;
export const nodeVersion = (packageJson.engines?.node ?? '') as string;

0 comments on commit f979e55

Please sign in to comment.