-import { EmptyObject } from '../types/EmptyObject';
-import { FileType } from '../types/FileType';
-import { HandleErrorParams } from '../types/Error';
-import { JsonType } from '../types/JsonType';
-import Utils from './Utils';
-import chalk from 'chalk';
import fs from 'fs';
+
+import chalk from 'chalk';
+
+import type { EmptyObject } from '../types/EmptyObject';
+import type { HandleErrorParams } from '../types/Error';
+import type { FileType } from '../types/FileType';
+import type { JsonType } from '../types/JsonType';
import logger from './Logger';
+import Utils from './Utils';
export default class FileUtils {
+ private constructor() {
+ // This is intentional
+ }
+
public static watchJsonFile<T extends JsonType>(
logPrefix: string,
fileType: FileType,
error
);
} else {
- logger.warn(prefix + fileType + ' file ' + file + ' not found: %j', error);
+ logger.warn(prefix + fileType + ' file ' + file + ' not found:', error);
}
} else if (error.code === 'EEXIST') {
if (params?.consoleOut) {
error
);
} else {
- logger.warn(prefix + fileType + ' file ' + file + ' already exists: %j', error);
+ logger.warn(prefix + fileType + ' file ' + file + ' already exists:', error);
}
} else if (error.code === 'EACCES') {
if (params?.consoleOut) {
error
);
} else {
- logger.warn(prefix + fileType + ' file ' + file + ' access denied: %j', error);
+ logger.warn(prefix + fileType + ' file ' + file + ' access denied:', error);
}
} else {
if (params?.consoleOut) {
error
);
} else {
- logger.warn(prefix + fileType + ' file ' + file + ' error: %j', error);
+ logger.warn(prefix + fileType + ' file ' + file + ' error:', error);
}
if (params?.throwError) {
throw error;