From be52779bbc94a5cb81743103dbed2180582a535d Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Mon, 19 Nov 2018 13:27:38 +0900 Subject: [PATCH] Use descriptive variables to improve readability (#3318) --- src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2054fd696d..742b140452 100644 --- a/src/index.ts +++ b/src/index.ts @@ -103,6 +103,10 @@ async function workerMain() { } } +const runningNodejsVersion = process.version.slice(1).split('.').map(x => parseInt(x, 10)); +const requiredNodejsVersion = [10, 0, 0]; +const satisfyNodejsVersion = !lessThan(runningNodejsVersion, requiredNodejsVersion); + /** * Init app */ @@ -110,9 +114,10 @@ async function init(): Promise { Logger.info('Welcome to Misskey!'); Logger.info(`<<< Misskey v${pkg.version} >>>`); - new Logger('Nodejs').info(`Version ${process.version}`); - if (lessThan(process.version.slice(1).split('.').map(x => parseInt(x, 10)), [10, 0, 0])) { - new Logger('Nodejs').error(`Node.js version is less than 10.0.0. Please upgrade it.`); + new Logger('Nodejs').info(`Version ${runningNodejsVersion.join('.')}`); + + if (!satisfyNodejsVersion) { + new Logger('Nodejs').error(`Node.js version is less than ${requiredNodejsVersion.join('.')}. Please upgrade it.`); process.exit(1); }