Skip to content

Support arbitrary node.js runtime versions #40

@lexor90

Description

@lexor90

Hello,
as discussed already in other issues I think nodec should be able to compile using a user defined node version among whose supported by the applied patches.

I didn't have any chance to test the patches with the v6.x, v7.x and v8.x but since those were versions supported by nodec itself I guess we should have some sort of support for them (by the way I'd really like to add some tests against regressions).

Patches have evolved while also upgrading the supported node version, so I think we should still be able to verify the patches apply properly and that node.js retains its functionalities after those patches are applied.

My purpose is to:

  • add a --node-version=7.0.0 flag to the nodec binary (or --runtime, but I think node-version is more user-friendly) and keep the latest nodejs version (or maybe the LTS) as the default
  • alter the ruby script (compiler) to
    • download source from the original nodejs.org website (https://nodejs.org/download/release/)
    • checksum the downloaded tar file to guard against tampering or network errors since the build will be used in production
    • extract the source code
    • apply the patches to node core (by using the system diff or some ruby gem)
    • ideally, check there was no regression after patching (e.g. run the nodejs test suite)
    • compile the node project

I'd really like to avoid what other similar tools do that is to download the detected (current-system) node version: it's ugly, annoying for nvm users, error prone and furthermore in a CI/CD environment one may need to skip this (and using nvm to workaround this might get complicated as nvm is hard to be used in some shell scripts). Also I don't think there's really some logical reason one should assume that I want my local node version on my servers.

I already started to work and implemented the flag and the download part, but I'm not sure how would you like to distribute the patch: do you want to place a .patch file inside this repo?
I'd avoid to keep the expanded source code under node/ because it could lead to unwanted patching (e.g. files modified from one version to another would be modified, and we would need to declare what files to pick explicitly, which may still get unwanted modifications.

I'd like to know your thoughts about it @pmq20

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions