Function
installPlugin
(spec: string, dep: InstallDeps = defaultInstallDeps)
Source from the content-addressed store, hash-verified
| 257 | } |
| 258 | |
| 259 | export async function installPlugin(spec: string, dep: InstallDeps = defaultInstallDeps): Promise<InstallResult> { |
| 260 | const target = await dep.resolve(spec).then( |
| 261 | (item) => ({ |
| 262 | ok: true as const, |
| 263 | item, |
| 264 | }), |
| 265 | (error: unknown) => ({ |
| 266 | ok: false as const, |
| 267 | error, |
| 268 | }), |
| 269 | ) |
| 270 | if (!target.ok) { |
| 271 | return { |
| 272 | ok: false, |
| 273 | code: "install_failed", |
| 274 | error: target.error, |
| 275 | } |
| 276 | } |
| 277 | return { |
| 278 | ok: true, |
| 279 | target: target.item, |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | export async function readPluginManifest(target: string): Promise<ManifestResult> { |
| 284 | const pkg = await readPluginPackage(target).then( |
Tested by
no test coverage detected