Typescriptify the main process code (14/N)

Summary: Converted scripts/yarn-install.js to typescript

Reviewed By: passy

Differential Revision: D20098071

fbshipit-source-id: be56a95a11089cd857efb00e62866213a88b739c
This commit is contained in:
Anton Nikolaev
2020-02-27 05:28:02 -08:00
committed by Facebook Github Bot
parent 2bd61bca87
commit ab0078a13f
3 changed files with 23 additions and 10 deletions

View File

@@ -7,10 +7,12 @@
* @format
*/
const path = require('path');
const util = require('util');
const glob = util.promisify(require('glob'));
const exec = util.promisify(require('child_process').exec);
import path from 'path';
import util from 'util';
import globImport from 'glob';
import {exec as execImport} from 'child_process';
const glob = util.promisify(globImport);
const exec = util.promisify(execImport);
const PACKAGES = [
'headless-tests',
'static',
@@ -30,9 +32,11 @@ Promise.all(
),
)
.then(async packages => {
packages = packages.reduce((acc, cv) => acc.concat(cv), []);
console.log(`Installing dependencies for ${packages.length} plugins`);
for (const pkg of packages) {
const flattenPackages = packages.reduce((acc, cv) => acc.concat(cv), []);
console.log(
`Installing dependencies for ${flattenPackages.length} plugins`,
);
for (const pkg of flattenPackages) {
const {stderr} = await exec(
// This script is itself executed by yarn (as postinstall script),
// therefore another yarn instance is running, while we are trying to