From 33d870ba3ec14c53d66c599e75cf2f60dbc547f5 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Mon, 12 Sep 2022 14:07:54 -0400 Subject: [PATCH 1/3] Add mutator method for basePath --- lib/portfinder.d.ts | 10 ++++++++++ lib/portfinder.js | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/lib/portfinder.d.ts b/lib/portfinder.d.ts index a57b999..b5d7924 100644 --- a/lib/portfinder.d.ts +++ b/lib/portfinder.d.ts @@ -60,3 +60,13 @@ export function getPorts(count: number, options: PortFinderOptions, callback: (e * Responds a promise of an unbound port on the current machine. */ export function getPortPromise(options?: PortFinderOptions): Promise; + +/** + * Default path to begin any socket search from. + */ + export let basePath: string; + +/** + * Set the base path to begin any socket search from. + */ +export function setBasePath(path: string); \ No newline at end of file diff --git a/lib/portfinder.js b/lib/portfinder.js index 2bc65e2..d8d3595 100644 --- a/lib/portfinder.js +++ b/lib/portfinder.js @@ -115,6 +115,13 @@ exports.setHighestPort = function (port) { exports.basePath = '/tmp/portfinder' // +// ### function setBasePath (path) +// #### @path {String} The new base path +// +exports.setBasePath = function (path) { + exports.basePath = path; +} + // ### function getPort (options, callback) // #### @options {Object} Settings to use when finding the necessary port // #### @callback {function} Continuation to respond to when complete. From 8bcb8c4b5118a2996df2f03f22e1cdd739bb336b Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Mon, 12 Sep 2022 14:11:26 -0400 Subject: [PATCH 2/3] add newline --- lib/portfinder.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portfinder.d.ts b/lib/portfinder.d.ts index b5d7924..876cbfc 100644 --- a/lib/portfinder.d.ts +++ b/lib/portfinder.d.ts @@ -69,4 +69,4 @@ export function getPortPromise(options?: PortFinderOptions): Promise; /** * Set the base path to begin any socket search from. */ -export function setBasePath(path: string); \ No newline at end of file +export function setBasePath(path: string); From 86eccb1463085346271d14ca86dd7759a8622806 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Mon, 12 Sep 2022 14:24:13 -0400 Subject: [PATCH 3/3] Update portfinder.d.ts --- lib/portfinder.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portfinder.d.ts b/lib/portfinder.d.ts index 876cbfc..0ed29ba 100644 --- a/lib/portfinder.d.ts +++ b/lib/portfinder.d.ts @@ -69,4 +69,4 @@ export function getPortPromise(options?: PortFinderOptions): Promise; /** * Set the base path to begin any socket search from. */ -export function setBasePath(path: string); +export function setBasePath(path: string): void;