(name, args, { workspace } = {})
| 99 | } |
| 100 | |
| 101 | async #viewPackage (name, args, { workspace } = {}) { |
| 102 | const wholePackument = !args.length |
| 103 | const json = this.npm.config.get('json') |
| 104 | |
| 105 | // If we are viewing many packages and outputting individual fields then output the name before doing any async activity |
| 106 | if (!json && !wholePackument && workspace) { |
| 107 | output.standard(`${name}:`) |
| 108 | } |
| 109 | |
| 110 | const [pckmnt, data] = await this.#getData(name, args, wholePackument) |
| 111 | |
| 112 | if (!json && wholePackument) { |
| 113 | // pretty view (entire packument) |
| 114 | for (const v of data) { |
| 115 | output.standard(this.#prettyView(pckmnt, Object.values(v)[0][Queryable.ALL])) |
| 116 | } |
| 117 | return |
| 118 | } |
| 119 | |
| 120 | const res = this.#packageOutput(cleanData(data, wholePackument), pckmnt._id) |
| 121 | if (res) { |
| 122 | if (json) { |
| 123 | output.buffer(workspace ? { [name]: res } : res) |
| 124 | } else { |
| 125 | output.standard(res) |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | async #getData (pkg, args) { |
| 131 | const spec = npa(pkg) |
no test coverage detected