Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possibility of trolling inside npm of node.js script

I wanted to know why my npm was only working trough the full path /usr/bin/npm and openned the code for npm and just found a weird song lyrics inside. Heres the code inside. It actually works trough the full path, but i'm worried about it being just someone the sent a node

    npm.commands[npm.command](npm.argv, function (err) {
      // https://genius.com/Lin-manuel-miranda-your-obedient-servant-lyrics
      if (
        !err &&
        npm.config.get('ham-it-up') &&
        !npm.config.get('json') &&
        !npm.config.get('parseable') &&
        npm.command !== 'completion'
      ) {
        console.error(
          `\n ${
            npm.config.get('unicode') ? '🎵 ' : ''
          } I Have the Honour to Be Your Obedient Servant,${
            npm.config.get('unicode') ? '🎵 ' : ''
          } ~ npm ${
            npm.config.get('unicode') ? '📜🖋 ' : ''
          }\n`
        )
      }
      errorHandler.apply(this, arguments)
    })
  })
})()
like image 546
DogoLendario Shiba Inu-sama To Avatar asked Oct 01 '18 11:10

DogoLendario Shiba Inu-sama To


Video Answer


1 Answers

This is en easter egg inside npm code, see here and here.

$ echo 'ham-it-up=true' > ~/.npmrc
$ npm help
... < help message > ...

 🎵  I Have the Honour to Be Your Obedient Servant,🎵  ~ npm 📜🖋 
like image 163
KamilCuk Avatar answered Nov 07 '22 04:11

KamilCuk