Skip to content

Commit

Permalink
chore: update listr2 version (#3542)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Cui <github@bugs.cc>
  • Loading branch information
yangannyx and BlackHole1 committed Apr 2, 2024
1 parent 38b6792 commit f2a23f1
Show file tree
Hide file tree
Showing 25 changed files with 176 additions and 99 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"got": "^11.8.5",
"html-webpack-plugin": "^5.5.3",
"interpret": "^3.1.1",
"listr2": "^7.0.2",
"lodash": "^4.17.20",
"log-symbols": "^4.0.0",
"mime-types": "^2.1.25",
Expand Down Expand Up @@ -134,7 +135,6 @@
"inquirer": "^8.0.0",
"lerna": "^6.6.2",
"lint-staged": "^12.1.7",
"listr2": "^5.0.3",
"minimist": "^1.2.6",
"mocha": "^9.0.1",
"mocha-junit-reporter": "^2.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"commander": "^4.1.1",
"debug": "^4.3.1",
"fs-extra": "^10.0.0",
"listr2": "^5.0.3",
"listr2": "^7.0.2",
"semver": "^7.2.1"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/cli/src/electron-forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ program

await runner.run();

if (runner.err.length) {
if (runner.errors.length) {
console.error(
chalk.red(`\nIt looks like you are missing some dependencies you need to get Electron running.
Make sure you have git installed and Node.js version ${metadata.engines.node}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/api/cli/src/util/check-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function checkSystem(task: ForgeListrTask<never>) {
concurrent: true,
exitOnError: false,
rendererOptions: {
collapse: true,
collapseSubtasks: true,
},
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/api/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"fs-extra": "^10.0.0",
"got": "^11.8.5",
"interpret": "^3.1.1",
"listr2": "^5.0.3",
"listr2": "^7.0.2",
"lodash": "^4.17.20",
"log-symbols": "^4.0.0",
"node-fetch": "^2.6.7",
Expand Down
14 changes: 7 additions & 7 deletions packages/api/core/src/api/import.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';

import { safeYarnOrNpm, updateElectronDependency } from '@electron-forge/core-utils';
import { ForgeListrTaskFn } from '@electron-forge/shared-types';
import { ForgeListrOptions, ForgeListrTaskFn } from '@electron-forge/shared-types';
import baseTemplate from '@electron-forge/template-base';
import { autoTrace } from '@electron-forge/tracer';
import chalk from 'chalk';
Expand Down Expand Up @@ -58,14 +58,14 @@ export default autoTrace(
childTrace,
{ dir = process.cwd(), interactive = false, confirmImport, shouldContinueOnExisting, shouldRemoveDependency, shouldUpdateScript, outDir }: ImportOptions
): Promise<void> => {
const listrOptions = {
const listrOptions: ForgeListrOptions<unknown> = {
concurrent: false,
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
rendererSilent: !interactive,
rendererFallback: Boolean(process.env.DEBUG),
silentRendererCondition: !interactive,
fallbackRendererCondition: Boolean(process.env.DEBUG) || Boolean(process.env.CI),
};

const runner = new Listr(
Expand All @@ -91,7 +91,7 @@ export default autoTrace(
},
{
title: 'Processing configuration and dependencies',
options: {
rendererOptions: {
persistentOutput: true,
bottomBar: Infinity,
},
Expand Down Expand Up @@ -251,7 +251,7 @@ export default autoTrace(
},
{
title: 'Finalizing import',
options: {
rendererOptions: {
persistentOutput: true,
bottomBar: Infinity,
},
Expand Down
8 changes: 3 additions & 5 deletions packages/api/core/src/api/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export default async ({ dir = process.cwd(), interactive = false, copyCIFiles =
await initDirectory(dir, task, force);
await initGit(dir);
},
options: {
persistentOutput: true,
},
rendererOptions: { persistentOutput: true },
},
{
title: 'Preparing template',
Expand Down Expand Up @@ -153,8 +151,8 @@ export default async ({ dir = process.cwd(), interactive = false, copyCIFiles =
],
{
concurrent: false,
rendererSilent: !interactive,
rendererFallback: Boolean(process.env.DEBUG),
silentRendererCondition: !interactive,
fallbackRendererCondition: Boolean(process.env.DEBUG) || Boolean(process.env.CI),
}
);

Expand Down
23 changes: 12 additions & 11 deletions packages/api/core/src/api/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MakerBase } from '@electron-forge/maker-base';
import {
ForgeArch,
ForgeConfigMaker,
ForgeListrOptions,
ForgeListrTaskFn,
ForgeMakeResult,
ForgePlatform,
Expand All @@ -16,7 +17,7 @@ import { getHostArch } from '@electron/get';
import chalk from 'chalk';
import filenamify from 'filenamify';
import fs from 'fs-extra';
import { Listr } from 'listr2';
import { Listr, PRESET_TIMER } from 'listr2';
import logSymbols from 'log-symbols';

import getForgeConfig from '../util/forge-config';
Expand Down Expand Up @@ -109,14 +110,14 @@ export const listrMake = (
}: MakeOptions,
receiveMakeResults?: (results: ForgeMakeResult[]) => void
) => {
const listrOptions = {
const listrOptions: ForgeListrOptions<MakeContext> = {
concurrent: false,
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
rendererSilent: !interactive,
rendererFallback: Boolean(process.env.DEBUG),
silentRendererCondition: !interactive,
fallbackRendererCondition: Boolean(process.env.DEBUG) || Boolean(process.env.CI),
};

const runner = new Listr<MakeContext>(
Expand Down Expand Up @@ -206,7 +207,7 @@ export const listrMake = (
task.output = `Making for the following targets: ${chalk.magenta(`${makers.map((maker) => maker.name).join(', ')}`)}`;
}
),
options: {
rendererOptions: {
persistentOutput: true,
},
},
Expand All @@ -230,7 +231,7 @@ export const listrMake = (
task.skip();
}
}),
options: {
rendererOptions: {
persistentOutput: true,
},
},
Expand Down Expand Up @@ -258,7 +259,7 @@ export const listrMake = (
...listrOptions,
concurrent: true,
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
});
Expand Down Expand Up @@ -300,8 +301,8 @@ export const listrMake = (
}
}
}),
options: {
showTimer: true,
rendererOptions: {
timer: { ...PRESET_TIMER },
},
});
}
Expand All @@ -321,7 +322,7 @@ export const listrMake = (

task.output = `Artifacts available at: ${chalk.green(path.resolve(ctx.actualOutDir, 'make'))}`;
}),
options: {
rendererOptions: {
persistentOutput: true,
},
},
Expand Down
24 changes: 12 additions & 12 deletions packages/api/core/src/api/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import chalk from 'chalk';
import debug from 'debug';
import glob from 'fast-glob';
import fs from 'fs-extra';
import { Listr } from 'listr2';
import { Listr, PRESET_TIMER } from 'listr2';

import getForgeConfig from '../util/forge-config';
import { getHookListrTasks, runHook } from '../util/hook';
Expand Down Expand Up @@ -399,8 +399,8 @@ export const listrPackage = (
task: async () => {
await addSignalAndWait(signalPackageDone, target);
},
options: {
showTimer: true,
rendererOptions: {
timer: { ...PRESET_TIMER },
},
}
: {
Expand Down Expand Up @@ -431,10 +431,10 @@ export const listrPackage = (
signalRebuildStart.get(getTargetKey(target))?.pop()?.(task);
await addSignalAndWait(signalRebuildDone, target);
}),
options: {
rendererOptions: {
persistentOutput: true,
bottomBar: Infinity,
showTimer: true,
timer: { ...PRESET_TIMER },
},
},
{
Expand All @@ -444,18 +444,18 @@ export const listrPackage = (
}),
},
],
{ rendererOptions: { collapse: true, collapseErrors: false } }
{ rendererOptions: { collapseSubtasks: true, collapseErrors: false } }
),
'run'
);
}
),
options: {
showTimer: true,
rendererOptions: {
timer: { ...PRESET_TIMER },
},
}
),
{ concurrent: true, rendererOptions: { collapse: false, collapseErrors: false } }
{ concurrent: true, rendererOptions: { collapseSubtasks: false, collapseErrors: false } }
),
'run'
);
Expand Down Expand Up @@ -486,10 +486,10 @@ export const listrPackage = (
],
{
concurrent: false,
rendererSilent: !interactive,
rendererFallback: Boolean(process.env.DEBUG),
silentRendererCondition: !interactive,
fallbackRendererCondition: Boolean(process.env.DEBUG) || Boolean(process.env.CI),
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
ctx: {} as PackageContext,
Expand Down
19 changes: 10 additions & 9 deletions packages/api/core/src/api/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import { PublisherBase } from '@electron-forge/publisher-base';
import {
ForgeConfigPublisher,
ForgeListrOptions,
ForgeListrTask,
ForgeListrTaskFn,
ForgeMakeResult,
Expand Down Expand Up @@ -86,13 +87,13 @@ export default autoTrace(
throw new Error("Can't dry run and resume a dry run at the same time");
}

const listrOptions = {
const listrOptions: ForgeListrOptions<PublishContext> = {
concurrent: false,
rendererOptions: {
collapseErrors: false,
},
rendererSilent: !interactive,
rendererFallback: Boolean(process.env.DEBUG),
silentRendererCondition: !interactive,
fallbackRendererCondition: Boolean(process.env.DEBUG) || Boolean(process.env.CI),
};

const publishDistributablesTasks = (childTrace: typeof autoTrace) => [
Expand Down Expand Up @@ -126,13 +127,13 @@ export default autoTrace(
});
}
),
options: {
rendererOptions: {
persistentOutput: true,
},
})),
{
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
}
Expand All @@ -141,7 +142,7 @@ export default autoTrace(
);
}
),
options: {
rendererOptions: {
persistentOutput: true,
},
},
Expand Down Expand Up @@ -215,7 +216,7 @@ export default autoTrace(
}
}
),
options: {
rendererOptions: {
persistentOutput: true,
},
},
Expand Down Expand Up @@ -267,7 +268,7 @@ export default autoTrace(
makeResults: restoredMakeResults,
},
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
}),
Expand All @@ -279,7 +280,7 @@ export default autoTrace(
}),
{
rendererOptions: {
collapse: false,
collapseSubtasks: false,
collapseErrors: false,
},
}
Expand Down
Loading

0 comments on commit f2a23f1

Please sign in to comment.