Skip to content

Commit

Permalink
chore: Remove usage of emojis for the time being
Browse files Browse the repository at this point in the history
  • Loading branch information
angelmadames committed Feb 16, 2024
1 parent 620f953 commit b66325c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
15 changes: 5 additions & 10 deletions src/utils/file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export const copyFile = (
output = true,
): void => {
if (isFile(target)) {
if (output) log.warning(`Path: ${target} already exists.`);
if (output) log.warning(`Path: ${target} already exists.`);
return;
}

if (isFile(source)) {
fs.copyFileSync(source, target, 0);
if (output)
log.success(`File: ${source} successfully copied to ${target}.`);
log.success(`File: ${source} successfully copied to ${target}.`);
} else {
if (output) log.error('Source is not a valid file.');
if (output) log.error('Source is not a valid file.');
process.exit(1);
}
};
Expand All @@ -46,7 +46,7 @@ export const createFile = ({
if (!isFile(file) || override) {
if (verbose) log.info(`Creating file: ${file}...`);
fs.writeFileSync(file, content, 'utf8');
if (verbose) log.success(`File: ${file} successfully created.`);
if (verbose) log.success(`File: ${file} successfully created.`);
} else {
if (verbose) log.warning(`File: ${file} already exists.`);
}
Expand All @@ -56,7 +56,7 @@ export const createPath = (path: string, verbose = true): void => {
if (!fs.existsSync(path)) {
if (verbose) log.info(`Creating path: ${path}...`);
fs.mkdirSync(path, { recursive: true });
if (verbose) log.success(`Path: ${path} successfully created.`);
if (verbose) log.success(`Path: ${path} successfully created.`);
} else {
if (verbose) log.warning(`Path: ${path} already exists.`);
}
Expand Down Expand Up @@ -96,9 +96,4 @@ export const deletePath = async ({
return;
}
}

if (verbose) {
log.info(`${path} is not a valid file or directory.`);
return;
}
};
12 changes: 6 additions & 6 deletions src/utils/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const replaceKeyValue = (
verbose = true,
): void => {
if (!isFile(path)) {
if (verbose) log.error(`File ${path} is not a valid file.`);
if (verbose) log.error(`File ${path} is not a valid file.`);
process.exit(1);
}
try {
Expand All @@ -41,11 +41,11 @@ export const replaceKeyValue = (
);
fs.writeFileSync(path, updatedContent);
if (verbose) {
log.success(`File ${path} updated successfully with ${key}=${value}.`);
log.success(`File ${path} updated successfully with ${key}=${value}.`);
}
} catch (error) {
if (verbose) {
log.error(`Error updating file ${path}. See below for more info:`);
log.error(`Error updating file ${path}. See below for more info:`);
}
console.error(error);
}
Expand All @@ -59,7 +59,7 @@ export const replaceKeysInFile = (
verbose = true,
): void => {
if (!isFile(filePath)) {
if (verbose) `File ${filePath} is not a valid file.`;
if (verbose) `File ${filePath} is not a valid file.`;
}

// biome-ignore lint/suspicious/noExplicitAny:
Expand All @@ -80,11 +80,11 @@ export const replaceKeysInFile = (
fs.writeFileSync(filePath, updatedContent);
if (verbose)
log.success(
`File ${filePath} updated successfully with replacements.`,
`File ${filePath} updated successfully with replacements.`,
);
} catch (error) {
if (verbose)
log.error(`Error updating file ${filePath}. See below for more info:`);
log.error(`Error updating file ${filePath}. See below for more info:`);
console.error(error);
}
};

0 comments on commit b66325c

Please sign in to comment.