Added options to disable the TSC and SASS watcher

Signed-off-by: WolverinDEV <git@teaspeak.de>
This commit is contained in:
WolverinDEV 2019-12-20 18:54:07 +01:00
parent dd4a0af83f
commit c94f64f6e4
No known key found for this signature in database
GPG key ID: 77A6C15085150EEB

18
file.ts
View file

@ -742,6 +742,8 @@ namespace watcher {
export abstract class Watcher { export abstract class Watcher {
readonly name: string; readonly name: string;
protected verbose: boolean = false;
private _process: ChildProcess; private _process: ChildProcess;
private _callback_init: () => any; private _callback_init: () => any;
private _callback_init_fail: (msg: string) => any; private _callback_init_fail: (msg: string) => any;
@ -807,7 +809,7 @@ namespace watcher {
this._callback_init(); this._callback_init();
const data = buffer.toString(); const data = buffer.toString();
if(false) { if(this.verbose) {
for(const line of data.split("\n")) for(const line of data.split("\n"))
console.log("%s: %s", this.name, line); console.log("%s: %s", this.name, line);
} }
@ -834,6 +836,7 @@ namespace watcher {
export class TSCWatcher extends Watcher { export class TSCWatcher extends Watcher {
constructor() { constructor() {
super("TSC Watcher"); super("TSC Watcher");
//this.verbose = true;
} }
protected start_command(): string[] { protected start_command(): string[] {
@ -844,6 +847,7 @@ namespace watcher {
export class SASSWatcher extends Watcher { export class SASSWatcher extends Watcher {
constructor() { constructor() {
super("SASS Watcher"); super("SASS Watcher");
this.verbose = true;
} }
protected start_command(): string[] { protected start_command(): string[] {
@ -879,7 +883,7 @@ async function main_serve(target: "client" | "web", mode: "rel" | "dev", port: n
await new Promise(resolve => {}); await new Promise(resolve => {});
} }
async function main_develop(node: boolean, target: "client" | "web", port: number) { async function main_develop(node: boolean, target: "client" | "web", port: number, flags: string[]) {
const files = await generator.search_files(APP_FILE_LIST, { const files = await generator.search_files(APP_FILE_LIST, {
source_path: __dirname, source_path: __dirname,
parameter: [], parameter: [],
@ -890,11 +894,13 @@ async function main_develop(node: boolean, target: "client" | "web", port: numbe
const tscwatcher = new watcher.TSCWatcher(); const tscwatcher = new watcher.TSCWatcher();
try { try {
await tscwatcher.start(); if(flags.indexOf("--no-tsc") == -1)
await tscwatcher.start();
const sasswatcher = new watcher.SASSWatcher(); const sasswatcher = new watcher.SASSWatcher();
try { try {
await sasswatcher.start(); if(flags.indexOf("--no-sass") == -1)
await sasswatcher.start();
try { try {
await server.launch(files, { await server.launch(files, {
@ -1020,8 +1026,10 @@ async function main(args: string[]) {
console.error("Unknown serve target %s.", args[1]); console.error("Unknown serve target %s.", args[1]);
return; return;
} }
const switches = [];
const pargs = args.slice(1).filter(e => e.startsWith("--") ? (switches.push(e), false) : true);
await main_develop(is_node, target, args.length > 2 ? parseInt(args[2]) : 8081); await main_develop(is_node, target, pargs.length > 2 ? parseInt(pargs[2]) : 8081, switches);
return; return;
} }
} }