๐Ÿ“ฆ microsoft / playwright

๐Ÿ“„ clean.js ยท 20 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20// @ts-check
const { workspace } = require('../workspace');
const fs = require('fs');
const path = require('path');

const rmSync = (dir) => fs.rmSync(dir, { recursive: true, force: true, maxRetries: 10 });

for (const pkg of workspace.packages()) {
  rmSync(path.join(pkg.path, 'node_modules'));
  rmSync(path.join(pkg.path, 'lib'));
  rmSync(path.join(pkg.path, 'src', 'generated'));
  const bundles = path.join(pkg.path, 'bundles');
  if (fs.existsSync(bundles) && fs.statSync(bundles).isDirectory()) {
    for (const bundle of fs.readdirSync(bundles, { withFileTypes: true })) {
      if (bundle.isDirectory())
        rmSync(path.join(bundles, bundle.name, 'node_modules'));
    }
  }
}