Skip to content

Commit

Permalink
perf: 优化文档保存方案
Browse files Browse the repository at this point in the history
  • Loading branch information
geekact committed Jul 21, 2024
1 parent 2680063 commit c9735c6
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/lib/rebuild-dist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export const rebuildDist = async (

{
let backupDTS = await readFile(path.join(backupDir, 'index.d.ts'), 'utf8');
backupDTS = backupDTS.replace(
`export {`,
`${dtsContent}\nexport {${classNames.join(',')},`,
);
backupDTS += `\n${dtsContent}\nexport { ${classNames.join(', ')} };`;
await writeFile(path.join(distDir, 'index.d.ts'), backupDTS);
}

Expand All @@ -34,10 +31,7 @@ export const rebuildDist = async (

{
let backupESM = await readFile(path.join(backupDir, 'esm', 'index.js'), 'utf8');
backupESM = backupESM.replace(
'export {',
`${jsContent}\nexport {\n${classNames.join(',')},`,
);
backupESM += `\n${jsContent}\nexport { ${classNames.join(', ')} };`;
await writeFile(path.join(distDir, 'esm', 'index.js'), backupESM);
}
};

0 comments on commit c9735c6

Please sign in to comment.