[DOCS] @npmcli/arborist how to save a actural tree
Is there an existing issue for this?
- [X] I have searched the existing issues
This is a CLI Docs Problem, not another kind of Docs Problem.
- [X] This is a CLI Docs Problem.
Description of Problem
i read the use age of @npmcli/arborist documentation want find a way to save a actural tree as package-lock.json by my self,but it‘s seems a little complex by read verify source code ,could give some example to save it?
Potential Solution
No response
Affected URL
No response
and anohter problem is,actural and virtual tree are not contianintegrity and licence even in itselves node_modules package.json,and if i remove package-lock. and do reify it also generate package-lock contain integrity,where did it get the integrity
Look forward to your more advice.
passing the save option to reify will cause the package-lock and lockfile to be written (defaults to true). This is at the bottom of the usage example.
integrity in the package manifest that pacote downloads for a given package, arborist adds this to the lock automatically.
$ npm view lodash dist
{
integrity: 'sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==',
shasum: '679591c564c3bffaae8454cf0b3df370c3d6911c',
tarball: 'https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz',
passing the
saveoption toreifywill cause the package-lock and lockfile to be written (defaults to true). This is at the bottom of theusageexample.integrity in the package manifest that
pacotedownloads for a given package, arborist adds this to the lock automatically.$ npm view lodash dist { integrity: 'sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==', shasum: '679591c564c3bffaae8454cf0b3df370c3d6911c', tarball: 'https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz',
thanks for reply,i found a example in https://github.com/npm/cli/blob/9dc69830a5d78aa4042746d54e2a6b0d2af70caa/workspaces/arborist/lib/arborist/reify.js#L1524-L1529 here.
and integrity found in arborist nodes, it's hard to found beacause mixin cause some properties become prototype of object.after reading documents of arborist,it's clear.
https://github.com/npm/cli/blob/9dc69830a5d78aa4042746d54e2a6b0d2af70caa/workspaces/arborist/lib/arborist/index.js#L34-L48
thanks for your kind helping