jeslie0/npm-lockfile-fix

Git dependency is getting overwritten

Closed this issue · 5 comments

I was using this to package super-productivity in nixpkgs NixOS/nixpkgs#334933, and found that one of the git dependencies got overwritten and could not be resolved during the npm config phase.

Since the git dependency already had resolved field, I patched npm-lockfile-fix to only check for packages without a resolved filled. I don't know if this is the correct fix, but it seems to work for me.

The dependency: "jira2md": "git+https://github.com/johannesjo/J2M.git"
The lockfile:

    "node_modules/jira2md": {
      "version": "2.0.3",
      "resolved": "git+ssh://git@github.com/johannesjo/J2M.git#d6e0211c6e6c4c1f09283faec3d0efdaed3a4caa",
      "dev": true,
      "dependencies": {
        "marked": "^0.6.2"
      }
    },

After using npm-lockfile-fix:

    "node_modules/jira2md": {
      "version": "2.0.3",
      "resolved": "https://registry.npmjs.org/jira2md/-/jira2md-2.0.3.tgz",
      "dev": true,
      "dependencies": {
        "marked": "^0.6.2"
      },
      "integrity": "sha512-DbtL03W+Np0nRIMEChBJmViZ+bNCofCTz562GPt4oPzCpWa5j8anR5vu5e/20DqW75Zz0JdJ06Tns3YSQpftiQ=="
    },

Thank you for submitting this issue! I should have some more free time over the weekend, and will try and review it then.

Okay, I think I am happy to add this functionality into the script, but I don't think it should be on by default. My opinion is that it should be turned on by a flag, specified as a command line argument. How does that sound to you?

I agree with enabling the feature by flag.
It may help to print out a message saying this flag may help if there are any git dependencies since it was hard to debug the issue.

I have added a command line interface to the program now, and you can find it on the develop branch. You should just give the -r flag for it to work. If you are happy with it works, then I we can close this issue.

I tried it out with the -r flag and it seems to work!
Thanks!