Skip to content

Commit

Permalink
🏗 Skip NPM checks while type-checking build-system (#34557)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha authored May 26, 2021
1 parent 6a05883 commit 0498852
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions build-system/common/update-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,13 @@ function updatePackages() {
* 2. During local development, do an incremental install if necessary.
* 3. Since install scripts can be async, `await` the process object.
* 4. Since script output is noisy, capture and print the stderr if needed.
* 5. During CI, make sure that the package files were correctly updated.
* 5. During CI, if not skipped, ensure package files were correctly updated.
*
* @param {string} dir
* @param {boolean=} skipNpmChecks
* @return {Promise<void>}
*/
async function updateSubpackages(dir) {
async function updateSubpackages(dir, skipNpmChecks = false) {
const results = checkDependencies.sync({packageDir: dir});
const relativeDir = path.relative(process.cwd(), dir);
if (results.depsWereOk) {
Expand All @@ -289,7 +290,7 @@ async function updateSubpackages(dir) {
throw new Error('Installation failed');
}
}
if (isCiBuild()) {
if (isCiBuild() && !skipNpmChecks) {
runNpmChecks(dir);
}
}
Expand Down
4 changes: 3 additions & 1 deletion build-system/tasks/check-build-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ const {updateSubpackages} = require('../common/update-packages');

/**
* Helper that updates build-system subpackages so their types can be verified.
* Skips NPM checks during CI (already done while running each task).
*/
async function updateBuildSystemSubpackages() {
const packageFiles = globby.sync('build-system/tasks/*/package.json');
for (const packageFile of packageFiles) {
await updateSubpackages(path.dirname(packageFile));
const packageDir = path.dirname(packageFile);
await updateSubpackages(packageDir, /* skipNpmChecks */ true);
}
}

Expand Down

0 comments on commit 0498852

Please sign in to comment.