Skip to content

Commit

Permalink
fix: Delete dts folders also.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jan 14, 2021
1 parent 25582fb commit afc7f6f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/TypesArtifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,20 @@ export default class TypesArtifact extends Artifact<TypesBuild> {
protected async removeDeclarationBuild(dtsBuildPath: Path) {
const outputs = new Set<string>(this.builds.map(({ outputName }) => `${outputName}.d.ts`));

// Remove all non-output files and folders
const files = await glob(['*'], {
// Remove all non-output files
const files = await glob('*', {
cwd: dtsBuildPath.path(),
onlyFiles: true,
});

// Remove all folders
const folders = await glob('*', {
cwd: dtsBuildPath.path(),
onlyDirectories: true,
});

await Promise.all(
files
[...files, ...folders]
.filter((file) => !outputs.has(file))
.map((file) => fs.remove(dtsBuildPath.append(file).path())),
);
Expand Down

0 comments on commit afc7f6f

Please sign in to comment.