Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add type for pm2.reload with optional options parameter #4615

Merged
merged 1 commit into from Apr 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions types/index.d.ts
Expand Up @@ -100,6 +100,19 @@ export {del as delete};
*/
export function reload(process: string|number, errback: ErrProcCallback): void;

/**
* Zero-downtime rolling restart. At least one process will be kept running at
* all times as each instance is restarted individually.
* Only works for scripts started in cluster mode.
* @param process - Can either be the name as given in the pm2.start options,
* a process id, or the string “all” to indicate that all scripts should be restarted.
* @param options - An object containing configuration
* @param options.updateEnv - (Default: false) If true is passed in, pm2 will reload it’s
* environment from process.env before reloading your process.
* @param errback - called when the process is reloaded
*/
export function reload(process: string|number, options: ReloadOptions, errback: ErrProcCallback): void;

/**
* Kills the pm2 daemon (same as pm2 kill). Note that when the daemon is killed, all its
* processes are also killed. Also note that you still have to explicitly disconnect
Expand Down Expand Up @@ -406,6 +419,14 @@ export interface StartOptions {
env?: { [key: string]: string; };
}

interface ReloadOptions {
/**
* (Default: false) If true is passed in, pm2 will reload it’s environment from process.env
* before reloading your process.
*/
updateEnv?: boolean;
}

// Types

type ProcessStatus = 'online' | 'stopping' | 'stopped' | 'launching' | 'errored' | 'one-launch-status';
Expand Down