shlogg · Early preview
Ramu Narasinga @karthik-m22

Removing Files With Node.js In Tsup Source Code

Tsup source code uses Node.js to remove files from file system. cleanDtsFiles function calls removeFiles which uses glob and fs to delete files.

In this article, we review a code snippet from Tsup source code that demonstrates how a file can be removed from file system using Node.js.

I was reading through the Tsup source code, specifically src/index.ts. You will find this below code in that file.

 const experimentalDtsTask = async () => {
  if (!options.dts && options.experimentalDts) {
    const exports = runTypeScriptCompiler(options)
    await runDtsRollup(options, exports)
  }
 }

    
    

    
    




  
  
  runDtsRollup

runDtsRollup is defined in api-extractor.ts and has the below code:

export async function runDtsRollup(...