Skip to content

Updating or adding Packages

veeramarni edited this page Apr 10, 2020 · 10 revisions

Updating Packages

  1. First, you need to delete root's package-lock.json
  2. Search for the package and add to the search box with replace value so the package is get updated in all the packages.json files if it used
  3. Run npm install -f from the root.
  4. Make sure none of the node_modules are installed under subdirectories of packages or servers. Look for npm_modules under the servers\frontend-server etc... to make sure no local node_modules are created.

Adding packages

If the package is not generic for the whole project then add it to the package.json of the package folder where it will be used. Two ways to do it.

i. Go to the package.json file under the module where you want to add the package and edit the file to add the package. After the package is added, run npm install or npm install -f from the root (not from the module location).

ii. Use the following lerna command to add the package.

You can use the following command.

$ lerna add --scope=<module> <package>[@version] [--dev] [--exact] [--peer]

Example

$ lerna add --scope=sample-stack-frontend-server apollo-link@^1.2.13

-- you can regex shortcut like below instead of giving full package name of module --
$ lerna add --scope=*frontend-server apollo-link@^1.2.13

You will see the package added to that module by checking its package.json

Contributing

Clone this wiki locally