node-portfinder icon indicating copy to clipboard operation
node-portfinder copied to clipboard

Update documentation for `getPort`, `getPorts`, `getSocket`

Open eriktrom opened this issue 11 months ago • 1 comments

Update documentation for getPort, getPorts, getSocket

Follow the idea for docs from https://caolan.github.io/async/v3/docs.html#concat

see #168 and #169 for context.

Remove the *Promise based docs and only document getPort, getPorts, getSocket


Great issue for new contributors. Feel free to make a pull request! Don't hesitate to ask if you need help or are confused.

eriktrom avatar Mar 12 '25 21:03 eriktrom

For this ticket, I feel like it might make sense to remove the function documentation from porfinder.js and have it purely live in portfinder.d.ts, where at this point I think most people's IDEs will pull from the type file if it's available. The alternative would be to duplicate the documentation in both places, which doesn't feel great imo, but happy to do it if you'd prefer. For the latter, this would change the documentation from whatever custom format it is in, to a more standardized jsdoc setup.

I would also still document the *Promise function variants, but purely have it be like:

/**
 * Use getPort instead.
 * @deprecated
 */
export function getPortPromise(options?: PortFinderOptions): Promise<number>;

where then within people's IDEs, they'll see the function call be crossed out, with a message on what they should migrate to:

Image

MasterOdin avatar Apr 02 '25 05:04 MasterOdin