https://github.com/angular/angular
Raw File
Tip revision: fad1354d50737b8cbbe534ee5866475da7250e70 authored by Alex Rickabaugh on 24 January 2024, 20:50:52 UTC
release: cut the v17.2.0-next.0 release
Tip revision: fad1354
update-lock-files.mjs
#!/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});
back to top