From 253bd2081c9e84cc02cbc0f93d1f023e9b2b573d Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 18 Feb 2022 16:09:20 +0100 Subject: [PATCH] chore: deprecating the fetch:cookiecutter being installed by default Signed-off-by: blam --- plugins/scaffolder-backend/api-report.md | 29 ++++++++++++------- .../actions/builtin/createBuiltinActions.ts | 26 +++++++++++++++-- .../src/scaffolder/actions/builtin/index.ts | 4 ++- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/plugins/scaffolder-backend/api-report.md b/plugins/scaffolder-backend/api-report.md index c0ff3b3f2b..1bc39ea909 100644 --- a/plugins/scaffolder-backend/api-report.md +++ b/plugins/scaffolder-backend/api-report.md @@ -53,17 +53,26 @@ export type ActionContext = { // @public @deprecated export type CompletedTaskState = TaskCompletionState; -// Warning: (ae-missing-release-tag) "createBuiltinActions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export const createBuiltinActions: (options: { - reader: UrlReader; - integrations: ScmIntegrations; - catalogClient: CatalogApi; - containerRunner?: ContainerRunner; - config: Config; +// @public +export const createBuiltinActions: ( + options: CreateBuiltInActionsOptions, +) => TemplateAction[]; + +// @public +export interface CreateBuiltInActionsOptions { + // (undocumented) additionalTemplateFilters?: Record; -}) => TemplateAction[]; + // (undocumented) + catalogClient: CatalogApi; + // (undocumented) + config: Config; + // @deprecated (undocumented) + containerRunner?: ContainerRunner; + // (undocumented) + integrations: ScmIntegrations; + // (undocumented) + reader: UrlReader; +} // Warning: (ae-missing-release-tag) "createCatalogRegisterAction" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts index 9df2b7146e..c03ba150c2 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts @@ -49,15 +49,32 @@ import { } from './github'; import { TemplateFilter } from '../../../lib'; import { TemplateAction } from '../types'; +import { getRootLogger } from '@backstage/backend-common'; -export const createBuiltinActions = (options: { +/** + * The options passed to {@link createBuiltinActions} + * @public + */ +export interface CreateBuiltInActionsOptions { reader: UrlReader; integrations: ScmIntegrations; catalogClient: CatalogApi; + /** @deprecated when the cookiecutter action is removed this won't be necessary */ containerRunner?: ContainerRunner; config: Config; additionalTemplateFilters?: Record; -}): TemplateAction[] => { +} + +/** + * A function to generate create a list of default actions that the scaffolder provides. + * Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones + * + * @public + * @returns A list of actions that can be used in the scaffolder + */ +export const createBuiltinActions = ( + options: CreateBuiltInActionsOptions, +): TemplateAction[] => { const { reader, integrations, @@ -119,6 +136,11 @@ export const createBuiltinActions = (options: { ]; if (containerRunner) { + getRootLogger().warn( + `[DEPRECATED] The fetch:cookiecutter action will be removed part of the default scaffolder actions in later versions. +You can install the package seperately and remove the containerRunner from the createBuiltInActions to remove this warning, +or you can migrate to using fetch:template https://backstage.io/docs/features/software-templates/builtin-actions#migrating-from-fetchcookiecutter-to-fetchtemplate`, + ); actions.push( createFetchCookiecutterAction({ reader, diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts index 2265f9b4f7..5f4c04cc7d 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts @@ -15,12 +15,14 @@ */ export * from './catalog'; -export { createBuiltinActions } from './createBuiltinActions'; +export * from './createBuiltinActions'; export * from './debug'; export * from './fetch'; export * from './filesystem'; export * from './publish'; export * from './github'; +/** @deprecated please add this package to your own installation manually */ export { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter'; + export { runCommand } from './helpers';