We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
every tree needs a tree walker ; )
npm/logical-tree
npm/logical-tree fork
i use this to build a deep node_modules with symlinks, just like pnpm
its useful to have an array of parent nodes in the walker function
sample
const deptree = await buildDepTree( read('package.json'), read(lockfilePath), false, lockfileTypeOfName[path.basename(lockfilePath)], true, ); function walk_deptree(_this, enter, _seen, deptreePath = []) { // note: this will deduplicate deps if (!_seen) { _seen = new Set() } if (_seen.has(_this)) { return } _seen.add(_this) enter(_this, function recurse() { for (let key in _this.dependencies) { walk_deptree(_this.dependencies[key], enter, _seen, deptreePath.concat([_this])) } }, deptreePath) } //deptree.forEach((dep, recurse, deptreePath) => { walk_deptree(deptree, function enter(dep, recurse, deptreePath) { // enter console.log(`${deptreePath.map(_ => `+ `).join('')}${dep.name}@${dep.version}`); recurse(); // leave });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
every tree needs a tree walker ; )
npm/logical-tree
npm/logical-tree fork
i use this to build a deep node_modules with symlinks, just like pnpm
its useful to have an array of parent nodes in the walker function
sample
The text was updated successfully, but these errors were encountered: