From 1761cfa967f5192f758d3a050c5b48925a7371d7 Mon Sep 17 00:00:00 2001 From: Zen Voich Date: Wed, 2 Oct 2024 15:07:36 +0400 Subject: [PATCH] [cli] `mops watch` fix --- cli/commands/watch/generator.ts | 1 + cli/commands/watch/watch.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cli/commands/watch/generator.ts b/cli/commands/watch/generator.ts index b258611..09415ca 100644 --- a/cli/commands/watch/generator.ts +++ b/cli/commands/watch/generator.ts @@ -46,6 +46,7 @@ export class Generator { if (this.errorChecker.status === 'error') { this.status = 'syntax-error'; + onProgress(); return; } diff --git a/cli/commands/watch/watch.ts b/cli/commands/watch/watch.ts index 3b5c5cf..bdae470 100644 --- a/cli/commands/watch/watch.ts +++ b/cli/commands/watch/watch.ts @@ -17,7 +17,11 @@ let ignore = [ ]; export async function watch(options : {error : boolean, warning : boolean, test : boolean, generate : boolean, deploy : boolean}) { - options.error = Object.values(options).includes(true) ? options.error : true; + let hasOptions = Object.values(options).includes(true); + if (!hasOptions) { + options.warning = true; + } + options.error = true; let rootDir = getRootDir(); let canisters = getMotokoCanisters(); @@ -41,11 +45,10 @@ export async function watch(options : {error : boolean, warning : boolean, test generator.reset(); options.error && await errorChecker.run(print); - options.warning && await warningChecker.run(print); - options.test && await tester.run(print); - options.generate && await generator.run(print); + options.warning && warningChecker.run(print); + options.test && tester.run(print); + options.generate && generator.run(print); // options.deploy && await deployer.run(print); - print(); }, 200); let print = () => { @@ -65,6 +68,7 @@ export async function watch(options : {error : boolean, warning : boolean, test options.generate && statuses.push(generator.status); if (statuses.every(status => status !== 'pending' && status !== 'running')) { + console.log(chalk.dim('-'.repeat(50))); console.log(chalk.dim('Waiting for file changes...')); console.log(chalk.dim(`Press ${chalk.bold('Ctrl+C')} to exit.`)); }