Skip to content

Commit

Permalink
fix: skip log
Browse files Browse the repository at this point in the history
  • Loading branch information
gronxb committed Sep 14, 2024
1 parent 9d3a019 commit 374bc6b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/utils/generateBaseCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import type { Config } from "./config";
import { getCwd, getDirname } from "./cwd";
import fs from "fs/promises";
import { log } from "./console";
import { existsSync } from "fs";

const copyFile = async (src: string, dest: string) => {
if (existsSync(dest)) {
return;
}

await fs.copyFile(src, dest);
log.save(dest);
};

export const generateBaseCode = async (config: Config) => {
const iconBase = config.typescript ? "iconBase.tsx" : "iconBase.jsx";
Expand All @@ -13,15 +23,13 @@ export const generateBaseCode = async (config: Config) => {

await fs.mkdir(outputPath, { recursive: true });
await Promise.all([
fs.copyFile(
copyFile(
path.join(templatesPath, iconBase),
path.join(outputPath, iconBase)
),
fs.copyFile(
copyFile(
path.join(templatesPath, iconContext),
path.join(outputPath, iconContext)
),
]);
log.save(path.join(config.outputPath, iconBase));
log.save(path.join(config.outputPath, iconContext));
};

0 comments on commit 374bc6b

Please sign in to comment.