1

Is there a feature that supports SNAPSHOT releases for npm-packages in nexus 3? My npm package is in package.json like this:

"myPackage": "1.0.0.SNAPSHOT"

Currently I have re-deploy enabled and I'm overriding my SNAPSHOT.

But I don't think this is a recommended way to handle snapshots and now I run into checksum errors for same version when I run npm install:

[error]npm ERR! code EINTEGRITY 2018-06-29T06:30:28.0364505Z

[error]npm ERR! sha512-LrLp9iDmk8CC34NoQj/cElE70LxL7xNzjAAooxIABnXXCki5hPaZ2DggSZrrnr2iYNUQFOoRuvln/y/JvqwAxA==

integrity checksum failed when using sha512: wanted sha512-LrLp9iDmk8CC34NoQj/cElE70LxL7xNzjAAooxIABnXXCki5hPaZ2DggSZrrnr2iYNUQFOoRuvln/y/JvqwAxA== but got sha512-SecqJp7P5woQjJ4xzj6xjd8PqCEizm2Fr3gh6lQzYXEQtWi49Rsa0wR6inLQkF0rvF/JKN6wO4njkwDOyASd7w==. (363851 bytes)

Any recommendations how to handle npm packages as snapshots?

ochs.tobi
  • 3,214
  • 7
  • 31
  • 52
  • Respectfully don't think this question has anything to do with NXRM3. NXRM is a gateway to how the client behaves. If you find NXRM isn't behaving how NPM client acts, IMO that'd be a bug. – joedragons Jul 17 '18 at 22:30
  • 2
    You're right my main question was how to handle snapshots with npm. I've found a solution that worked for me when using the npm pre-releases mechanism. I deploy the snapshots with a timestamp like this: `1.0.0-SNAPSHOT.[timestamp]` and if I reference it in package.json like this `^1.0.0-SNAPSHOT` the package with the latest timestamp will be installed. – ochs.tobi Jul 18 '18 at 05:55

1 Answers1

3

After some time I came across a good way to handle this scenario. It is important to know, that you don't need to reference a version number in your package.json. You can also reference to a distribution tag like latest or snapshot.

You only have to take 2 steps to get the newest snapshot published in your repo.

  1. Publish the snapshot packages under the tag snapshot in the NPM repository with this command: npm publish --tag snapshot.
  2. Reference the tag instead of the version in the package.json of other projects as seen below.

package.json:

"myPackage": "snapshot"

Now everytime you call npm install the version you published latest will be installed.

Here is a screenshot of a npm repo that holds my latest snapshot (Nexus). As you can see, a npm install for my package.json will resolve the tag snapshot to the version 11.2.0-SNAPSHOT.20181205001757 :

npm repo snapshot tag

ochs.tobi
  • 3,214
  • 7
  • 31
  • 52