logo
Published on

Update Node Modules in CircleCI

Authors
  • avatar
    Name
    Bowen Y
    Twitter

Sometimes I will encounter weird issues and I would like to edit the code in third-party modules, for example, add info printing in libs in node_modules. What should I do?

I don't know if this is a good approach, but it can really help sometimes when I don't have the access to modify third party files but have to run tests in CircleCI.

I use sed to modify the code in node_modules and add a function to return a private property because I want to check if the right value is passed to the class.

    npm install

    sed -i '/\/\/ Query flight data/a \
    getHeader() {\
        return this.#headers\
    }\
    ' node_modules/lib-js-orx/src/client/client.js

    cat node_modules/lib-js-orx/src/client/client.js