From a5e48e1e2d0d6f6bc31cf6418d653edcfdbd3d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Fencl?= Date: Sat, 26 Oct 2024 18:35:41 +0200 Subject: [PATCH] Add watch event detail log --- .changeset/silly-drinks-divide.md | 5 +++++ packages/plugin-cli/src/utils/commands.ts | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .changeset/silly-drinks-divide.md diff --git a/.changeset/silly-drinks-divide.md b/.changeset/silly-drinks-divide.md new file mode 100644 index 0000000000..e534d444a9 --- /dev/null +++ b/.changeset/silly-drinks-divide.md @@ -0,0 +1,5 @@ +--- +"@ima/plugin-cli": patch +--- + +Add watch event detail about eventName and its target diff --git a/packages/plugin-cli/src/utils/commands.ts b/packages/plugin-cli/src/utils/commands.ts index 76f80ea21f..67af928a0c 100644 --- a/packages/plugin-cli/src/utils/commands.ts +++ b/packages/plugin-cli/src/utils/commands.ts @@ -1,7 +1,7 @@ import fs from 'fs'; import path from 'path'; -import { logger, time } from '@ima/dev-utils/logger'; +import { logger, time, printTime } from '@ima/dev-utils/logger'; import anymatch from 'anymatch'; import chalk from 'chalk'; import chokidar from 'chokidar'; @@ -56,7 +56,7 @@ export async function parsePkgJson(basePath: string): Promise<{ } function errorHandler(error: Error) { - logger.error('An error occurred while wathing files'); + logger.error('An error occurred while watching files'); console.error(error); } @@ -188,6 +188,8 @@ export async function watch(args: Arguments) { .on('all', async (eventName, filePath) => { const contextPath = path.relative(inputDir, filePath); + logger.write(`${printTime()} ${chalk.green(eventName)}: ${filePath}`); + batch(async () => { switch (eventName) { case 'add':