Address further review feedback

- Rename hasYarnPlugin -> hasBackstageYarnPlugin for clarity
- Change SuccessCache.create to accept an options object

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-25 15:25:11 +01:00
parent 968570bbb5
commit 09eb6b5187
10 changed files with 37 additions and 26 deletions
@@ -41,7 +41,10 @@ function depCount(pkg: BackstagePackageJson) {
export async function command(opts: OptionValues, cmd: Command): Promise<void> {
let packages = await PackageGraph.listTargetPackages();
const cache = SuccessCache.create('lint', opts.successCacheDir);
const cache = SuccessCache.create({
name: 'lint',
basePath: opts.successCacheDir,
});
const cacheContext = opts.successCache
? {
entries: await cache.read(),
@@ -31,7 +31,7 @@ import { isError, NotFoundError } from '@backstage/errors';
import { resolve as resolvePath } from 'node:path';
import {
hasYarnPlugin,
hasBackstageYarnPlugin,
Lockfile,
runConcurrentTasks,
} from '@backstage/cli-node';
@@ -76,7 +76,7 @@ function extendsDefaultPattern(pattern: string): boolean {
export default async (opts: OptionValues) => {
const lockfilePath = targetPaths.resolveRoot('yarn.lock');
const lockfile = await Lockfile.load(lockfilePath);
const yarnPluginEnabled = await hasYarnPlugin();
const yarnPluginEnabled = await hasBackstageYarnPlugin();
let pattern = opts.pattern;
@@ -28,7 +28,7 @@ import { Lockfile } from '@backstage/cli-node';
import { targetPaths } from '@backstage/cli-common';
import { createPackageVersionProvider } from '../../../../lib/version';
import { hasYarnPlugin } from '@backstage/cli-node';
import { hasBackstageYarnPlugin } from '@backstage/cli-node';
const builtInHelpers = {
camelCase,
@@ -55,7 +55,7 @@ export class PortableTemplater {
/* ignored */
}
const yarnPluginEnabled = await hasYarnPlugin();
const yarnPluginEnabled = await hasBackstageYarnPlugin();
const versionProvider = createPackageVersionProvider(lockfile, {
preferBackstageProtocol: yarnPluginEnabled,
});
@@ -332,7 +332,10 @@ export async function command(opts: OptionValues, cmd: Command): Promise<void> {
);
}
const cache = SuccessCache.create('test', opts.successCacheDir);
const cache = SuccessCache.create({
name: 'test',
basePath: opts.successCacheDir,
});
const graph = await getPackageGraph();
// Shared state for the bridge