mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
The repository currently has two globbing packages. To minimize the number of packages in the framework repository, the uses of the `glob` package are being converted to `fast-glob` which is used by the tooling repository. The change is mostly mechanical and in this change the build and test scripts are converted. PR Close #53397
32 lines
1 KiB
JavaScript
32 lines
1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Script that deletes all `yarn.lock` files for integration tests and
|
|
* re-builds them from scratch. This script is useful as lock files in
|
|
* integration tests are not necessarily up-to-date, given dependencies
|
|
* being linked from the root `/package.json`, or locally-built 1st party
|
|
* packages being used from tarball archives.
|
|
*/
|
|
|
|
import childProcess from 'child_process';
|
|
import url from 'url';
|
|
import path from 'path';
|
|
import glob from 'fast-glob';
|
|
import fs from 'fs';
|
|
|
|
const containingDir = path.dirname(url.fileURLToPath(import.meta.url));
|
|
const testDirs = glob.sync('*/BUILD.bazel', {cwd: containingDir})
|
|
.map((d) => path.join(containingDir, path.dirname(d)));
|
|
|
|
const yarnTestTmpDir = path.join(containingDir, '.tmp-yarn-cache');
|
|
|
|
for (const testDir of testDirs) {
|
|
fs.rmSync(path.join(testDir, 'yarn.lock'));
|
|
childProcess.spawnSync('yarn', ['install', '--cache-folder', yarnTestTmpDir], {
|
|
cwd: testDir,
|
|
shell: true,
|
|
stdio: 'inherit',
|
|
});
|
|
}
|
|
|
|
fs.rmSync(yarnTestTmpDir, {recursive: true});
|