Skip to content

Instantly share code, notes, and snippets.

@wraithgar
Created January 12, 2023 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wraithgar/ea147b7a431e7ee54329e75eedf12627 to your computer and use it in GitHub Desktop.
Save wraithgar/ea147b7a431e7ee54329e75eedf12627 to your computer and use it in GitHub Desktop.
npm pick manifest example
> pick = require('npm-pick-manifest')
[Function (anonymous)]
> packument
{
name: 'some-package',
'dist-tags': { foo: '1.0.1' },
versions: {
'1.0.0': { version: '1.0.0' },
'1.0.1': { version: '1.0.1' },
'1.0.2': { version: '1.0.2' },
'2.0.0': { version: '2.0.0' }
}
}
> pick(packument, '^1.0.0')
{ version: '1.0.2' }
> packument['dist-tags'].latest = '1.0.1'
'1.0.1'
> pick(packument, '^1.0.0')
{ version: '1.0.1' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment