diff --git a/packages/api/cli/src/electron-forge.ts b/packages/api/cli/src/electron-forge.ts index e52ff067a1..069619e64e 100755 --- a/packages/api/cli/src/electron-forge.ts +++ b/packages/api/cli/src/electron-forge.ts @@ -21,13 +21,16 @@ program .command('package', 'Package the current Electron application') .command('make', 'Generate distributables for the current Electron application') .command('publish', 'Publish the current Electron application') - .hook('preSubcommand', async () => { + .hook('preSubcommand', async (_command, subcommand) => { if (!process.argv.includes('--help') && !process.argv.includes('-h')) { - const runner = new Listr( + const runner = new Listr<{ + command: string; + }>( [ { title: 'Checking your system', - task: async (_, task) => { + task: async (ctx, task) => { + ctx.command = subcommand.name(); return await checkSystem(task); }, }, @@ -35,6 +38,7 @@ program { concurrent: false, exitOnError: false, + fallbackRendererCondition: Boolean(process.env.DEBUG) || Boolean(process.env.CI), } ); diff --git a/packages/api/cli/src/util/check-system.ts b/packages/api/cli/src/util/check-system.ts index 17de67482a..9c694c53fc 100644 --- a/packages/api/cli/src/util/check-system.ts +++ b/packages/api/cli/src/util/check-system.ts @@ -109,13 +109,16 @@ type SystemCheckContext = { node: boolean; packageManager: boolean; }; -export async function checkSystem(task: ForgeListrTask) { + +export async function checkSystem(callerTask: ForgeListrTask<{ command: string }>) { if (!(await fs.pathExists(SKIP_SYSTEM_CHECK))) { d('checking system, create ~/.skip-forge-system-check to stop doing this'); - return task.newListr( + return callerTask.newListr<{ command: string } & SystemCheckContext>( [ { title: 'Checking git exists', + // We only call the `initGit` helper in the `init` and `import` commands + enabled: (ctx): boolean => ctx.command === 'init' || ctx.command === 'import', task: async (_, task) => { const gitVersion = await getGitVersion(); if (gitVersion) {