Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(build): clean all packages, not just published ones (#40469)

Yury Semikhatsky95a1211e1cc2
diff --git a/utils/build/clean.js b/utils/build/clean.js
index 6bd74a3b34..d4d5051a6b 100644
--- a/utils/build/clean.js
+++ b/utils/build/clean.js
@@ -1,16 +1,19 @@
// @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, 'dist'));
- rmSync(path.join(pkg.path, 'src', 'generated'));
- const bundles = path.join(pkg.path, 'bundles');
+const packagesDir = path.join(__dirname, '..', '..', 'packages');
+for (const entry of fs.readdirSync(packagesDir, { withFileTypes: true })) {
+ if (!entry.isDirectory())
+ continue;
+ const pkgPath = path.join(packagesDir, entry.name);
+ rmSync(path.join(pkgPath, 'node_modules'));
+ rmSync(path.join(pkgPath, 'lib'));
+ rmSync(path.join(pkgPath, 'dist'));
+ rmSync(path.join(pkgPath, 'src', 'generated'));
+ const bundles = path.join(pkgPath, 'bundles');
if (fs.existsSync(bundles) && fs.statSync(bundles).isDirectory()) {
for (const bundle of fs.readdirSync(bundles, { withFileTypes: true })) {
if (bundle.isDirectory())