UNPKG

2.4 kBTypeScriptView Raw
1import { Interfaces } from '@oclif/core';
2import Yarn from './yarn.js';
3type UserPJSON = {
4 dependencies: Record<string, string>;
5 oclif: {
6 plugins: Array<Interfaces.PJSON.PluginTypes.Link | Interfaces.PJSON.PluginTypes.User>;
7 schema: number;
8 };
9 private: boolean;
10};
11export default class Plugins {
12 config: Interfaces.Config;
13 silent: boolean;
14 verbose: boolean;
15 readonly yarn: Yarn;
16 private readonly debug;
17 constructor(config: Interfaces.Config);
18 add(...plugins: Interfaces.PJSON.PluginTypes[]): Promise<void>;
19 friendlyName(name: string): string;
20 hasPlugin(name: string): Promise<Interfaces.PJSON.PluginTypes.Link | Interfaces.PJSON.PluginTypes.User | false>;
21 install(name: string, { force, tag }?: {
22 force?: boolean | undefined;
23 tag?: string | undefined;
24 }): Promise<Interfaces.Config>;
25 link(p: string, { install }: {
26 install: boolean;
27 }): Promise<Interfaces.Config>;
28 list(): Promise<(Interfaces.PJSON.PluginTypes.Link | Interfaces.PJSON.PluginTypes.User)[]>;
29 maybeUnfriendlyName(name: string): Promise<string>;
30 pjson(): Promise<UserPJSON>;
31 /**
32 * If a yarn.lock or oclif.lock exists at the root, refresh dependencies by
33 * rerunning yarn. If options.prod is true, only install production dependencies.
34 *
35 * As of v9 npm will always ignore the yarn.lock during `npm pack`]
36 * (see https://github.com/npm/cli/issues/6738). To get around this plugins can
37 * rename yarn.lock to oclif.lock before running `npm pack` using `oclif lock`.
38 *
39 * We still check for the existence of yarn.lock since it could be included if a plugin was
40 * packed using yarn or v8 of npm. Plugins installed directly from a git url will also
41 * have a yarn.lock.
42 *
43 * @param options {prod: boolean, all: boolean}
44 * @param roots string[]
45 * @returns Promise<void>
46 */
47 refresh(options: {
48 all: boolean;
49 prod: boolean;
50 }, ...roots: string[]): Promise<void>;
51 remove(name: string): Promise<void>;
52 unfriendlyName(name: string): string | undefined;
53 uninstall(name: string): Promise<void>;
54 update(): Promise<void>;
55 private createPJSON;
56 private isValidPlugin;
57 private normalizePlugins;
58 private npmHasPackage;
59 private get pjsonPath();
60 private readPJSON;
61 private savePJSON;
62}
63export {};
64
\No newline at end of file