File: clean-dependencies.mjs

package info (click to toggle)
node-core-js 3.33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 18,828 kB
  • sloc: javascript: 87,204; makefile: 13
file content (25 lines) | stat: -rw-r--r-- 658 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { readdir, rm } from 'node:fs/promises';

const ignore = new Set([
  'scripts/usage',
  'tests/test262',
  'tests/unit-bun',
]);

const folders = [''].concat(...await Promise.all([
  'packages',
  'scripts',
  'tests',
].map(async parent => {
  const dir = await readdir(parent);
  return dir.map(name => `${ parent }/${ name }`);
})));

await Promise.all(folders.map(async folder => {
  if (!ignore.has(folder)) try {
    await rm(`./${ folder }/package-lock.json`, { force: true });
    await rm(`./${ folder }/node_modules`, { force: true, recursive: true });
  } catch { /* empty */ }
}));

console.log('\u001B[32mdependencies cleaned\u001B[0m');