Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: report error and fail for unsupported NodeJS versions (#1984) #2111

Merged
merged 1 commit into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/cspell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"get-stdin": "^8.0.0",
"glob": "^7.2.0",
"imurmurhash": "^0.1.4",
"semver": "^7.3.5",
"strip-ansi": "^6.0.1",
"vscode-uri": "^3.0.2"
},
Expand All @@ -96,6 +97,7 @@
"@types/imurmurhash": "^0.1.1",
"@types/micromatch": "^4.0.2",
"@types/minimatch": "^3.0.5",
"@types/semver": "^7.3.9",
"jest": "^27.4.5",
"micromatch": "^4.0.4",
"minimatch": "^3.0.4",
Expand Down
8 changes: 8 additions & 0 deletions packages/cspell/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as commander from 'commander';
import * as path from 'path';
import * as semver from 'semver';
import { commandCheck } from './commandCheck';
import { commandLink } from './commandLink';
import { commandLint } from './commandLint';
import { commandTrace } from './commandTrace';
import { ApplicationError } from './util/errors';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const npmPackage = require(path.join(__dirname, '..', 'package.json'));

Expand All @@ -18,6 +20,12 @@ export async function run(program?: commander.Command, argv?: string[]): Promise

prog.version(npmPackage.version).description('Spelling Checker for Code').name('cspell');

if (!semver.satisfies(process.versions.node, npmPackage.engines.node)) {
throw new ApplicationError(
`Unsupported NodeJS version (${process.versions.node}); ${npmPackage.engines.node} is required`
);
}

commandLint(prog);
commandTrace(prog);
commandCheck(prog);
Expand Down