Skip to content

Commit

Permalink
refactor(embed): no empty table, additional new line
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Oct 11, 2024
1 parent 4bceae9 commit 307f965
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/commands/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ const { outputFileSync } = extra;
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

function as_str(error: unknown)
{
return error as string;
}

export async function embed(source: string, destination: string)
{
const eta = new Eta({ views: join(__dirname, "..", "templates") });
const as_str = (error: unknown) => error as string;

if (!existsSync(destination))
{
Expand Down Expand Up @@ -82,5 +78,11 @@ export async function embed(source: string, destination: string)
"Size (KB)": (statSync(path).size / 1024),
}));

if (table.length === 0)
{
return;
}

console.log();
console.table(table, ["File", "Mime", "Header", "Size (KB)"]);
}

0 comments on commit 307f965

Please sign in to comment.