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

Update ubuntu.sh to install latest version of NodeJS #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

poojasonawane27
Copy link

Description of changes:
Install latest NodeJS, current code installs installs v12.22.9 which is not recommended to use.
Node recommends to use Node.js 14.17 and later. Ref: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-1.html#es2020-and-nodejs-1417-as-minimum-runtime-requirements

Commands taken from https://deb.nodesource.com/

Testing
Built the ubuntu docker image with these changes and verified the latest node version is installed

% docker run -it cc3a535a3f4dc5c44405d4b1cc0b1f97880c35abebdbcc1660ca7cdac3d3dd36 sh       
# npm -v
10.7.0
# node -v
v20.15.1
# npx -v
10.7.0

Executed a sample typescript task which was failing with previous version

import * as assert from 'assert';

const processArray = function(array: number[], startIndex?: number): number[] {
    const result: number[] = [];
    for (let i = startIndex ?? 0; i < array.length; i++) {
        result.push(array[i] * 2); 
    }
    return result;
};

// Test cases
let actual_1 = processArray([1, 2, 3, 4], 2);
let expected_1 = [6, 8]; 
assert.deepEqual(actual_1, expected_1, "Exception --- test case 1 failed to pass");

let actual_2 = processArray([1, 2, 3, 4]);
let expected_2 = [2, 4, 6, 8]; 
assert.deepEqual(actual_2, expected_2, "Exception --- test case 2 failed to pass");

console.log("All test cases passed.");

Results:

# npx tsc test3 --target es5 --lib es2016
# node test3.js
All test cases passed.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sk-g
Copy link
Member

sk-g commented Aug 7, 2024

@poojasonawane27 Thanks for your contribution! Could you please add an evaluation of the canonical solution file to show the evaluation changes one can expect after the nodejs version upgrade?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants