Skip to content

Commit

Permalink
Drop support for Node.js 14 (#4447)
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck authored Nov 30, 2023
1 parent 96387c2 commit aea5200
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .cirrus/nodejs.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest

USER root

ARG NODE_VERSION=14
ARG NODE_VERSION=16

RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && apt-get install -y nodejs=${NODE_VERSION}.*

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"new-rule": "ts-node tools/newRule.ts",
"bridge:compile": "tsc -b packages profiling",
"bridge:test": "jest",
"bridge:test-with-coverage": "jest --maxWorkers=75% --coverage",
"bridge:test-with-coverage": "jest --maxWorkers=50% --coverage",
"bridge:build": "npm run bridge:build:fast && npm run bridge:test-with-coverage",
"bridge:build:fast": "npm ci && npm run format && npm run _:bridge:clear && npm run bridge:compile",
"bbf": "npm run bridge:build:fast",
Expand All @@ -37,7 +37,7 @@
},
"homepage": "https://github.com/SonarSource/SonarJS#readme",
"engines": {
"node": ">=14"
"node": "^16.0.0 || >=18.0.0"
},
"type": "commonjs",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion sonar-plugin/sonar-javascript-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
<!-- This is used to get plugin version at runtime using getPackage().getImplementationVersion() -->
<Implementation-Version>${project.version}</Implementation-Version>
<!-- Keep in sync with NodeDeprecationWarning#MIN_SUPPORTED_NODE_VERSION -->
<NodeJs-Min-Version>14.17.0</NodeJs-Min-Version>
<NodeJs-Min-Version>16.0.0</NodeJs-Min-Version>
</manifestEntries>
</transformer>
</transformers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@
public class NodeDeprecationWarning {

static final Map<Integer, String> REMOVAL_DATE = Map.ofEntries(
entry(14, "May 1st, 2023"),
entry(15, "May 1st, 2023"),
entry(16, "Nov 30th, 2023"),
entry(17, "Nov 30th, 2023")
entry(16, "Jan 31th, 2024"),
entry(17, "Jan 31th, 2024")
);

private static final Logger LOG = Loggers.get(NodeDeprecationWarning.class);
Expand All @@ -56,10 +54,10 @@ public class NodeDeprecationWarning {
* The minor version is a requirement from the ESLint version that the bridge uses.
* @see https://github.com/eslint/eslint/blob/d75d3c68ad8c98828aaa522b87ec267ab2dcb002/package.json#L169
*/
static final Version MIN_SUPPORTED_NODE_VERSION = Version.create(14, 17, 0);
static final Version MIN_SUPPORTED_NODE_VERSION = Version.create(16, 0, 0);
static final int MIN_RECOMMENDED_NODE_VERSION = 18;
static final List<Integer> RECOMMENDED_NODE_VERSIONS = Arrays.asList(18, 20);
static final List<Integer> ALL_RECOMMENDED_NODE_VERSIONS = Arrays.asList(14, 16, 18, 20);
static final List<Integer> ALL_RECOMMENDED_NODE_VERSIONS = Arrays.asList(16, 18, 20);
private final AnalysisWarningsWrapper analysisWarnings;

public NodeDeprecationWarning(AnalysisWarningsWrapper analysisWarnings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ key: javascript
## Prerequisites

In order to analyze JavaScript, TypeScript or CSS code, you need to have supported version of Node.js installed on the
machine running the scan. The recommended versions are v16 and v18. We recommend using the [active LTS version of Node.js](https://nodejs.org/en/about/releases/) for optimal stability and performance. +v14.17.0 is still supported, but it already reached end-of-life and
machine running the scan. We recommend using the [active LTS version of Node.js](https://nodejs.org/en/about/releases/) for optimal stability and performance, which is currently v20 or v18. v16 is still supported, but it already reached end-of-life and
is deprecated.

If `node` is not available in the PATH, you can use property `sonar.nodejs.executable` to set an absolute path to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,26 @@ public void addUnique(String text) {
TestAnalysisWarnings analysisWarnings = new TestAnalysisWarnings();
NodeDeprecationWarning deprecationWarning = new NodeDeprecationWarning(analysisWarnings);

@Test
void test_14() {
deprecationWarning.logNodeDeprecation(14);
assertWarnings(
"Using Node.js version 14 to execute analysis is deprecated and will stop being supported no earlier than May 1st, 2023. " +
"Please upgrade to a newer LTS version of Node.js [18, 20]"
);
}

@Test
void test_recommended() {
deprecationWarning.logNodeDeprecation(18);
deprecationWarning.logNodeDeprecation(20);
assertWarnings();
}

@Test
void test_15() {
deprecationWarning.logNodeDeprecation(15);
assertWarnings(
"Using Node.js version 15 to execute analysis is deprecated and will stop being supported no earlier than May 1st, 2023. Please upgrade to a newer LTS version of Node.js [18, 20]",
"Node.js version 15 is not recommended, you might experience issues. Please use a recommended version of Node.js [18, 20]"
);
}

@Test
void test_16() {
deprecationWarning.logNodeDeprecation(16);
assertWarnings(
"Using Node.js version 16 to execute analysis is deprecated and will stop being supported no earlier than Nov 30th, 2023. Please upgrade to a newer LTS version of Node.js [18, 20]"
"Using Node.js version 16 to execute analysis is deprecated and will stop being supported no earlier than Jan 31th, 2024. Please upgrade to a newer LTS version of Node.js [18, 20]"
);
}

@Test
void test_17() {
deprecationWarning.logNodeDeprecation(17);
assertWarnings(
"Using Node.js version 17 to execute analysis is deprecated and will stop being supported no earlier than Nov 30th, 2023. Please upgrade to a newer LTS version of Node.js [18, 20]",
"Using Node.js version 17 to execute analysis is deprecated and will stop being supported no earlier than Jan 31th, 2024. Please upgrade to a newer LTS version of Node.js [18, 20]",
"Node.js version 17 is not recommended, you might experience issues. Please use a recommended version of Node.js [18, 20]"
);
}
Expand Down

0 comments on commit aea5200

Please sign in to comment.