removed unnessecery watchers

canary
WolverinDEV 2020-08-05 16:48:28 +02:00
parent e59fb839c9
commit d6f7f85b8b
1 changed files with 31 additions and 59 deletions

90
file.ts
View File

@ -580,74 +580,46 @@ async function main_serve(target: "client" | "web", mode: "rel" | "dev", port: n
} }
async function main_develop(node: boolean, target: "client" | "web", port: number, flags: string[]) { async function main_develop(node: boolean, target: "client" | "web", port: number, flags: string[]) {
const tscwatcher = new watcher.TSCWatcher(); const webpackwatcher = new watcher.WebPackWatcher(target);
try { try {
if(flags.indexOf("--no-tsc") == -1) if(flags.indexOf("--no-webpack") == -1)
await tscwatcher.start(); await webpackwatcher.start();
const sasswatcher = new watcher.SASSWatcher();
try { try {
if(flags.indexOf("--no-sass") == -1) await server.launch(target === "client" ? CLIENT_APP_FILE_LIST : WEB_APP_FILE_LIST, {
await sasswatcher.start(); port: port,
search_options: {
const webpackwatcher = new watcher.WebPackWatcher(target); source_path: __dirname,
parameter: [],
try { target: target,
if(flags.indexOf("--no-webpack") == -1) mode: "dev",
await webpackwatcher.start(); serving: true
try {
await server.launch(target === "client" ? CLIENT_APP_FILE_LIST : WEB_APP_FILE_LIST, {
port: port,
search_options: {
source_path: __dirname,
parameter: [],
target: target,
mode: "dev",
serving: true
}
});
} catch(error) {
console.error("Failed to start server: %o", error instanceof Error ? error.message : error);
return;
} }
});
console.log("Server started on %d", port);
console.log("To stop the session press ^K^C.");
await new Promise(resolve => process.once('SIGINT', resolve));
console.log("Stopping session.");
try {
await server.shutdown();
} catch(error) {
console.warn("Failed to stop web server: %o", error instanceof Error ? error.message : error);
}
} catch (error) {
console.error("Failed to start WebPack watcher: %o", error instanceof Error ? error.message : error);
} finally {
try {
await webpackwatcher.stop();
} catch(error) {
console.warn("Failed to stop WebPack watcher: %o", error instanceof Error ? error.message : error);
}
}
} catch(error) { } catch(error) {
console.error("Failed to start SASS watcher: %o", error instanceof Error ? error.message : error); console.error("Failed to start server: %o", error instanceof Error ? error.message : error);
} finally { return;
try {
await sasswatcher.stop();
} catch(error) {
console.warn("Failed to stop SASS watcher: %o", error instanceof Error ? error.message : error);
}
} }
} catch(error) {
console.error("Failed to start TSC watcher: %o", error instanceof Error ? error.message : error); console.log("Server started on %d", port);
console.log("To stop the session press ^K^C.");
await new Promise(resolve => process.once('SIGINT', resolve));
console.log("Stopping session.");
try {
await server.shutdown();
} catch(error) {
console.warn("Failed to stop web server: %o", error instanceof Error ? error.message : error);
}
} catch (error) {
console.error("Failed to start WebPack watcher: %o", error instanceof Error ? error.message : error);
} finally { } finally {
try { try {
await tscwatcher.stop(); await webpackwatcher.stop();
} catch(error) { } catch(error) {
console.warn("Failed to stop TSC watcher: %o", error instanceof Error ? error.message : error); console.warn("Failed to stop WebPack watcher: %o", error instanceof Error ? error.message : error);
} }
} }
} }