ensure-port
Advanced tools
Comparing version 0.0.1 to 1.0.0
@@ -24,3 +24,3 @@ import type { IFileSystem } from '@file-services/types'; | ||
*/ | ||
ensurePort(): Promise<number>; | ||
ensure(): Promise<number>; | ||
/** | ||
@@ -31,3 +31,3 @@ * Un-mark a ports as used. | ||
*/ | ||
releasePorts(currentPorts?: number[]): Promise<void>; | ||
release(currentPorts?: number[]): Promise<void>; | ||
/** | ||
@@ -39,3 +39,3 @@ * | ||
*/ | ||
setPort(port: number): Promise<void>; | ||
set(port: number): Promise<void>; | ||
/** | ||
@@ -42,0 +42,0 @@ * Releases all the ports. |
@@ -34,3 +34,3 @@ "use strict"; | ||
*/ | ||
async ensurePort() { | ||
async ensure() { | ||
if (this.initialEdges.reached) { | ||
@@ -45,3 +45,3 @@ throw new Error(`All ports are used between ${this.initialEdges.start} and ${this.initialEdges.end}`); | ||
if (port !== preferredPort) { | ||
await this.setPort(port); | ||
await this.set(port); | ||
} | ||
@@ -57,3 +57,3 @@ await new Promise((resolve, reject) => httpServer.close((error) => (error ? reject(error) : resolve(void 0)))); | ||
*/ | ||
async releasePorts(currentPorts) { | ||
async release(currentPorts) { | ||
await this.updatePersistentPorts((ports) => { | ||
@@ -72,3 +72,3 @@ for (const port of [...(currentPorts !== null && currentPorts !== void 0 ? currentPorts : this.localPorts)]) { | ||
*/ | ||
async setPort(port) { | ||
async set(port) { | ||
await this.updatePersistentPorts((ports) => { | ||
@@ -94,3 +94,3 @@ this.localPorts.add(port); | ||
const port = await this.getNextPort(); | ||
await this.setPort(port); | ||
await this.set(port); | ||
return port; | ||
@@ -97,0 +97,0 @@ } |
@@ -24,3 +24,3 @@ import type { IFileSystem } from '@file-services/types'; | ||
*/ | ||
ensurePort(): Promise<number>; | ||
ensure(): Promise<number>; | ||
/** | ||
@@ -31,3 +31,3 @@ * Un-mark a ports as used. | ||
*/ | ||
releasePorts(currentPorts?: number[]): Promise<void>; | ||
release(currentPorts?: number[]): Promise<void>; | ||
/** | ||
@@ -39,3 +39,3 @@ * | ||
*/ | ||
setPort(port: number): Promise<void>; | ||
set(port: number): Promise<void>; | ||
/** | ||
@@ -42,0 +42,0 @@ * Releases all the ports. |
@@ -31,3 +31,3 @@ import { nodeFs } from '@file-services/node'; | ||
*/ | ||
async ensurePort() { | ||
async ensure() { | ||
if (this.initialEdges.reached) { | ||
@@ -42,3 +42,3 @@ throw new Error(`All ports are used between ${this.initialEdges.start} and ${this.initialEdges.end}`); | ||
if (port !== preferredPort) { | ||
await this.setPort(port); | ||
await this.set(port); | ||
} | ||
@@ -54,3 +54,3 @@ await new Promise((resolve, reject) => httpServer.close((error) => (error ? reject(error) : resolve(void 0)))); | ||
*/ | ||
async releasePorts(currentPorts) { | ||
async release(currentPorts) { | ||
await this.updatePersistentPorts((ports) => { | ||
@@ -69,3 +69,3 @@ for (const port of [...(currentPorts !== null && currentPorts !== void 0 ? currentPorts : this.localPorts)]) { | ||
*/ | ||
async setPort(port) { | ||
async set(port) { | ||
await this.updatePersistentPorts((ports) => { | ||
@@ -91,3 +91,3 @@ this.localPorts.add(port); | ||
const port = await this.getNextPort(); | ||
await this.setPort(port); | ||
await this.set(port); | ||
return port; | ||
@@ -94,0 +94,0 @@ } |
{ | ||
"name": "ensure-port", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "Makes sure you get an available port", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -27,3 +27,3 @@ # Ensure Port | ||
const port = await ports.ensurePort(); // This would be a random port between 8000 and 9000 that is not used (validated again file-system and http server) | ||
const port = await ports.ensure(); // This would be a random port between 8000 and 9000 that is not used (validated again file-system and http server) | ||
@@ -30,0 +30,0 @@ // When you finish - remove watcher |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
0
75432