Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Grep package.json dependency versions and interpolate them in a MakeFile

I am trying to get the current dependencies and devDependencies versions that are set in the package.json file so that when the MakeFile is run for a new user, it installs the versions listed there and not just the latest version. So for the example below, instead of just saying npm install @applitools/eyes-testcafe we would grab the version 1.16.1 from the package.json and interpolate it there in the MakeFile like ${eyes_version} or something like that.

Any idea on how to do this? Thanks!

package.json

"devDependencies": {
        "@applitools/eyes-testcafe": "^1.16.1",
        "testcafe": "^1.18.6",
        "testcafe-reporter-xunit": "*"
}

MakeFile

install-testcafe: npm ffmpeg applitools testcafe

# Installs all dependencies necessary for testcafe and node to run.
npm:
    npm install

# Installs the ffmpeg video recorder. This is recursive as sometimes it doesn't install automatically.
ffmpeg:
    npm install @ffmpeg-installer/ffmpeg

# Installs the applitools dependency. This is recursive as sometimes it doesn't install automatically.
applitools:
    npm install @applitools/eyes-testcafe

# Installs TestCafe globally. This is recursive as sometimes it doesn't install automatically.
testcafe:
    sudo npm install -g testcafe
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Since you are using jq,

jq '.devDependencies["@applitools/eyes-testcafe"]' package.json

Is it useful?

I question the validity/usefulness of using a Make wrapper around NPM. You're wrapping a build tool in a build tool. Why? I'm guessing to make it more familiar to developers coming from a C/Make ecosystem. But mixing Make and NPM like this confuses Node/NPM developers, and NPM scripts can run CLI commands just like Make does.

Is npm i really more complicated than make npm? Seems like this information is better off in a README, and Make developers should be educated on how to use NPM (e.g. you can run CLI commands from inside NPM scripts). Adding Make scripts isn't adding any value here, but YMMV, maybe this is particularly useful inside your org.

Also don't use sudo when running npm.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!