From 5a8425387aed7de2e4e16f20f805f327565d02ee Mon Sep 17 00:00:00 2001 From: robinmoisson Date: Tue, 18 Apr 2023 23:14:06 +0200 Subject: [PATCH] display an error when node version is < 16 --- cli/index.js | 9 +++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cli/index.js b/cli/index.js index 47cac18..3c1a53d 100755 --- a/cli/index.js +++ b/cli/index.js @@ -2,7 +2,12 @@ "use strict"; -const fs = require("fs"); +// check node version before anything else +const nodeVersion = process.versions.node.split("."); +if (nodeVersion[0] < 16) { + console.log("ERROR: Node version 16 or higher is required."); + process.exit(1); +} // parse .env file into process.env require('dotenv').config(); @@ -11,7 +16,7 @@ const cryptoEngine = require("../lib/cryptoEngine.js"); const codec = require("../lib/codec.js"); const { generateRandomSalt } = cryptoEngine; const { encode } = codec.init(cryptoEngine); -const { parseCommandLineArguments, buildStaticryptJS, isOptionSetByUser, genFile, getPassword, getFileContent, getSalt, +const { parseCommandLineArguments, buildStaticryptJS, isOptionSetByUser, genFile, getFileContent, getValidatedSalt, getValidatedPassword, getConfig, writeConfig } = require("./helpers.js"); diff --git a/package-lock.json b/package-lock.json index cfc2754..dc659ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "staticrypt", - "version": "3.1.0", + "version": "3.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "staticrypt", - "version": "3.1.0", + "version": "3.1.1", "license": "MIT", "dependencies": { "dotenv": "^16.0.3", diff --git a/package.json b/package.json index 1bf5f7b..de040ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "staticrypt", - "version": "3.1.0", + "version": "3.1.1", "description": "Based on the [crypto-js](https://github.com/brix/crypto-js) library, StatiCrypt uses AES-256 to encrypt your input with your passphrase and put it in a HTML file with a password prompt that can decrypted in-browser (client side).", "main": "index.js", "files": [