UNPKG

2.49 kBTypeScriptView Raw
1import { JspmUserError } from './utils/common';
2import { confirm, input } from './utils/ui';
3import Config from './config';
4import RegistryManager, { Registry } from './install/registry-manager';
5import globalConfig from './config/global-config-file';
6import FetchClass from './install/fetch';
7import { Install, InstallOptions, Installer } from './install';
8export declare type Hook = 'preinstall' | 'postinstall';
9export interface Logger {
10 newline: () => void;
11 msg: (msg: string) => void;
12 errMsg: (err: string | Error | JspmUserError) => void;
13 err: (err: string | Error | JspmUserError) => void;
14 debug: (msg: string) => void;
15 info: (msg: string) => void;
16 warn: (msg: string) => void;
17 ok: (msg: string) => void;
18 taskStart: (name: string) => () => void;
19 taskEnd: (name: string) => void;
20}
21export declare type input = typeof input;
22export declare type confirm = typeof confirm;
23export interface ProjectConfiguration {
24 userInput?: boolean;
25 cacheDir?: string;
26 timeouts?: {
27 resolve?: number;
28 download?: number;
29 };
30 defaultRegistry?: string;
31 offline?: boolean;
32 preferOffline?: boolean;
33 strictSSL?: boolean;
34 registries?: {
35 [name: string]: Registry;
36 };
37 cli?: boolean;
38}
39export declare class Project {
40 projectPath: string;
41 config: Config;
42 globalConfig: typeof globalConfig;
43 cli: boolean;
44 defaultRegistry: string;
45 log: Logger;
46 confirm: typeof confirm;
47 input: typeof input;
48 userInput: boolean;
49 offline: boolean;
50 preferOffline: boolean;
51 registryManager: RegistryManager;
52 installer: Installer;
53 fetch: FetchClass;
54 cacheDir: string;
55 checkedGlobalBin: boolean;
56 constructor(projectPath: string, options: ProjectConfiguration);
57 checkGlobalBin(): void;
58 dispose(): Promise<[void, void[], void]>;
59 save(): Promise<boolean>;
60 update(selectors: string[], opts: InstallOptions): Promise<void>;
61 install(installs: Install[], opts?: InstallOptions): Promise<void>;
62 uninstall(names: string[]): Promise<void>;
63 checkout(names: string[]): Promise<void>;
64 link(pkg: string, source: string, opts: InstallOptions): Promise<void>;
65 clean(): Promise<void>;
66 init(basePath: string): Promise<void>;
67 registryConfig(name: string): Promise<void>;
68 clearCache(): Promise<void>;
69 run(name: string, args: string[]): Promise<number>;
70}
71export declare function runHook(project: Project, name: Hook): Promise<void>;