Skip to content

Commit e6197cc

Browse files
committed
feat(creating): remove duplicate files in create mode processing
1 parent cf226a6 commit e6197cc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/modules/commands/creating.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,15 @@ export async function creating(_buildOptions: TCommandBuildOptions, createOption
221221
...filePathTree,
222222
];
223223

224+
// Remove duplicates based on path
225+
const uniqueCreateModeFiles = createModeFiles.filter(
226+
(file, index, self) => self.findIndex((f) => f.path === file.path) === index,
227+
);
228+
224229
ProgressBar.it.head = ' export ';
225-
ProgressBar.it.start(createModeFiles.length, 0);
230+
ProgressBar.it.start(uniqueCreateModeFiles.length, 0);
226231

227-
createModeFiles.forEach((dirPath) => {
232+
uniqueCreateModeFiles.forEach((dirPath) => {
228233
const dirPathStatements = getExportStatementFromMap(dirPath.path, dirPathMap);
229234
const dirPathRenderDatas = dirPathStatements.map((statement) => {
230235
const filePath = posixJoin(statement.path.dirPath, filenamify(statement.path.filename));

0 commit comments

Comments
 (0)