diff --git a/.changeset/funny-cars-jump.md b/.changeset/funny-cars-jump.md new file mode 100644 index 0000000000..cbaf01c7d0 --- /dev/null +++ b/.changeset/funny-cars-jump.md @@ -0,0 +1,24 @@ +--- +'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch +'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch +'@backstage/backend-dynamic-feature-service': patch +'@backstage/plugin-scaffolder-backend-module-github': patch +'@backstage/plugin-scaffolder-backend-module-gitlab': patch +'@backstage/plugin-search-backend-module-pg': patch +'@backstage/plugin-notifications-backend': patch +'@backstage/plugin-user-settings-backend': patch +'@backstage/backend-plugin-api': patch +'@backstage/backend-test-utils': patch +'@backstage/plugin-scaffolder-backend': patch +'@backstage/backend-app-api': patch +'@backstage/backend-common': patch +'@backstage/plugin-catalog-backend': patch +'@backstage/plugin-scaffolder-node': patch +'@backstage/backend-tasks': patch +'@backstage/plugin-techdocs-node': patch +'@backstage/plugin-auth-backend': patch +'@backstage/repo-tools': patch +'@backstage/plugin-app-backend': patch +--- + +Extract path utilities from `backend-common` to the `backend-plugin-api` package. diff --git a/packages/backend-app-api/src/services/implementations/auth/DatabaseKeyStore.ts b/packages/backend-app-api/src/services/implementations/auth/DatabaseKeyStore.ts index 6a1536fd18..5bf9244707 100644 --- a/packages/backend-app-api/src/services/implementations/auth/DatabaseKeyStore.ts +++ b/packages/backend-app-api/src/services/implementations/auth/DatabaseKeyStore.ts @@ -14,11 +14,14 @@ * limitations under the License. */ -import { DatabaseService, LoggerService } from '@backstage/backend-plugin-api'; +import { + DatabaseService, + LoggerService, + resolvePackagePath, +} from '@backstage/backend-plugin-api'; import { DateTime } from 'luxon'; import { Knex } from 'knex'; import { JsonObject } from '@backstage/types'; -import { resolvePackagePath } from '@backstage/backend-common'; import { KeyStore } from './types'; const MIGRATIONS_TABLE = 'backstage_backend_public_keys__knex_migrations'; diff --git a/packages/backend-common/src/deprecated.ts b/packages/backend-common/src/deprecated.ts index 397d97f20e..cee15aadb6 100644 --- a/packages/backend-common/src/deprecated.ts +++ b/packages/backend-common/src/deprecated.ts @@ -14,6 +14,12 @@ * limitations under the License. */ +import { + resolvePackagePath as _resolvePackagePath, + resolveSafeChildPath as _resolveSafeChildPath, + isChildPath as _isChildPath, +} from '@backstage/backend-plugin-api'; + import { overridePackagePathResolution as _overridePackagePathResolution, OverridePackagePathResolutionOptions as _OverridePackagePathResolutionOptions, @@ -41,3 +47,24 @@ export type OverridePackagePathResolutionOptions = * Please use the `PackagePathResolutionOverride` type from the `@backstage/backend-plugin-api/testUtils` package instead. */ export type PackagePathResolutionOverride = _PackagePathResolutionOverride; + +/** + * @public + * @deprecated This type is deprecated and will be removed in a future release, see https://github.com/backstage/backstage/issues/24493. + * Please use the `resolvePackagePath` function from the `@backstage/backend-plugin-api` package instead. + */ +export const resolvePackagePath = _resolvePackagePath; + +/** + * @public + * @deprecated This type is deprecated and will be removed in a future release, see + * Please use the `resolveSafeChildPath` function from the `@backstage/backend-plugin-api` package instead. + */ +export const resolveSafeChildPath = _resolveSafeChildPath; + +/** + * @public + * @deprecated This type is deprecated and will be removed in a future release, see + * Please use the `isChildPath` function from the `@backstage/cli-common` package instead. + */ +export const isChildPath = _isChildPath; diff --git a/packages/backend-common/src/index.ts b/packages/backend-common/src/index.ts index 4b1314b7d2..1d01410408 100644 --- a/packages/backend-common/src/index.ts +++ b/packages/backend-common/src/index.ts @@ -25,12 +25,16 @@ export type { LegacyCreateRouter } from './legacy'; export * from './auth'; export * from './cache'; export { loadBackendConfig } from './config'; +export { + resolvePackagePath, + resolveSafeChildPath, + isChildPath, +} from './deprecated'; export * from './database'; export * from './discovery'; export * from './hot'; export * from './logging'; export * from './middleware'; -export * from './paths'; export * from './reading'; export * from './scm'; export * from './service'; diff --git a/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts b/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts index a191163517..412819c5b9 100644 --- a/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts +++ b/packages/backend-common/src/reading/tree/ZipArchiveResponse.ts @@ -25,7 +25,7 @@ import { ReadTreeResponseFile, } from '../types'; import { streamToBuffer } from './util'; -import { resolveSafeChildPath } from '../../paths'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; /** * Wraps a zip archive stream into a tree response reader. diff --git a/packages/backend-dynamic-feature-service/src/schemas/appBackendModule.ts b/packages/backend-dynamic-feature-service/src/schemas/appBackendModule.ts index b44913edfd..6e54379e90 100644 --- a/packages/backend-dynamic-feature-service/src/schemas/appBackendModule.ts +++ b/packages/backend-dynamic-feature-service/src/schemas/appBackendModule.ts @@ -17,13 +17,13 @@ import { coreServices, createBackendModule, + resolvePackagePath, } from '@backstage/backend-plugin-api'; import { dynamicPluginsSchemasServiceRef } from './schemas'; import { configSchemaExtensionPoint, loadCompiledConfigSchema, } from '@backstage/plugin-app-node'; -import { resolvePackagePath } from '@backstage/backend-common'; /** @public */ export const dynamicPluginsFrontendSchemas = createBackendModule({ diff --git a/packages/backend-plugin-api/package.json b/packages/backend-plugin-api/package.json index c83ef854b8..ca954e4c56 100644 --- a/packages/backend-plugin-api/package.json +++ b/packages/backend-plugin-api/package.json @@ -53,7 +53,9 @@ }, "dependencies": { "@backstage/backend-tasks": "workspace:^", + "@backstage/cli-common": "workspace:^", "@backstage/config": "workspace:^", + "@backstage/errors": "workspace:^", "@backstage/plugin-auth-node": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", "@backstage/types": "workspace:^", @@ -62,6 +64,7 @@ "knex": "^3.0.0" }, "devDependencies": { + "@backstage/backend-test-utils": "workspace:^", "@backstage/cli": "workspace:^" } } diff --git a/packages/backend-plugin-api/src/index.ts b/packages/backend-plugin-api/src/index.ts index 8e0b23d20b..c2e2a13a89 100644 --- a/packages/backend-plugin-api/src/index.ts +++ b/packages/backend-plugin-api/src/index.ts @@ -22,4 +22,5 @@ export * from './services'; export type { BackendFeature } from './types'; +export * from './paths'; export * from './wiring'; diff --git a/packages/backend-common/src/paths.test.ts b/packages/backend-plugin-api/src/paths.test.ts similarity index 100% rename from packages/backend-common/src/paths.test.ts rename to packages/backend-plugin-api/src/paths.test.ts diff --git a/packages/backend-common/src/paths.ts b/packages/backend-plugin-api/src/paths.ts similarity index 100% rename from packages/backend-common/src/paths.ts rename to packages/backend-plugin-api/src/paths.ts diff --git a/packages/backend-plugin-api/src/testUtils.ts b/packages/backend-plugin-api/src/testUtils.ts index a04cae4c25..ba09145bf0 100644 --- a/packages/backend-plugin-api/src/testUtils.ts +++ b/packages/backend-plugin-api/src/testUtils.ts @@ -16,7 +16,7 @@ // TODO: Remove this relative import when extrating the path utilities to this package // eslint-disable-next-line @backstage/no-relative-monorepo-imports -import { packagePathMocks } from '../../backend-common/src/paths'; +import { packagePathMocks } from './paths'; import { posix as posixPath, resolve as resolvePath } from 'path'; /** @public */ diff --git a/packages/backend-tasks/src/database/migrateBackendTasks.ts b/packages/backend-tasks/src/database/migrateBackendTasks.ts index 9530668e3e..ae5048fbf7 100644 --- a/packages/backend-tasks/src/database/migrateBackendTasks.ts +++ b/packages/backend-tasks/src/database/migrateBackendTasks.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { resolvePackagePath } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { Knex } from 'knex'; import { DB_MIGRATIONS_TABLE } from './tables'; diff --git a/packages/backend-test-utils/src/filesystem/MockDirectory.ts b/packages/backend-test-utils/src/filesystem/MockDirectory.ts index fff8a35a06..1c10c77fc6 100644 --- a/packages/backend-test-utils/src/filesystem/MockDirectory.ts +++ b/packages/backend-test-utils/src/filesystem/MockDirectory.ts @@ -15,7 +15,7 @@ */ import os from 'os'; -import { isChildPath } from '@backstage/backend-common'; +import { isChildPath } from '@backstage/backend-plugin-api'; import fs from 'fs-extra'; import textextensions from 'textextensions'; import { diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 14a2cbca1d..41492f2366 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -8,31 +8,42 @@ "backstage": { "role": "cli" }, + "keywords": [ + "backstage" + ], "homepage": "https://backstage.io", "repository": { "type": "git", "url": "https://github.com/backstage/backstage", "directory": "packages/repo-tools" }, - "keywords": [ - "backstage" - ], "license": "Apache-2.0", "main": "dist/index.cjs.js", - "scripts": { - "build": "backstage-cli package build", - "lint": "backstage-cli package lint", - "test": "backstage-cli package test", - "clean": "backstage-cli package clean", - "start": "nodemon --" - }, "bin": { "backstage-repo-tools": "bin/backstage-repo-tools" }, + "files": [ + "bin", + "dist/**/*.js", + "templates", + "openapitools.json" + ], + "scripts": { + "build": "backstage-cli package build", + "clean": "backstage-cli package clean", + "lint": "backstage-cli package lint", + "start": "nodemon --", + "test": "backstage-cli package test" + }, + "nodemonConfig": { + "exec": "bin/backstage-repo-tools", + "ext": "ts", + "watch": "./src" + }, "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", "@apisyouwonthate/style-guide": "^1.4.0", - "@backstage/backend-common": "workspace:^", + "@backstage/backend-plugin-api": "workspace:^", "@backstage/catalog-model": "workspace:^", "@backstage/cli-common": "workspace:^", "@backstage/cli-node": "workspace:^", @@ -84,16 +95,5 @@ "prettier": { "optional": true } - }, - "files": [ - "bin", - "dist/**/*.js", - "templates", - "openapitools.json" - ], - "nodemonConfig": { - "watch": "./src", - "exec": "bin/backstage-repo-tools", - "ext": "ts" } } diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts index 5dfed05f93..6963e02664 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts @@ -24,7 +24,7 @@ import { paths as cliPaths } from '../../../../../lib/paths'; import { mkdirpSync } from 'fs-extra'; import fs from 'fs-extra'; import { exec } from '../../../../../lib/exec'; -import { resolvePackagePath } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { getPathToCurrentOpenApiSpec } from '../../../../../lib/openapi/helpers'; async function generate(outputDirectory: string) { diff --git a/plugins/app-backend/src/lib/assets/StaticAssetsStore.ts b/plugins/app-backend/src/lib/assets/StaticAssetsStore.ts index 05d6424013..1179a11ef3 100644 --- a/plugins/app-backend/src/lib/assets/StaticAssetsStore.ts +++ b/plugins/app-backend/src/lib/assets/StaticAssetsStore.ts @@ -14,15 +14,15 @@ * limitations under the License. */ -import { - PluginDatabaseManager, - resolvePackagePath, -} from '@backstage/backend-common'; +import { PluginDatabaseManager } from '@backstage/backend-common'; import { Knex } from 'knex'; import { DateTime } from 'luxon'; import partition from 'lodash/partition'; import { StaticAsset, StaticAssetInput, StaticAssetProvider } from './types'; -import { LoggerService } from '@backstage/backend-plugin-api'; +import { + LoggerService, + resolvePackagePath, +} from '@backstage/backend-plugin-api'; const migrationsDir = resolvePackagePath( '@backstage/plugin-app-backend', diff --git a/plugins/app-backend/src/lib/assets/findStaticAssets.ts b/plugins/app-backend/src/lib/assets/findStaticAssets.ts index 7ecea7146e..c8731bfc93 100644 --- a/plugins/app-backend/src/lib/assets/findStaticAssets.ts +++ b/plugins/app-backend/src/lib/assets/findStaticAssets.ts @@ -17,7 +17,7 @@ import fs from 'fs-extra'; import globby from 'globby'; import { StaticAssetInput } from './types'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; /** * Finds all static assets within a directory diff --git a/plugins/app-backend/src/service/router.ts b/plugins/app-backend/src/service/router.ts index af88f0d9da..f1fb20a4b5 100644 --- a/plugins/app-backend/src/service/router.ts +++ b/plugins/app-backend/src/service/router.ts @@ -17,8 +17,8 @@ import { notFoundHandler, PluginDatabaseManager, - resolvePackagePath, } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { AppConfig, Config } from '@backstage/config'; import helmet from 'helmet'; import express from 'express'; diff --git a/plugins/auth-backend/src/database/AuthDatabase.ts b/plugins/auth-backend/src/database/AuthDatabase.ts index 97e4236754..ec4d2034e7 100644 --- a/plugins/auth-backend/src/database/AuthDatabase.ts +++ b/plugins/auth-backend/src/database/AuthDatabase.ts @@ -17,8 +17,8 @@ import { DatabaseManager, PluginDatabaseManager, - resolvePackagePath, } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { ConfigReader } from '@backstage/config'; import { Knex } from 'knex'; diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/database/migrations.ts b/plugins/catalog-backend-module-incremental-ingestion/src/database/migrations.ts index 940a82107b..08c581e77a 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/database/migrations.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/database/migrations.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { resolvePackagePath } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { Knex } from 'knex'; import { DB_MIGRATIONS_TABLE } from './tables'; diff --git a/plugins/catalog-backend/src/database/migrations.ts b/plugins/catalog-backend/src/database/migrations.ts index ed3a7751b5..5139c74930 100644 --- a/plugins/catalog-backend/src/database/migrations.ts +++ b/plugins/catalog-backend/src/database/migrations.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { resolvePackagePath } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { Knex } from 'knex'; export async function applyDatabaseMigrations(knex: Knex): Promise { diff --git a/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts b/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts index ae548a9892..f4bd25d1ba 100644 --- a/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts +++ b/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { - PluginDatabaseManager, - resolvePackagePath, -} from '@backstage/backend-common'; +import { PluginDatabaseManager } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { NotificationGetOptions, NotificationModifyOptions, diff --git a/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts b/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts index 1a49ab0855..d170acb5d0 100644 --- a/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts +++ b/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts @@ -14,11 +14,8 @@ * limitations under the License. */ -import { - ContainerRunner, - UrlReader, - resolveSafeChildPath, -} from '@backstage/backend-common'; +import { ContainerRunner, UrlReader } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { JsonObject, JsonValue } from '@backstage/types'; import { InputError } from '@backstage/errors'; import { ScmIntegrations } from '@backstage/integration'; diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts b/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts index a72ec8345b..5efcc6e0bb 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.ts @@ -27,11 +27,13 @@ import { } from '@backstage/plugin-scaffolder-node'; import { Octokit } from 'octokit'; import { CustomErrorBase, InputError } from '@backstage/errors'; -import { resolveSafeChildPath } from '@backstage/backend-common'; import { createPullRequest } from 'octokit-plugin-create-pull-request'; import { getOctokitOptions } from './helpers'; import { examples } from './githubPullRequest.examples'; -import { LoggerService } from '@backstage/backend-plugin-api'; +import { + LoggerService, + resolveSafeChildPath, +} from '@backstage/backend-plugin-api'; import { Config } from '@backstage/config'; export type Encoding = 'utf-8' | 'base64'; diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabMergeRequest.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabMergeRequest.ts index c9b8ce68a9..a549585426 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabMergeRequest.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabMergeRequest.ts @@ -23,7 +23,7 @@ import { Types } from '@gitbeaker/core'; import path from 'path'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { InputError } from '@backstage/errors'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { createGitlabApi } from './helpers'; import { examples } from './gitlabMergeRequest.examples'; diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabRepoPush.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabRepoPush.ts index aae3b05c49..c926fe2971 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabRepoPush.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlabRepoPush.ts @@ -23,7 +23,7 @@ import { Types } from '@gitbeaker/core'; import path from 'path'; import { ScmIntegrationRegistry } from '@backstage/integration'; import { InputError } from '@backstage/errors'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { createGitlabApi } from './helpers'; import { examples } from './gitlabRepoPush.examples'; diff --git a/plugins/scaffolder-backend/src/lib/templating/SecureTemplater.ts b/plugins/scaffolder-backend/src/lib/templating/SecureTemplater.ts index 14a58e4975..6860902c78 100644 --- a/plugins/scaffolder-backend/src/lib/templating/SecureTemplater.ts +++ b/plugins/scaffolder-backend/src/lib/templating/SecureTemplater.ts @@ -15,7 +15,7 @@ */ import { Isolate } from 'isolated-vm'; -import { resolvePackagePath } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { TemplateFilter as _TemplateFilter, TemplateGlobal as _TemplateGlobal, diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/catalog/write.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/catalog/write.ts index 27c39dd098..9feaa14c07 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/catalog/write.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/catalog/write.ts @@ -17,7 +17,7 @@ import fs from 'fs-extra'; import { createTemplateAction } from '@backstage/plugin-scaffolder-node'; import * as yaml from 'yaml'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { z } from 'zod'; import { examples } from './write.examples'; diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts index 8bca630af9..c6beaa2d67 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plain.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { UrlReader, resolveSafeChildPath } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { ScmIntegrations } from '@backstage/integration'; import { examples } from './plain.examples'; diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plainFile.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plainFile.ts index da0255ff5a..92db7aa3ed 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plainFile.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/plainFile.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { UrlReader, resolveSafeChildPath } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { ScmIntegrations } from '@backstage/integration'; import { examples } from './plainFile.examples'; import { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.examples.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.examples.test.ts index 36f1f00b50..02fe0c30a4 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.examples.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.examples.test.ts @@ -16,7 +16,8 @@ import { join as joinPath, sep as pathSep } from 'path'; import fs from 'fs-extra'; -import { resolvePackagePath, UrlReader } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { ScmIntegrations } from '@backstage/integration'; import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils'; import { createFetchTemplateAction } from './template'; diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts index fd0ef7d757..0542b6a50d 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts @@ -21,7 +21,8 @@ jest.mock('@backstage/plugin-scaffolder-node', () => { import { join as joinPath, sep as pathSep } from 'path'; import fs from 'fs-extra'; -import { resolvePackagePath, UrlReader } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { ScmIntegrations } from '@backstage/integration'; import { createFetchTemplateAction } from './template'; import { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts index b39582e18b..0983199339 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts @@ -15,7 +15,8 @@ */ import { extname } from 'path'; -import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { InputError } from '@backstage/errors'; import { ScmIntegrations } from '@backstage/integration'; import { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/delete.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/delete.ts index 5787d245ab..13dfc69525 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/delete.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/delete.ts @@ -16,7 +16,7 @@ import { createTemplateAction } from '@backstage/plugin-scaffolder-node'; import { InputError } from '@backstage/errors'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import fs from 'fs-extra'; import { examples } from './delete.examples'; diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/rename.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/rename.ts index 5d9d666d15..238fc9e8c0 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/rename.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/filesystem/rename.ts @@ -15,7 +15,7 @@ */ import { createTemplateAction } from '@backstage/plugin-scaffolder-node'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { InputError } from '@backstage/errors'; import fs from 'fs-extra'; import { examples } from './rename.examples'; diff --git a/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts b/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts index 2eaa505c8c..6b8caf5a3d 100644 --- a/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts +++ b/plugins/scaffolder-backend/src/scaffolder/dryrun/createDryRunner.ts @@ -33,9 +33,11 @@ import { TemplateActionRegistry } from '../actions'; import { NunjucksWorkflowRunner } from '../tasks/NunjucksWorkflowRunner'; import { DecoratedActionsRegistry } from './DecoratedActionsRegistry'; import fs from 'fs-extra'; -import { resolveSafeChildPath } from '@backstage/backend-common'; import { PermissionEvaluator } from '@backstage/plugin-permission-common'; -import { BackstageCredentials } from '@backstage/backend-plugin-api'; +import { + BackstageCredentials, + resolveSafeChildPath, +} from '@backstage/backend-plugin-api'; interface DryRunInput { spec: TaskSpec; diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts index f6f00b0441..9c95c11017 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/DatabaseTaskStore.ts @@ -15,10 +15,8 @@ */ import { JsonObject } from '@backstage/types'; -import { - PluginDatabaseManager, - resolvePackagePath, -} from '@backstage/backend-common'; +import { PluginDatabaseManager } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { ConflictError, NotFoundError } from '@backstage/errors'; import { Knex } from 'knex'; import { v4 as uuid } from 'uuid'; diff --git a/plugins/scaffolder-node/src/actions/fetch.ts b/plugins/scaffolder-node/src/actions/fetch.ts index 6b3e08bc7e..63bc4b1352 100644 --- a/plugins/scaffolder-node/src/actions/fetch.ts +++ b/plugins/scaffolder-node/src/actions/fetch.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { InputError } from '@backstage/errors'; import { ScmIntegrations } from '@backstage/integration'; import fs from 'fs-extra'; diff --git a/plugins/scaffolder-node/src/actions/util.ts b/plugins/scaffolder-node/src/actions/util.ts index 7f7121ef16..2b3a1296bf 100644 --- a/plugins/scaffolder-node/src/actions/util.ts +++ b/plugins/scaffolder-node/src/actions/util.ts @@ -15,7 +15,7 @@ */ import { InputError } from '@backstage/errors'; -import { isChildPath } from '@backstage/backend-common'; +import { isChildPath } from '@backstage/backend-plugin-api'; import { join as joinPath, normalize as normalizePath } from 'path'; import { ScmIntegrationRegistry } from '@backstage/integration'; diff --git a/plugins/scaffolder-node/src/files/deserializeDirectoryContents.ts b/plugins/scaffolder-node/src/files/deserializeDirectoryContents.ts index bdcecd99f1..4c6ae251ee 100644 --- a/plugins/scaffolder-node/src/files/deserializeDirectoryContents.ts +++ b/plugins/scaffolder-node/src/files/deserializeDirectoryContents.ts @@ -16,7 +16,7 @@ import fs from 'fs-extra'; import { dirname } from 'path'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { SerializedFile } from './types'; /** diff --git a/plugins/scaffolder-node/src/files/serializeDirectoryContents.ts b/plugins/scaffolder-node/src/files/serializeDirectoryContents.ts index 7e52f6323b..1b83a8cf32 100644 --- a/plugins/scaffolder-node/src/files/serializeDirectoryContents.ts +++ b/plugins/scaffolder-node/src/files/serializeDirectoryContents.ts @@ -17,7 +17,7 @@ import { promises as fs } from 'fs'; import globby from 'globby'; import limiterFactory from 'p-limit'; -import { resolveSafeChildPath } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { SerializedFile } from './types'; import { isError } from '@backstage/errors'; diff --git a/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts b/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts index 3019c63a64..88ba7072dd 100644 --- a/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts +++ b/plugins/search-backend-module-pg/src/database/DatabaseDocumentStore.ts @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { - PluginDatabaseManager, - resolvePackagePath, -} from '@backstage/backend-common'; +import { PluginDatabaseManager } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { IndexableDocument } from '@backstage/plugin-search-common'; import { Knex } from 'knex'; import { diff --git a/plugins/techdocs-node/src/helpers.ts b/plugins/techdocs-node/src/helpers.ts index 39a1f4c666..c293d16896 100644 --- a/plugins/techdocs-node/src/helpers.ts +++ b/plugins/techdocs-node/src/helpers.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common'; +import { UrlReader } from '@backstage/backend-common'; +import { resolveSafeChildPath } from '@backstage/backend-plugin-api'; import { Entity, getEntitySourceLocation, diff --git a/plugins/techdocs-node/src/stages/generate/helpers.ts b/plugins/techdocs-node/src/stages/generate/helpers.ts index 1450a4afba..df1a31470d 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { isChildPath } from '@backstage/backend-common'; +import { isChildPath } from '@backstage/backend-plugin-api'; import { Entity } from '@backstage/catalog-model'; import { assertError, ForwardedError } from '@backstage/errors'; import { ScmIntegrationRegistry } from '@backstage/integration'; diff --git a/plugins/techdocs-node/src/stages/publish/local.ts b/plugins/techdocs-node/src/stages/publish/local.ts index 1a02cb7eee..37f41080b4 100644 --- a/plugins/techdocs-node/src/stages/publish/local.ts +++ b/plugins/techdocs-node/src/stages/publish/local.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { - PluginEndpointDiscovery, resolvePackagePath, resolveSafeChildPath, -} from '@backstage/backend-common'; +} from '@backstage/backend-plugin-api'; import { Entity, CompoundEntityRef, diff --git a/plugins/user-settings-backend/src/database/DatabaseUserSettingsStore.ts b/plugins/user-settings-backend/src/database/DatabaseUserSettingsStore.ts index b0fe8fdecc..99c4b2cff4 100644 --- a/plugins/user-settings-backend/src/database/DatabaseUserSettingsStore.ts +++ b/plugins/user-settings-backend/src/database/DatabaseUserSettingsStore.ts @@ -14,10 +14,8 @@ * limitations under the License. */ -import { - PluginDatabaseManager, - resolvePackagePath, -} from '@backstage/backend-common'; +import { PluginDatabaseManager } from '@backstage/backend-common'; +import { resolvePackagePath } from '@backstage/backend-plugin-api'; import { NotFoundError } from '@backstage/errors'; import { JsonValue } from '@backstage/types'; import { Knex } from 'knex'; diff --git a/yarn.lock b/yarn.lock index 9c9a730679..53cf1fef48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3506,8 +3506,11 @@ __metadata: resolution: "@backstage/backend-plugin-api@workspace:packages/backend-plugin-api" dependencies: "@backstage/backend-tasks": "workspace:^" + "@backstage/backend-test-utils": "workspace:^" "@backstage/cli": "workspace:^" + "@backstage/cli-common": "workspace:^" "@backstage/config": "workspace:^" + "@backstage/errors": "workspace:^" "@backstage/plugin-auth-node": "workspace:^" "@backstage/plugin-permission-common": "workspace:^" "@backstage/types": "workspace:^" @@ -7669,7 +7672,7 @@ __metadata: dependencies: "@apidevtools/swagger-parser": ^10.1.0 "@apisyouwonthate/style-guide": ^1.4.0 - "@backstage/backend-common": "workspace:^" + "@backstage/backend-plugin-api": "workspace:^" "@backstage/backend-test-utils": "workspace:^" "@backstage/catalog-model": "workspace:^" "@backstage/cli": "workspace:^"