madskristensen / PackageInstaller

A Visual Studio extension
Other
67 stars 15 forks source link

package.json and package-lock.json are not updated if they are read-only #26

Open icnocop opened 6 years ago

icnocop commented 6 years ago

Installed product versions

Description

When I install an npm package, Package Installer doesn't update package.json or package-lock.json if the files are read-only. The files are read-only because they are (TFS) source controlled and not checked out.

Steps to recreate

  1. Create a new web application
  2. Install an npm package so that the package.json and package-lock.json files are created.
  3. Check in the code to a TFS server, using a server workspace, including package.json and package-lock.json. At this point, package.json and package-lock.json are read-only.
  4. Try to install another npm package.

Current behavior

Packager Installer will download the npm package into node_modules, but package.json and package-lock.json are not updated.

Expected behavior

I expected Package Installer to check-out package.json and package-lock.json if they are source controlled. If I open package.json and manually edit it in the Visual Studio IDE for example, it will automatically check-out the file, so I expected the same behavior.