From f919a0d1a3f74102da6beb2891bcb651d1a4c837 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 16 Mar 2020 16:49:21 -0700 Subject: [PATCH] fixed issue where install script errors were not properly propagated Summary: Our post install scripts didn't propagate installation errors in CI (or locally), leading to problems only appearing later in time, causing a lot of lost time {emoji:1f605} Also moved printing what package is installing to _before_ running the script, so that you have actual useful info in case it fails. Compilation errors of pkg and doctor were printed in our CI, but never threw exceptions. Fixed the cause of those compilation errors as well using `skipLibCheck` like done in the root tsconfig Reviewed By: jknoxville Differential Revision: D20470985 fbshipit-source-id: 1b13d4d2c096f253cc9c1f0aac06982fc4aedf55 --- desktop/doctor/tsconfig.json | 3 ++- desktop/pkg/tsconfig.json | 1 + desktop/scripts/yarn-install.ts | 12 ++++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/desktop/doctor/tsconfig.json b/desktop/doctor/tsconfig.json index f79edc0d8..bea878cbc 100644 --- a/desktop/doctor/tsconfig.json +++ b/desktop/doctor/tsconfig.json @@ -5,7 +5,8 @@ "module": "commonjs", "declaration": true, "outDir": "./lib", - "strict": true + "strict": true, + "skipLibCheck": true }, "include": ["src"], "exclude": ["node_modules", "**/__tests__/*"] diff --git a/desktop/pkg/tsconfig.json b/desktop/pkg/tsconfig.json index e328b07da..62a5a4f51 100644 --- a/desktop/pkg/tsconfig.json +++ b/desktop/pkg/tsconfig.json @@ -8,6 +8,7 @@ "strict": true, "importHelpers": true, "esModuleInterop": true, + "skipLibCheck": true, "allowJs": true }, "include": [ diff --git a/desktop/scripts/yarn-install.ts b/desktop/scripts/yarn-install.ts index 9047b6861..1138a21a2 100644 --- a/desktop/scripts/yarn-install.ts +++ b/desktop/scripts/yarn-install.ts @@ -39,7 +39,9 @@ Promise.all( `Installing dependencies for ${flattenPackages.length} plugins`, ); for (const pkg of flattenPackages) { - const {stderr} = await exec( + console.log(`Installing dependencies for ${pkg}...`); + // @ts-ignore + const {stderr, error} = await exec( // This script is itself executed by yarn (as postinstall script), // therefore another yarn instance is running, while we are trying to // install the plugin dependencies. We are setting a different port @@ -52,16 +54,18 @@ Promise.all( }, ); if (stderr) { + if (error && error.code !== 0) { + console.warn(`❌ Installing dependencies for ${pkg} failed`); + throw stderr; + } console.warn(stderr); - } else { - console.log(`Installed dependencies for ${pkg}`); } } }) // eslint-disable-next-line .then(() => console.log('📦 Installed all plugin dependencies!')) .catch(err => { - console.error('❌ Installing plugin dependencies failed.'); console.error(err); + console.error('❌ Installing plugin dependencies failed.'); process.exit(1); });