Skip to content

Commit

Permalink
383024578 Upgrade supported Node versions to 18,20,22
Browse files Browse the repository at this point in the history
 - Remove support for Node v16
 - Fix CVE-2024-45590 vulnerability
  • Loading branch information
tapasthakkar authored and keyurkarnik committed Dec 24, 2024
1 parent 4810c5f commit fa5ddee
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
21 changes: 12 additions & 9 deletions cli/edgemicro
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,35 @@
var edgemicroVersion = require('../package.json').version;
const writeConsoleLog = require('microgateway-core').Logging.writeConsoleLog;
const version = process.version;
const ltsVersion = 16;
const experimental = ["v15","v17","v19"];
const latest = 20;
const ltsVersion = 18;
const experimental = ["v19", "v21"];
const latest = 22;

const CONSOLE_LOG_TAG_COMP = 'microgateway edgemicro';

// Add the --no-deprecation flag to NODE_OPTIONS
process.env.NODE_OPTIONS = (process.env.NODE_OPTIONS || '') + ' --no-deprecation';

//don't print versions when obtaining a token.
if (!process.argv.includes("token") && !process.argv.includes("get")) {
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},'current nodejs version is %s', version);
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},'current edgemicro version is %s', edgemicroVersion);
writeConsoleLog('log', { component: CONSOLE_LOG_TAG_COMP }, 'current nodejs version is %s', version);
writeConsoleLog('log', { component: CONSOLE_LOG_TAG_COMP }, 'current edgemicro version is %s', edgemicroVersion);
}

for (var ver in experimental) {
if (version.includes(experimental[ver])) {
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},"You are using a version of NodeJS that is not supported");
writeConsoleLog('log', { component: CONSOLE_LOG_TAG_COMP }, "You are using a version of NodeJS that is not supported");
return;
}
}
var majorVersion = parseInt(version.split(".")[0].replace("v", ""));

if (majorVersion == 16) {
writeConsoleLog('log', {component: CONSOLE_LOG_TAG_COMP},'\x1b[33m%s\x1b[0m',`Current Node.js version is ${version}. Note, v16.x.x will be out of support soon, see https://docs.apigee.com/release/notes/edge-microgateway-release-notes-0`);
if (majorVersion == 18) {
writeConsoleLog('log', { component: CONSOLE_LOG_TAG_COMP }, '\x1b[33m%s\x1b[0m', `Current Node.js version is ${version}. Note, v18.x.x will be out of support soon, see https://docs.apigee.com/release/notes/edge-microgateway-release-notes-0`);
}

if (majorVersion < ltsVersion || majorVersion > latest) {
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},"You are using a version of NodeJS that is not supported");
writeConsoleLog('log', { component: CONSOLE_LOG_TAG_COMP }, "You are using a version of NodeJS that is not supported");
return;
} else {
require('./cmd')()
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const isWin = /^win/.test(process.platform);
const ipcPath = configLocations.getIPCFilePath();
const pidPath = configLocations.getPIDFilePath();
const defaultPollInterval = 600;
const uuid = require('uuid/v1');
const { v4: uuid } = require('uuid');
const debug = require('debug')('microgateway');
const jsdiff = require('diff');
const _ = require('lodash');
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
},
"dependencies": {
"async": "^2.6.4",
"body-parser": "^1.19.0",
"body-parser": "^1.20.3",
"cli-prompt": "^0.5.0",
"commander": "^2.9.0",
"config": "^3.3.9",
"cpr": "^1.1.2",
"debug": "^3.1.0",
"diff": "^3.4.0",
"dotenv": "^8.0.0",
"fs-extra": "^0.20.1",
"js-yaml": "^3.5.4",
"jsonwebtoken": "^9.0.1",
"lodash": "^4.17.19",
Expand All @@ -28,24 +27,24 @@
"microgateway-plugins": "^3.3.4",
"pem": "^1.8.1",
"portastic": "^1.0.1",
"postman-request": "^2.88.1-postman.33",
"postman-request": "^2.88.1-postman.40",
"rimraf": "^2.4.3",
"tmp": "0.0.28",
"uuid": "^3.2.1",
"uuid": "^11.0.3",
"volos-cache-memory": "^0.10.1",
"volos-spikearrest-common": "^0.10.4",
"volos-spikearrest-memory": "^0.10.2",
"volos-util-apigee": "^0.1.2",
"xml2js": "^0.5.0"
},
"devDependencies": {
"eslint": "^8.44.0",
"eslint": "^8.56.0",
"eslint-config-google": "^0.13.0",
"jshint-stylish": "^2.2.1",
"minimist": "^1.2.6",
"mocha": "^9.2.0",
"mocha": "^11.0.1",
"nyc": "^15.1.0",
"restify": "^11.1.0",
"restify": "^9.0.1",
"rewire": "^6.0.0",
"test-until": "^1.1.1"
},
Expand Down Expand Up @@ -85,11 +84,11 @@
],
"author": "Kevin Swiber <[email protected]>",
"engines": {
"node": "^16 || ^18 || ^20",
"node": "^18 || ^20 || ^22",
"npm": ">=8.19.3"
},
"cpu": [
"!arm",
"!mips"
]
}
}

0 comments on commit fa5ddee

Please sign in to comment.