I have a Node project with the following structure:
. ├── index.js ├── package.json ├── updater.js └── yarn.lock I'm using Yarn with this project.
Inside file: package.json there is a reference to package: @emotion/core@^10.0.22 as you can see below:
{ "name": "my-project", ... "dependencies": { ... "@emotion/core": "^10.0.22", ... } ... } What I need is:
From inside file: updater.js file, upgrade package: @emotion/core to version: ^10.0.27 (just in case, remember I'm using Yarn), so I can do:
$ node updater.js From the command line I can achieve this very easily with:
$ yarn upgrade @emotion/core@^10.0.27 But I need to do this from inside the file: updater.js (this is a requirement). This is a simplification of a biggest problem (so I need to meet the requirements of this dummy use case even if it doesn't make sense).
This code will go inside a custom package that will take care of installing some other packages.
Thanks in advance!
updater.jsthat uses something like thechild_processnative module, see here - stackoverflow.com/a/35586247/5862900