Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit 577a2d4

Browse files
author
Daniel K
committed
Improve logging format
1 parent 7d37f15 commit 577a2d4

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/xstate-compiled/src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,30 @@ watcher.on('all', async (eventName, filePath) => {
4747
if (!isValidFile(filePath)) {
4848
return;
4949
}
50+
let message = '';
5051
if (eventName === 'add') {
51-
console.log(`Scanning File: `.cyan.bold + toRelative(filePath).gray);
52+
message += `Scanning File: `.cyan.bold;
5253
await addToCache(filePath);
5354
}
5455
if (eventName === 'change') {
55-
console.log(`File Changed: `.cyan.bold + toRelative(filePath).gray);
56+
message += `File Changed: `.yellow.bold;
5657
await addToCache(filePath);
5758
}
5859
if (eventName === 'unlink') {
59-
console.log(`File Deleted: `.red.bold + toRelative(filePath).gray);
60+
message += `File Deleted: `.red.bold;
6061
removeFromCache(filePath);
6162
}
63+
if (message) {
64+
console.log(`${message} ${toRelative(filePath).gray}`);
65+
}
6266
printToFile(fileCache, objectArgs.outDir);
6367
});
6468

6569
process.on('exit', () => {
66-
console.log('Completed!'.green.bold);
70+
if (onlyOnce) {
71+
// little trick because `ready` doesn't work well to know the inital run is complete
72+
console.log('Completed!'.green.bold);
73+
}
6774
});
6875

6976
watcher.on('ready', async () => {

0 commit comments

Comments
 (0)