Rename CliPlugin to CliModule and cli-plugin role to cli-module
Rename createCliPlugin to createCliModule, CliPlugin to CliModule, and the cli-plugin package role to cli-module to better distinguish CLI modules from other plugin types. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -111,9 +111,9 @@ export interface CliCommandContext {
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CliPlugin {
|
||||
export interface CliModule {
|
||||
// (undocumented)
|
||||
readonly $$type: '@backstage/CliPlugin';
|
||||
readonly $$type: '@backstage/CliModule';
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -124,14 +124,14 @@ export type ConcurrentTasksOptions<TItem> = {
|
||||
};
|
||||
|
||||
// @public
|
||||
export function createCliPlugin(options: {
|
||||
export function createCliModule(options: {
|
||||
packageJson: {
|
||||
name: string;
|
||||
};
|
||||
init: (registry: {
|
||||
addCommand: (command: CliCommand) => void;
|
||||
}) => Promise<void>;
|
||||
}): CliPlugin;
|
||||
}): CliModule;
|
||||
|
||||
// @public
|
||||
export class GitUtils {
|
||||
@@ -227,7 +227,7 @@ export type PackageRole =
|
||||
| 'frontend'
|
||||
| 'backend'
|
||||
| 'cli'
|
||||
| 'cli-plugin'
|
||||
| 'cli-module'
|
||||
| 'web-library'
|
||||
| 'node-library'
|
||||
| 'common-library'
|
||||
|
||||
+7
-7
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { OpaqueCliPlugin } from '@internal/cli';
|
||||
import { CliCommand, CliPlugin } from './types';
|
||||
import { OpaqueCliModule } from '@internal/cli';
|
||||
import { CliCommand, CliModule } from './types';
|
||||
|
||||
/**
|
||||
* Creates a new CLI plugin that provides commands to the Backstage CLI.
|
||||
@@ -26,10 +26,10 @@ import { CliCommand, CliPlugin } from './types';
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* import { createCliPlugin } from '@backstage/cli-node';
|
||||
* import { createCliModule } from '@backstage/cli-node';
|
||||
* import packageJson from '../package.json';
|
||||
*
|
||||
* export default createCliPlugin({
|
||||
* export default createCliModule({
|
||||
* packageJson,
|
||||
* init: async reg => {
|
||||
* reg.addCommand({
|
||||
@@ -43,7 +43,7 @@ import { CliCommand, CliPlugin } from './types';
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function createCliPlugin(options: {
|
||||
export function createCliModule(options: {
|
||||
/** The `package.json` contents of the plugin package, used to identify the plugin. */
|
||||
packageJson: { name: string };
|
||||
/**
|
||||
@@ -54,13 +54,13 @@ export function createCliPlugin(options: {
|
||||
/** Registers a new command with the CLI. */
|
||||
addCommand: (command: CliCommand) => void;
|
||||
}) => Promise<void>;
|
||||
}): CliPlugin {
|
||||
}): CliModule {
|
||||
const commands: CliCommand[] = [];
|
||||
const commandsPromise = options
|
||||
.init({ addCommand: command => commands.push(command) })
|
||||
.then(() => commands);
|
||||
|
||||
return OpaqueCliPlugin.createInstance('v1', {
|
||||
return OpaqueCliModule.createInstance('v1', {
|
||||
packageName: options.packageJson.name,
|
||||
commands: commandsPromise,
|
||||
});
|
||||
+2
-2
@@ -14,5 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { createCliPlugin } from './createCliPlugin';
|
||||
export type { CliCommand, CliCommandContext, CliPlugin } from './types';
|
||||
export { createCliModule } from './createCliModule';
|
||||
export type { CliCommand, CliCommandContext, CliModule } from './types';
|
||||
+3
-3
@@ -109,10 +109,10 @@ export interface CliCommand {
|
||||
|
||||
/**
|
||||
* An opaque representation of a Backstage CLI plugin, created
|
||||
* using {@link createCliPlugin}.
|
||||
* using {@link createCliModule}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface CliPlugin {
|
||||
readonly $$type: '@backstage/CliPlugin';
|
||||
export interface CliModule {
|
||||
readonly $$type: '@backstage/CliModule';
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
|
||||
export * from './cache';
|
||||
export * from './cli-plugin';
|
||||
export * from './cli-module';
|
||||
export * from './concurrency';
|
||||
export * from './git';
|
||||
export * from './monorepo';
|
||||
|
||||
@@ -34,7 +34,7 @@ const packageRoleInfos: PackageRoleInfo[] = [
|
||||
output: ['cjs'],
|
||||
},
|
||||
{
|
||||
role: 'cli-plugin',
|
||||
role: 'cli-module',
|
||||
platform: 'node',
|
||||
output: ['types', 'cjs'],
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ export type PackageRole =
|
||||
| 'frontend'
|
||||
| 'backend'
|
||||
| 'cli'
|
||||
| 'cli-plugin'
|
||||
| 'cli-module'
|
||||
| 'web-library'
|
||||
| 'node-library'
|
||||
| 'common-library'
|
||||
|
||||
Reference in New Issue
Block a user