Address PR review feedback
- Rename runParallelWorkers to runConcurrentTasks, return void - Rename ParallelWorkerOptions to ConcurrentTasksOptions - Rename parallelismFactor to concurrencyFactor - Remove unused runWorkerThreads and WorkerThreadsOptions - Rename workerData to context in WorkerQueueThreadsOptions - Drop threadCount from public API types - Rename env var to BACKSTAGE_CLI_CONCURRENCY - Make cli-node changeset a patch Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -23,7 +23,7 @@ import {
|
||||
BackstagePackage,
|
||||
PackageGraph,
|
||||
PackageRoles,
|
||||
runParallelWorkers,
|
||||
runConcurrentTasks,
|
||||
} from '@backstage/cli-node';
|
||||
import { buildFrontend } from '../../lib/buildFrontend';
|
||||
import { buildBackend } from '../../lib/buildBackend';
|
||||
@@ -100,9 +100,9 @@ export async function command(opts: OptionValues, cmd: Command): Promise<void> {
|
||||
|
||||
if (opts.all) {
|
||||
console.log('Building apps');
|
||||
await runParallelWorkers({
|
||||
await runConcurrentTasks({
|
||||
items: apps,
|
||||
parallelismFactor: 1 / 2,
|
||||
concurrencyFactor: 1 / 2,
|
||||
worker: async pkg => {
|
||||
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
||||
if (!buildOptions) {
|
||||
@@ -121,9 +121,9 @@ export async function command(opts: OptionValues, cmd: Command): Promise<void> {
|
||||
});
|
||||
|
||||
console.log('Building backends');
|
||||
await runParallelWorkers({
|
||||
await runConcurrentTasks({
|
||||
items: backends,
|
||||
parallelismFactor: 1 / 2,
|
||||
concurrencyFactor: 1 / 2,
|
||||
worker: async pkg => {
|
||||
const buildOptions = parseBuildScript(pkg.packageJson.scripts?.build);
|
||||
if (!buildOptions) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { relative as relativePath, resolve as resolvePath } from 'node:path';
|
||||
import { paths } from '../../../../lib/paths';
|
||||
import { makeRollupConfigs } from './config';
|
||||
import { BuildOptions, Output } from './types';
|
||||
import { PackageRoles, runParallelWorkers } from '@backstage/cli-node';
|
||||
import { PackageRoles, runConcurrentTasks } from '@backstage/cli-node';
|
||||
|
||||
export function formatErrorMessage(error: any) {
|
||||
let msg = '';
|
||||
@@ -126,7 +126,7 @@ export const buildPackages = async (options: BuildOptions[]) => {
|
||||
|
||||
const buildTasks = rollupConfigs.flat().map(opts => () => rollupBuild(opts));
|
||||
|
||||
await runParallelWorkers({
|
||||
await runConcurrentTasks({
|
||||
items: buildTasks,
|
||||
worker: async task => task(),
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
PackageRoles,
|
||||
PackageGraph,
|
||||
PackageGraphNode,
|
||||
runParallelWorkers,
|
||||
runConcurrentTasks,
|
||||
} from '@backstage/cli-node';
|
||||
import { createTypeDistProject } from '../../../../lib/typeDistProject';
|
||||
|
||||
@@ -220,7 +220,7 @@ export async function createDistWorkspace(
|
||||
await buildPackages(standardBuilds);
|
||||
|
||||
if (customBuild.length > 0) {
|
||||
await runParallelWorkers({
|
||||
await runConcurrentTasks({
|
||||
items: customBuild,
|
||||
worker: async ({ name, dir, args }) => {
|
||||
await run(['yarn', 'run', 'build', ...(args || [])], {
|
||||
@@ -363,7 +363,7 @@ async function moveToDistWorkspace(
|
||||
}
|
||||
|
||||
// Repacking in parallel is much faster and safe for all packages outside of the Backstage repo
|
||||
await runParallelWorkers({
|
||||
await runConcurrentTasks({
|
||||
items: safePackages.map((target, index) => ({ target, index })),
|
||||
worker: async ({ target, index }) => {
|
||||
await pack(target, `temp-package-${index}.tgz`);
|
||||
|
||||
@@ -107,7 +107,7 @@ export async function command(opts: OptionValues, cmd: Command): Promise<void> {
|
||||
|
||||
const resultsList = await runWorkerQueueThreads({
|
||||
items: items.filter(item => item.lintOptions), // Filter out packages without lint script
|
||||
workerData: {
|
||||
context: {
|
||||
fix: Boolean(opts.fix),
|
||||
format: opts.format as string | undefined,
|
||||
shouldCache: Boolean(cacheContext),
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
mapDependencies,
|
||||
YarnInfoInspectData,
|
||||
} from '../../../../lib/versioning';
|
||||
import { runParallelWorkers } from '@backstage/cli-node';
|
||||
import { runConcurrentTasks } from '@backstage/cli-node';
|
||||
import {
|
||||
getManifestByReleaseLine,
|
||||
getManifestByVersion,
|
||||
@@ -145,8 +145,8 @@ export default async (opts: OptionValues) => {
|
||||
// Next check with the package registry to see which dependency ranges we need to bump
|
||||
const versionBumps = new Map<string, PkgVersionInfo[]>();
|
||||
|
||||
await runParallelWorkers({
|
||||
parallelismFactor: 4,
|
||||
await runConcurrentTasks({
|
||||
concurrencyFactor: 4,
|
||||
items: dependencyMap.entries(),
|
||||
async worker([name, pkgs]) {
|
||||
let target: string;
|
||||
@@ -182,8 +182,8 @@ export default async (opts: OptionValues) => {
|
||||
console.log();
|
||||
|
||||
const breakingUpdates = new Map<string, { from: string; to: string }>();
|
||||
await runParallelWorkers({
|
||||
parallelismFactor: 4,
|
||||
await runConcurrentTasks({
|
||||
concurrencyFactor: 4,
|
||||
items: versionBumps.entries(),
|
||||
async worker([name, deps]) {
|
||||
const pkgPath = resolvePath(deps[0].location, 'package.json');
|
||||
|
||||
Reference in New Issue
Block a user