Merge cli-plugin-api into cli-node
Move createCliPlugin and related types from the standalone @backstage/cli-plugin-api package into @backstage/cli-node and remove the now-empty package. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli-node': minor
|
||||
---
|
||||
|
||||
Added `createCliPlugin` API and related types for building Backstage CLI plugins.
|
||||
@@ -2,4 +2,4 @@
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Migrated CLI plugin modules to use `createCliPlugin` from the new `@backstage/cli-plugin-api` package.
|
||||
Migrated CLI plugin modules to use `createCliPlugin` from `@backstage/cli-node`.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@backstage/cli-plugin-api': minor
|
||||
---
|
||||
|
||||
Added a new `@backstage/cli-plugin-api` package that provides the `createCliPlugin` API for building Backstage CLI plugins.
|
||||
@@ -22,7 +22,7 @@
|
||||
"test": "backstage-cli package test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/cli-plugin-api": "workspace:^"
|
||||
"@backstage/cli-node": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BackstageCommand, CliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { BackstageCommand, CliPlugin } from '@backstage/cli-node';
|
||||
import { OpaqueType } from '@internal/opaque';
|
||||
|
||||
export const OpaqueCliPlugin = OpaqueType.create<{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BackstageCommand } from '@backstage/cli-plugin-api';
|
||||
import { BackstageCommand } from '@backstage/cli-node';
|
||||
import { OpaqueType } from '@internal/opaque';
|
||||
|
||||
/** @internal */
|
||||
|
||||
@@ -6,6 +6,21 @@
|
||||
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;
|
||||
@@ -86,6 +101,21 @@ export interface BackstagePackageJson {
|
||||
version: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CliPlugin {
|
||||
// (undocumented)
|
||||
readonly $$type: '@backstage/CliPlugin';
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CommandContext {
|
||||
args: string[];
|
||||
info: {
|
||||
usage: string;
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ConcurrentTasksOptions<TItem> = {
|
||||
concurrencyFactor?: number;
|
||||
@@ -93,6 +123,16 @@ export type ConcurrentTasksOptions<TItem> = {
|
||||
worker: (item: TItem) => Promise<void>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export function createCliPlugin(options: {
|
||||
packageJson: {
|
||||
name: string;
|
||||
};
|
||||
init: (registry: {
|
||||
addCommand: (command: BackstageCommand) => void;
|
||||
}) => Promise<void>;
|
||||
}): CliPlugin;
|
||||
|
||||
// @public
|
||||
export class GitUtils {
|
||||
static listChangedFiles(ref: string): Promise<string[]>;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import { BackstageCommand, CliPlugin } from './types';
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
* import { createCliPlugin } from '@backstage/cli-node';
|
||||
* import packageJson from '../package.json';
|
||||
*
|
||||
* export default createCliPlugin({
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
export * from './cache';
|
||||
export * from './cli-plugin';
|
||||
export * from './concurrency';
|
||||
export * from './git';
|
||||
export * from './monorepo';
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
@@ -1,10 +0,0 @@
|
||||
apiVersion: backstage.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: backstage-cli-plugin-api
|
||||
title: '@backstage/cli-plugin-api'
|
||||
description: API for building Backstage CLI plugins
|
||||
spec:
|
||||
lifecycle: experimental
|
||||
type: backstage-cli-plugin
|
||||
owner: tooling-maintainers
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"name": "@backstage/cli-plugin-api",
|
||||
"version": "0.1.0",
|
||||
"description": "API for building Backstage CLI plugins",
|
||||
"backstage": {
|
||||
"role": "cli-plugin"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
"types": "dist/index.d.ts"
|
||||
},
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/backstage/backstage",
|
||||
"directory": "packages/cli-plugin-api"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build",
|
||||
"clean": "backstage-cli package clean",
|
||||
"lint": "backstage-cli package lint",
|
||||
"prepack": "backstage-cli package prepack",
|
||||
"postpack": "backstage-cli package postpack",
|
||||
"test": "backstage-cli package test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/errors": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^"
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
## API Report File for "@backstage/cli-plugin-api"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
// @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 CliFeature = CliPlugin;
|
||||
|
||||
// @public
|
||||
export interface CliPlugin {
|
||||
// (undocumented)
|
||||
readonly $$type: '@backstage/CliPlugin';
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface CommandContext {
|
||||
args: string[];
|
||||
info: {
|
||||
usage: string;
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
// @public
|
||||
export function createCliPlugin(options: {
|
||||
packageJson: {
|
||||
name: string;
|
||||
};
|
||||
init: (registry: {
|
||||
addCommand: (command: BackstageCommand) => void;
|
||||
}) => Promise<void>;
|
||||
}): CliPlugin;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -50,7 +50,6 @@
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/cli-common": "workspace:^",
|
||||
"@backstage/cli-node": "workspace:^",
|
||||
"@backstage/cli-plugin-api": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@backstage/config-loader": "workspace:^",
|
||||
"@backstage/errors": "workspace:^",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export const buildPlugin = createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export const configOption = [
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import { NotImplementedError } from '@backstage/errors';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
import { createCliPlugin } from '@backstage/cli-node';
|
||||
import packageJson from '../../../package.json';
|
||||
|
||||
export default createCliPlugin({
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
OpaqueCommandLeafNode,
|
||||
} from '@internal/cli';
|
||||
import type { CommandNode } from '@internal/cli';
|
||||
import type { CliPlugin } from '@backstage/cli-plugin-api';
|
||||
import type { CliPlugin } from '@backstage/cli-node';
|
||||
import { CommandRegistry } from './CommandRegistry';
|
||||
import { Command } from 'commander';
|
||||
import { version } from './version';
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { createCliPlugin } from '@backstage/cli-plugin-api';
|
||||
export { createCliPlugin } from '@backstage/cli-node';
|
||||
|
||||
@@ -18,4 +18,4 @@ export type {
|
||||
CommandContext,
|
||||
BackstageCommand,
|
||||
CliPlugin,
|
||||
} from '@backstage/cli-plugin-api';
|
||||
} from '@backstage/cli-node';
|
||||
|
||||
@@ -2822,15 +2822,6 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/cli-plugin-api@workspace:^, @backstage/cli-plugin-api@workspace:packages/cli-plugin-api":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/cli-plugin-api@workspace:packages/cli-plugin-api"
|
||||
dependencies:
|
||||
"@backstage/cli": "workspace:^"
|
||||
"@backstage/errors": "workspace:^"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/cli@workspace:*, @backstage/cli@workspace:^, @backstage/cli@workspace:packages/cli":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/cli@workspace:packages/cli"
|
||||
@@ -2841,7 +2832,6 @@ __metadata:
|
||||
"@backstage/catalog-model": "workspace:^"
|
||||
"@backstage/cli-common": "workspace:^"
|
||||
"@backstage/cli-node": "workspace:^"
|
||||
"@backstage/cli-plugin-api": "workspace:^"
|
||||
"@backstage/config": "workspace:^"
|
||||
"@backstage/config-loader": "workspace:^"
|
||||
"@backstage/core-app-api": "workspace:^"
|
||||
@@ -9685,7 +9675,7 @@ __metadata:
|
||||
resolution: "@internal/cli@workspace:packages/cli-internal"
|
||||
dependencies:
|
||||
"@backstage/cli": "workspace:^"
|
||||
"@backstage/cli-plugin-api": "workspace:^"
|
||||
"@backstage/cli-node": "workspace:^"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
||||
Reference in New Issue
Block a user