Rename BackstageCommand to CliCommand and CommandContext to CliCommandContext

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-13 07:46:09 +01:00
parent 7d055ef0c4
commit 1929a95b97
47 changed files with 114 additions and 114 deletions
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { BackstageCommand, CliPlugin } from '@backstage/cli-node';
import { CliCommand, CliPlugin } from '@backstage/cli-node';
import { OpaqueType } from '@internal/opaque';
export const OpaqueCliPlugin = OpaqueType.create<{
@@ -22,7 +22,7 @@ export const OpaqueCliPlugin = OpaqueType.create<{
versions: {
readonly version: 'v1';
readonly packageName: string;
readonly commands: Promise<ReadonlyArray<BackstageCommand>>;
readonly commands: Promise<ReadonlyArray<CliCommand>>;
};
}>({
type: '@backstage/CliPlugin',
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { BackstageCommand } from '@backstage/cli-node';
import { CliCommand } from '@backstage/cli-node';
import { OpaqueType } from '@internal/opaque';
/** @internal */
@@ -46,7 +46,7 @@ export const OpaqueCommandLeafNode = OpaqueType.create<{
versions: {
readonly version: 'v1';
readonly name: string;
readonly command: BackstageCommand;
readonly command: CliCommand;
};
}>({
type: '@backstage/CommandLeafNode',
+20 -20
View File
@@ -6,21 +6,6 @@
import { JsonValue } from '@backstage/types';
import { Package } from '@manypkg/get-packages';
// @public
export interface BackstageCommand {
deprecated?: boolean;
description: string;
execute:
| ((context: CommandContext) => Promise<void>)
| {
loader: () => Promise<{
default: (context: CommandContext) => Promise<void>;
}>;
};
experimental?: boolean;
path: string[];
}
// @public
export type BackstagePackage = {
dir: string;
@@ -102,13 +87,22 @@ export interface BackstagePackageJson {
}
// @public
export interface CliPlugin {
// (undocumented)
readonly $$type: '@backstage/CliPlugin';
export interface CliCommand {
deprecated?: boolean;
description: string;
execute:
| ((context: CliCommandContext) => Promise<void>)
| {
loader: () => Promise<{
default: (context: CliCommandContext) => Promise<void>;
}>;
};
experimental?: boolean;
path: string[];
}
// @public
export interface CommandContext {
export interface CliCommandContext {
args: string[];
info: {
usage: string;
@@ -116,6 +110,12 @@ export interface CommandContext {
};
}
// @public
export interface CliPlugin {
// (undocumented)
readonly $$type: '@backstage/CliPlugin';
}
// @public
export type ConcurrentTasksOptions<TItem> = {
concurrencyFactor?: number;
@@ -129,7 +129,7 @@ export function createCliPlugin(options: {
name: string;
};
init: (registry: {
addCommand: (command: BackstageCommand) => void;
addCommand: (command: CliCommand) => void;
}) => Promise<void>;
}): CliPlugin;
@@ -15,7 +15,7 @@
*/
import { OpaqueCliPlugin } from '@internal/cli';
import { BackstageCommand, CliPlugin } from './types';
import { CliCommand, CliPlugin } from './types';
/**
* Creates a new CLI plugin that provides commands to the Backstage CLI.
@@ -52,10 +52,10 @@ export function createCliPlugin(options: {
*/
init: (registry: {
/** Registers a new command with the CLI. */
addCommand: (command: BackstageCommand) => void;
addCommand: (command: CliCommand) => void;
}) => Promise<void>;
}): CliPlugin {
const commands: BackstageCommand[] = [];
const commands: CliCommand[] = [];
const commandsPromise = options
.init({ addCommand: command => commands.push(command) })
.then(() => commands);
+1 -1
View File
@@ -15,4 +15,4 @@
*/
export { createCliPlugin } from './createCliPlugin';
export type { BackstageCommand, CommandContext, CliPlugin } from './types';
export type { CliCommand, CliCommandContext, CliPlugin } from './types';
+4 -4
View File
@@ -21,7 +21,7 @@
*
* @public
*/
export interface CommandContext {
export interface CliCommandContext {
/**
* The remaining arguments passed to the command after the command path
* has been resolved. This includes both positional arguments and flags.
@@ -61,7 +61,7 @@ export interface CommandContext {
*
* @public
*/
export interface BackstageCommand {
export interface CliCommand {
/**
* The path segments that define the command's position in the CLI tree.
* For example, `['repo', 'test']` maps to `backstage-cli repo test`.
@@ -99,10 +99,10 @@ export interface BackstageCommand {
* ```
*/
execute:
| ((context: CommandContext) => Promise<void>)
| ((context: CliCommandContext) => Promise<void>)
| {
loader: () => Promise<{
default: (context: CommandContext) => Promise<void>;
default: (context: CliCommandContext) => Promise<void>;
}>;
};
}
@@ -15,10 +15,10 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
import { getAllInstances } from '../lib/storage';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info }, undefined, args);
const { instances, selected } = await getAllInstances();
@@ -15,7 +15,7 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
import { startCallbackServer } from '../lib/localServer';
import { spawn } from 'node:child_process';
import { challengeFromVerifier, generateVerifier } from '../lib/pkce';
@@ -37,7 +37,7 @@ import inquirer from 'inquirer';
const TOKEN_EXCHANGE_TIMEOUT_MS = 30_000;
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { backendUrl, noBrowser, instance: instanceFlag },
} = cli(
@@ -15,7 +15,7 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
import { getSecretStore } from '../lib/secretStore';
import {
removeInstance,
@@ -25,7 +25,7 @@ import {
import { httpJson } from '../lib/http';
import { pickInstance } from '../lib/prompt';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { instance: instanceFlag },
} = cli(
@@ -15,12 +15,12 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
import { accessTokenNeedsRefresh, refreshAccessToken } from '../lib/auth';
import { getSelectedInstance } from '../lib/storage';
import { getSecretStore } from '../lib/secretStore';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { instance: instanceFlag },
} = cli(
@@ -15,11 +15,11 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
import { setSelectedInstance } from '../lib/storage';
import { pickInstance } from '../lib/prompt';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { instance: instanceFlag },
} = cli(
@@ -15,13 +15,13 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
import { httpJson } from '../lib/http';
import { getSelectedInstance } from '../lib/storage';
import { accessTokenNeedsRefresh, refreshAccessToken } from '../lib/auth';
import { getSecretStore } from '../lib/secretStore';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { instance: instanceFlag },
} = cli(
@@ -17,9 +17,9 @@
import fs from 'fs-extra';
import { cli } from 'cleye';
import { createDistWorkspace } from '../lib/packager';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
// Normalize legacy --alwaysYarnPack alias (a genuinely different name, not
// just a casing variant — type-flag handles camelCase/kebab-case natively)
const normalizedArgs = args.map(a => {
@@ -29,9 +29,9 @@ import { buildFrontend } from '../../../lib/buildFrontend';
import { buildBackend } from '../../../lib/buildBackend';
import { isValidUrl } from '../../../lib/urls';
import chalk from 'chalk';
import type { CommandContext } from '../../../../../wiring/types';
import type { CliCommandContext } from '../../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: {
role,
@@ -17,9 +17,9 @@
import { cli } from 'cleye';
import fs from 'fs-extra';
import { targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
await fs.remove(targetPaths.resolve('dist'));
await fs.remove(targetPaths.resolve('dist-types'));
@@ -17,9 +17,9 @@
import { cli } from 'cleye';
import { targetPaths } from '@backstage/cli-common';
import { revertProductionPack } from '../../lib/packager/productionPack';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
await revertProductionPack(targetPaths.dir);
};
@@ -20,9 +20,9 @@ import { targetPaths } from '@backstage/cli-common';
import { productionPack } from '../../lib/packager/productionPack';
import { publishPreflightCheck } from '../../lib/publishing';
import { createTypeDistProject } from '../../lib/typeDistProject';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
publishPreflightCheck({
@@ -19,9 +19,9 @@ import { startPackage } from './startPackage';
import { resolveLinkedWorkspace } from './resolveLinkedWorkspace';
import { findRoleFromCommand } from '../../../lib/role';
import { targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../../wiring/types';
import type { CliCommandContext } from '../../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: {
config,
@@ -29,9 +29,9 @@ import {
import { buildFrontend } from '../../lib/buildFrontend';
import { buildBackend } from '../../lib/buildBackend';
import { createScriptOptionsParser } from '../../lib/optionsParser';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { all, since, minify },
} = cli(
@@ -19,9 +19,9 @@ import fs from 'fs-extra';
import { resolve as resolvePath } from 'node:path';
import { PackageGraph } from '@backstage/cli-node';
import { run, targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
@@ -26,7 +26,7 @@ import { cli } from 'cleye';
import { resolveLinkedWorkspace } from '../package/start/resolveLinkedWorkspace';
import { startPackage } from '../package/start/startPackage';
import { parseArgs } from 'node:util';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
const ACCEPTED_PACKAGE_ROLES: Array<PackageRole | undefined> = [
'frontend',
@@ -35,7 +35,7 @@ const ACCEPTED_PACKAGE_ROLES: Array<PackageRole | undefined> = [
'backend-plugin',
];
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { plugin, config, require: requirePath, link, inspect, inspectBrk },
_: namesOrPaths,
@@ -21,11 +21,11 @@ import { JSONSchema7 as JSONSchema } from 'json-schema';
import openBrowser from 'react-dev-utils/openBrowser';
import chalk from 'chalk';
import { loadCliConfig } from '../lib/config';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
const DOCS_URL = 'https://config.backstage.io';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { package: pkg },
} = cli(
@@ -19,9 +19,9 @@ import { stringify as stringifyYaml } from 'yaml';
import { AppConfig, ConfigReader } from '@backstage/config';
import { loadCliConfig } from '../lib/config';
import { ConfigSchema, ConfigVisibility } from '@backstage/config-loader';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { config, lax, frontend, withSecrets, format, package: pkg },
} = cli(
@@ -20,9 +20,9 @@ import { stringify as stringifyYaml } from 'yaml';
import { loadCliConfig } from '../lib/config';
import { JsonObject } from '@backstage/types';
import { mergeConfigSchemas } from '@backstage/config-loader';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { merge, format, package: pkg },
} = cli(
@@ -16,9 +16,9 @@
import { cli } from 'cleye';
import { loadCliConfig } from '../lib/config';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { config, lax, frontend, deprecated, strict, package: pkg },
} = cli(
@@ -23,12 +23,12 @@ import { cli } from 'cleye';
import { GithubCreateAppServer } from './GithubCreateAppServer';
import openBrowser from 'react-dev-utils/openBrowser';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
// This is an experimental command that at this point does not support GitHub Enterprise
// due to lacking support for creating apps from manifests.
// https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app-from-a-manifest
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const { _: positionals } = cli(
{
help: { ...info, usage: `${info.usage} <github-org>` },
@@ -25,7 +25,7 @@ import {
} from '@backstage/cli-node';
import { minimatch } from 'minimatch';
import fs from 'fs-extra';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
/**
* Attempts to read package.json from node_modules for a given package name.
@@ -52,7 +52,7 @@ function hasBackstageField(packageName: string, targetPath: string): boolean {
return pkg?.backstage !== undefined;
}
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { include, format },
} = cli(
@@ -18,9 +18,9 @@ import fs from 'fs-extra';
import { cli } from 'cleye';
import { targetPaths } from '@backstage/cli-common';
import { ESLint } from 'eslint';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { fix, format, outputFile, maxWarnings },
_: directories,
@@ -29,7 +29,7 @@ import {
import { targetPaths } from '@backstage/cli-common';
import { createScriptOptionsParser } from '../../lib/optionsParser';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
function depCount(pkg: BackstagePackageJson) {
const deps = pkg.dependencies ? Object.keys(pkg.dependencies).length : 0;
@@ -39,7 +39,7 @@ function depCount(pkg: BackstagePackageJson) {
return deps + devDeps;
}
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
for (const flag of [
'outputFile',
'successCache',
@@ -505,7 +505,7 @@ type PackageFixer = (pkg: FixablePackage, packages: FixablePackage[]) => void;
export default async ({
args,
info,
}: import('../../../../wiring/types').CommandContext) => {
}: import('../../../../wiring/types').CliCommandContext) => {
const {
flags: { publish, check },
} = cli(
@@ -20,9 +20,9 @@ import { cli } from 'cleye';
import { relative as relativePath } from 'node:path';
import { PackageGraph } from '@backstage/cli-node';
import { targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { json },
} = cli(
@@ -15,9 +15,9 @@
*/
import { cli } from 'cleye';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
throw new Error(
'The `migrate package-exports` command has been removed, use `repo fix` instead.',
@@ -19,11 +19,11 @@ import fs from 'fs-extra';
import { resolve as resolvePath } from 'node:path';
import { PackageGraph } from '@backstage/cli-node';
import { runOutput } from '@backstage/cli-common';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
const PREFIX = `module.exports = require('@backstage/cli/config/eslint-factory')`;
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
@@ -20,9 +20,9 @@ import { resolve as resolvePath } from 'node:path';
import { getPackages } from '@manypkg/get-packages';
import { PackageRoles } from '@backstage/cli-node';
import { targetPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const { packages } = await getPackages(targetPaths.dir);
@@ -18,13 +18,13 @@ import { cli } from 'cleye';
import fs from 'fs-extra';
import { resolve as resolvePath } from 'node:path';
import { PackageGraph, PackageRoles, PackageRole } from '@backstage/cli-node';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
const configArgPattern = /--config[=\s][^\s$]+/;
const noStartRoles: PackageRole[] = ['cli', 'cli-plugin', 'common-library'];
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
@@ -18,12 +18,12 @@ import { cli } from 'cleye';
import fs from 'fs-extra';
import { resolve as resolvePath } from 'node:path';
import { PackageGraph, PackageRoles } from '@backstage/cli-node';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
const REACT_ROUTER_DEPS = ['react-router', 'react-router-dom'];
const REACT_ROUTER_RANGE = '6.0.0-beta.0 || ^6.3.0';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
cli({ help: info, booleanFlagNegation: true }, undefined, args);
const packages = await PackageGraph.listTargetPackages();
@@ -48,7 +48,7 @@ import {
import { migrateMovedPackages } from './migrate';
import { runYarnInstall } from '../../lib/utils';
import { run } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
const DEP_TYPES = [
'dependencies',
@@ -74,7 +74,7 @@ function extendsDefaultPattern(pattern: string): boolean {
return minimatch('@backstage/', pattern.slice(0, -1));
}
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { pattern: patternFlag, release, skipInstall, skipMigrate },
} = cli(
@@ -21,7 +21,7 @@ import { readJson, writeJson } from 'fs-extra';
import { minimatch } from 'minimatch';
import { runYarnInstall } from '../../lib/utils';
import replace from 'replace-in-file';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
declare module 'replace-in-file' {
export default function (config: {
@@ -39,7 +39,7 @@ declare module 'replace-in-file' {
>;
}
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { pattern, skipCodeChanges },
} = cli(
@@ -16,7 +16,7 @@
import { createNewPackage } from '../lib/createNewPackage';
import { default as newCommand } from './new';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
jest.mock('../lib/createNewPackage');
@@ -39,7 +39,7 @@ describe.each([
if (scope) {
args.push('--scope', scope);
}
const context: CommandContext = {
const context: CliCommandContext = {
args,
info: { usage: 'backstage-cli new', name: 'new' },
};
+2 -2
View File
@@ -16,9 +16,9 @@
import { cli } from 'cleye';
import { createNewPackage } from '../lib/createNewPackage';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
for (const flag of ['skipInstall', 'npmRegistry', 'baseVersion']) {
if (args.some(a => a === `--${flag}` || a.startsWith(`--${flag}=`))) {
process.stderr.write(
@@ -15,7 +15,7 @@
*/
import { runCheck, findOwnPaths } from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
function includesAnyOf(hayStack: string[], ...needles: string[]) {
for (const needle of needles) {
@@ -26,7 +26,7 @@ function includesAnyOf(hayStack: string[], ...needles: string[]) {
return false;
}
export default async ({ args }: CommandContext) => {
export default async ({ args }: CliCommandContext) => {
// Only include our config if caller isn't passing their own config
if (!includesAnyOf(args, '-c', '--config')) {
/* eslint-disable-next-line no-restricted-syntax */
@@ -31,7 +31,7 @@ import {
findOwnPaths,
isChildPath,
} from '@backstage/cli-common';
import type { CommandContext } from '../../../../wiring/types';
import type { CliCommandContext } from '../../../../wiring/types';
type JestProject = {
displayName: string;
@@ -131,7 +131,7 @@ export function createFlagFinder(args: string[]) {
};
}
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const testGlobal = global as TestGlobal;
for (const flag of ['successCache', 'successCacheDir', 'jestHelp']) {
@@ -33,9 +33,9 @@ import {
formatMessagePath,
validatePattern,
} from '../lib/messageFilePath';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { output, pattern },
} = cli(
@@ -28,7 +28,7 @@ import {
createMessagePathParser,
formatMessagePath,
} from '../lib/messageFilePath';
import type { CommandContext } from '../../../wiring/types';
import type { CliCommandContext } from '../../../wiring/types';
interface ManifestRefEntry {
package: string;
@@ -41,7 +41,7 @@ interface Manifest {
refs: Record<string, ManifestRefEntry>;
}
export default async ({ args, info }: CommandContext) => {
export default async ({ args, info }: CliCommandContext) => {
const {
flags: { input, output },
} = cli(
+3 -3
View File
@@ -18,7 +18,7 @@ import {
OpaqueCommandTreeNode,
OpaqueCommandLeafNode,
} from '@internal/cli';
import { BackstageCommand } from './types';
import { CliCommand } from './types';
/**
* A sparse graph of commands.
@@ -30,7 +30,7 @@ export class CommandGraph {
* Adds a command to the graph. The graph is sparse, so we use the path to determine the nodes
* to traverse. Only leaf nodes should have a command/action.
*/
add(command: BackstageCommand) {
add(command: CliCommand) {
const path = command.path;
let current = this.graph;
for (let i = 0; i < path.length - 1; i++) {
@@ -79,7 +79,7 @@ export class CommandGraph {
/**
* Given a path, try to find a command that matches it.
*/
find(path: string[]): BackstageCommand | undefined {
find(path: string[]): CliCommand | undefined {
let current = this.graph;
for (let i = 0; i < path.length - 1; i++) {
const name = path[i];
+2 -2
View File
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { CommandGraph } from './CommandGraph';
import { BackstageCommand } from './types';
import { CliCommand } from './types';
export class CommandRegistry {
private graph: CommandGraph;
@@ -22,7 +22,7 @@ export class CommandRegistry {
this.graph = graph;
}
addCommand(command: BackstageCommand) {
addCommand(command: CliCommand) {
this.graph.add(command);
}
}
+2 -2
View File
@@ -15,7 +15,7 @@
*/
export type {
CommandContext,
BackstageCommand,
CliCommandContext,
CliCommand,
CliPlugin,
} from '@backstage/cli-node';