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':