Merge pull request #19725 from backstage/rugvip/warning

create-app: warn if yarn install is taking a long time
This commit is contained in:
Patrik Oldsberg
2023-09-05 17:57:50 +02:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/create-app': patch
---
Add a notification when `yarn install` is taking a long time.
+8 -1
View File
@@ -31,6 +31,7 @@ import { promisify } from 'util';
import os from 'os';
const TASK_NAME_MAX_LENGTH = 14;
const TEN_MINUTES_MS = 1000 * 60 * 10;
const exec = promisify(execCb);
export type GitConfig = {
@@ -222,7 +223,13 @@ export async function buildAppTask(appDir: string) {
});
};
await runCmd('yarn install');
const installTimeout = setTimeout(() => {
Task.error(
"\n⏱️ It's taking a long time to install dependencies, you may want to exit (Ctrl-C) and run 'yarn install' and 'yarn tsc' manually",
);
}, TEN_MINUTES_MS);
await runCmd('yarn install').finally(() => clearTimeout(installTimeout));
await runCmd('yarn tsc');
}