UNPKG

1.47 kBTypeScriptView Raw
1import { Interfaces } from '@oclif/core';
2import { LogLevel } from './log-level.js';
3import { NPM } from './npm.js';
4type Plugin = Interfaces.LinkedPlugin | Interfaces.UserPlugin;
5type NormalizedUserPJSON = {
6 dependencies: Record<string, string>;
7 oclif: {
8 plugins: Plugin[];
9 schema: number;
10 };
11 private: boolean;
12};
13export default class Plugins {
14 config: Interfaces.Config;
15 readonly npm: NPM;
16 private readonly debug;
17 private readonly logLevel;
18 constructor(options: {
19 config: Interfaces.Config;
20 logLevel?: LogLevel;
21 });
22 add(...plugins: Plugin[]): Promise<void>;
23 friendlyName(name: string): string;
24 hasPlugin(name: string): Promise<Plugin | false>;
25 install(name: string, { force, tag }?: {
26 force?: boolean | undefined;
27 tag?: string | undefined;
28 }): Promise<Interfaces.Config>;
29 link(p: string, { install }: {
30 install: boolean;
31 }): Promise<Interfaces.Config>;
32 list(): Promise<Plugin[]>;
33 maybeUnfriendlyName(name: string): Promise<string>;
34 pjson(): Promise<NormalizedUserPJSON>;
35 remove(name: string): Promise<void>;
36 unfriendlyName(name: string): string | undefined;
37 uninstall(name: string): Promise<void>;
38 update(): Promise<void>;
39 private ensurePJSON;
40 private isValidPlugin;
41 private maybeCleanUp;
42 private npmHasPackage;
43 private get pjsonPath();
44 private readPJSON;
45 private savePJSON;
46}
47export {};