MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / cleanRemove

Function cleanRemove

lib/utilities/clean-remove.js:7–29  ·  view source on GitHub ↗
(fileInfo)

Source from the content-addressed store, hash-verified

5const walkUp = require('./walk-up-path');
6
7async function cleanRemove(fileInfo) {
8 try {
9 await fs.stat(fileInfo.outputPath);
10 await fs.remove(fileInfo.outputPath);
11 let paths = walkUp(fileInfo.displayPath).map((thePath) => path.join(fileInfo.outputBasePath, thePath));
12
13 for (let thePath of paths) {
14 let childPaths = await fs.readdir(thePath);
15 if (childPaths.length > 0) {
16 return;
17 }
18
19 await fs.remove(thePath);
20 }
21 } catch (err) {
22 // you tried to destroy a blueprint without first generating it
23 // instead of trying to read dirs that don't exist
24 // swallow error and carry on
25 if (err.code !== 'ENOENT') {
26 throw err;
27 }
28 }
29}
30
31module.exports = cleanRemove;

Callers 2

removeFunction · 0.85

Calls 1

walkUpFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…