Skip to content

Commit

Permalink
Add watch event detail log
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiří Fencl committed Oct 26, 2024
1 parent fb424e0 commit a5e48e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-drinks-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ima/plugin-cli": patch
---

Add watch event detail about eventName and its target
6 changes: 4 additions & 2 deletions packages/plugin-cli/src/utils/commands.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit a5e48e1

Please sign in to comment.