Comparing version 0.0.18 to 0.0.19
@@ -24,2 +24,6 @@ import { HttpVerb, RestapifyErrorCallbackParam, RestapifyEventCallback, RestapifyEventName } from './types'; | ||
}; | ||
export interface RunOptions { | ||
hard?: boolean; | ||
startServer?: boolean; | ||
} | ||
declare class Restapify { | ||
@@ -54,3 +58,3 @@ private eventCallbacksStore; | ||
private startServer; | ||
run: (restartedBecauseOfHotWatch?: boolean) => void; | ||
run: (options?: RunOptions | undefined) => void; | ||
private configEventsCallbacks; | ||
@@ -57,0 +61,0 @@ private removeState; |
@@ -80,3 +80,3 @@ "use strict"; | ||
this.close(); | ||
this.run(!hardRestart); | ||
this.run({ hard: hardRestart }); | ||
}; | ||
@@ -204,5 +204,11 @@ this.checkApiBaseUrl = () => { | ||
}; | ||
this.run = (restartedBecauseOfHotWatch = false) => { | ||
this.run = (options) => { | ||
let hard = true; | ||
let startServer = true; | ||
if (options) { | ||
hard = options.hard || true; | ||
startServer = options.startServer || true; | ||
} | ||
try { | ||
if (!restartedBecauseOfHotWatch) { | ||
if (hard) { | ||
this.configEventsCallbacks(); | ||
@@ -213,17 +219,20 @@ this.checkApiBaseUrl(); | ||
this.listRouteFiles(); | ||
this.configRoutesFromListedFiles(); | ||
this.checkJsonFiles(); | ||
this.configServer(); | ||
if (!restartedBecauseOfHotWatch) | ||
if (startServer) | ||
this.configServer(); | ||
if (hard && startServer) | ||
this.configDashboard(); | ||
this.configInternalApi(); | ||
if (!restartedBecauseOfHotWatch) | ||
if (startServer) | ||
this.configInternalApi(); | ||
if (hard) | ||
this.configHotWatch(); | ||
if (!restartedBecauseOfHotWatch && this.autoOpenDashboard) | ||
if (hard && this.autoOpenDashboard && startServer) | ||
this.openDashboard(); | ||
if (!restartedBecauseOfHotWatch) | ||
if (hard && startServer) | ||
this.executeCallbacks('server:start'); | ||
this.startServer(); | ||
if (!restartedBecauseOfHotWatch) | ||
if (hard) | ||
this.executeCallbacks('start'); | ||
else | ||
else if (startServer) | ||
this.executeCallbacks('server:restart'); | ||
@@ -230,0 +239,0 @@ } |
{ | ||
"name": "restapify", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2563935
30
2771