forked from guacsec/trustify-da-javascript-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript_pnpm.js
More file actions
33 lines (26 loc) · 936 Bytes
/
Copy pathjavascript_pnpm.js
File metadata and controls
33 lines (26 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Base_javascript from './base_javascript.js';
export default class Javascript_pnpm extends Base_javascript {
_lockFileName() {
return "pnpm-lock.yaml";
}
_cmdName() {
return "pnpm";
}
_listCmdArgs(includeTransitive) {
return ['ls', includeTransitive ? '--depth=Infinity' : '--depth=0', '--prod', '--json', '-r'];
}
_updateLockFileCmdArgs() {
return ['install', '--frozen-lockfile'];
}
_buildDependencyTree(includeTransitive, opts = {}) {
// pnpm ls --json returns an array with one entry per workspace package.
// When analyzing a workspace member, find its entry by name instead of
// blindly taking the first element (which is the workspace root).
const tree = super._buildDependencyTree(includeTransitive, opts);
if (Array.isArray(tree) && tree.length > 0) {
const memberName = this._getManifest().name;
return tree.find(pkg => pkg.name === memberName) || tree[0];
}
return {};
}
}