Skip to content

Commit

Permalink
🏗 Update build-system subpackages before checking types (ampproject#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha authored and rochapablo committed Aug 30, 2021
1 parent d133d29 commit 1de6dbd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion build-system/tasks/check-build-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const globby = require('globby');
const path = require('path');
const {cyan, green} = require('../common/colors');
const {execOrThrow} = require('../common/exec');
const {log} = require('../common/logging');
const {updateSubpackages} = require('../common/update-packages');

/**
* Helper that updates build-system subpackages so their types can be verified.
*/
async function updateBuildSystemSubpackages() {
const packageFiles = globby.sync('build-system/tasks/*/package.json');
for (const packageFile of packageFiles) {
await updateSubpackages(path.dirname(packageFile));
}
}

/**
* Performs type checking on the /build-system directory using TypeScript.
* Configuration is defined in /build-system/tsconfig.json.
*/
function checkBuildSystem() {
async function checkBuildSystem() {
await updateBuildSystemSubpackages();
log('Checking types in', cyan('build-system') + '...');
execOrThrow(
'npx -p typescript tsc --project ./build-system/tsconfig.json',
Expand Down

0 comments on commit 1de6dbd

Please sign in to comment.