Skip to content

Commit

Permalink
upd(GeneratorScripts): use beforeFileUnlinked hook
Browse files Browse the repository at this point in the history
  • Loading branch information
solvedDev committed Jul 23, 2022
1 parent 0a40986 commit af3ad53
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Plugins/BuiltIn/GeneratorScripts/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,16 @@ export const GeneratorScriptsPlugin: TCompilerPluginFactory<{}> = ({
...new Set([...generatedFiles, ...filesToUpdate]),
])
},

async beforeFileUnlinked(filePath) {
if (isGeneratorScript(filePath)) {
const fileMetadata = getFileMetadata(filePath)
const unlinkedFiles = fileMetadata.get('unlinkedFiles') ?? []
const generatedFiles = fileMetadata.get('generatedFiles') ?? []

await unlinkOutputFiles(generatedFiles)
await compileFiles(unlinkedFiles)
}
},
}
}

0 comments on commit af3ad53

Please sign in to comment.