diff --git a/packages/backend-common/src/util/ContainerRunner.ts b/packages/backend-common/src/deprecated/util/ContainerRunner.ts similarity index 87% rename from packages/backend-common/src/util/ContainerRunner.ts rename to packages/backend-common/src/deprecated/util/ContainerRunner.ts index 351a5da613..92081cea16 100644 --- a/packages/backend-common/src/util/ContainerRunner.ts +++ b/packages/backend-common/src/deprecated/util/ContainerRunner.ts @@ -22,6 +22,7 @@ import { Writable } from 'stream'; * {@link https://github.com/apocas/dockerode?tab=readme-ov-file#pull-from-private-repos} * * @public + * @deprecated This interface is deprecated and will be removed in a future release. */ export interface PullOptions { authconfig?: { @@ -39,6 +40,7 @@ export interface PullOptions { * Options passed to the {@link ContainerRunner.runContainer} method. * * @public + * @deprecated This type is deprecated and will be removed in a future release. */ export type RunContainerOptions = { imageName: string; @@ -57,6 +59,7 @@ export type RunContainerOptions = { * Handles the running of containers, on behalf of others. * * @public + * @deprecated This interface is deprecated and will be removed in a future release. */ export interface ContainerRunner { /** diff --git a/packages/backend-common/src/util/DockerContainerRunner.test.ts b/packages/backend-common/src/deprecated/util/DockerContainerRunner.test.ts similarity index 100% rename from packages/backend-common/src/util/DockerContainerRunner.test.ts rename to packages/backend-common/src/deprecated/util/DockerContainerRunner.test.ts diff --git a/packages/backend-common/src/util/DockerContainerRunner.ts b/packages/backend-common/src/deprecated/util/DockerContainerRunner.ts similarity index 98% rename from packages/backend-common/src/util/DockerContainerRunner.ts rename to packages/backend-common/src/deprecated/util/DockerContainerRunner.ts index 89a17fff51..ea576e4a3a 100644 --- a/packages/backend-common/src/util/DockerContainerRunner.ts +++ b/packages/backend-common/src/deprecated/util/DockerContainerRunner.ts @@ -28,6 +28,7 @@ export type UserOptions = { * A {@link ContainerRunner} for Docker containers. * * @public + * @deprecated This class is deprecated and will be removed in a future release. */ export class DockerContainerRunner implements ContainerRunner { private readonly dockerClient: Docker; diff --git a/packages/backend-common/src/util/KubernetesContainerRunner.test.ts b/packages/backend-common/src/deprecated/util/KubernetesContainerRunner.test.ts similarity index 100% rename from packages/backend-common/src/util/KubernetesContainerRunner.test.ts rename to packages/backend-common/src/deprecated/util/KubernetesContainerRunner.test.ts diff --git a/packages/backend-common/src/util/KubernetesContainerRunner.ts b/packages/backend-common/src/deprecated/util/KubernetesContainerRunner.ts similarity index 97% rename from packages/backend-common/src/util/KubernetesContainerRunner.ts rename to packages/backend-common/src/deprecated/util/KubernetesContainerRunner.ts index 4b235caf2c..0402f70079 100644 --- a/packages/backend-common/src/util/KubernetesContainerRunner.ts +++ b/packages/backend-common/src/deprecated/util/KubernetesContainerRunner.ts @@ -37,6 +37,7 @@ import { v4 as uuid } from 'uuid'; * Every mount must start with the 'basePath'. * * @public + * @deprecated This type is deprecated and will be removed in a future release. */ export type KubernetesContainerRunnerMountBase = { volumeName: string; @@ -53,6 +54,7 @@ export type KubernetesContainerRunnerMountBase = { * a volume definition named as the {@link KubernetesContainerRunnerMountBase} 'volumeName'. * * @public + * @deprecated This type is deprecated and will be removed in a future release. */ export type KubernetesContainerRunnerOptions = { kubeConfig: KubeConfig; @@ -69,6 +71,7 @@ export type KubernetesContainerRunnerOptions = { * Runs containers leveraging Jobs on a Kubernetes cluster * * @public + * @deprecated This class is deprecated and will be removed in a future release. */ export class KubernetesContainerRunner implements ContainerRunner { private readonly kubeConfig: KubeConfig; diff --git a/packages/backend-common/src/util/index.ts b/packages/backend-common/src/deprecated/util/index.ts similarity index 100% rename from packages/backend-common/src/util/index.ts rename to packages/backend-common/src/deprecated/util/index.ts diff --git a/packages/backend-common/src/util/escapeRegExp.test.ts b/packages/backend-common/src/util/escapeRegExp.test.ts deleted file mode 100644 index 13c6ae4a5a..0000000000 --- a/packages/backend-common/src/util/escapeRegExp.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { escapeRegExp } from './escapeRegExp'; - -describe('escapeRegExp', () => { - test('does not escape non-regex characters', () => { - expect(escapeRegExp('Backstage Backstage')).toBe('Backstage Backstage'); - }); - - test('all the characters', () => { - expect(escapeRegExp('^$\\.*+?()[]{}|')).toBe( - '\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|', - ); - }); - - test('character: ^', () => { - expect(escapeRegExp('^')).toBe('\\^'); - }); - - test('character: $', () => { - expect(escapeRegExp('$')).toBe('\\$'); - }); - - test('character: \\', () => { - expect(escapeRegExp('\\')).toBe('\\\\'); - }); - - test('character: .', () => { - expect(escapeRegExp('.')).toBe('\\.'); - }); - - test('character: *', () => { - expect(escapeRegExp('*')).toBe('\\*'); - }); - - test('character: +', () => { - expect(escapeRegExp('+')).toBe('\\+'); - }); - - test('character: ?', () => { - expect(escapeRegExp('?')).toBe('\\?'); - }); - - test('character: (', () => { - expect(escapeRegExp('(')).toBe('\\('); - }); - - test('character: )', () => { - expect(escapeRegExp(')')).toBe('\\)'); - }); - - test('character: [', () => { - expect(escapeRegExp('[')).toBe('\\['); - }); - - test('character: ]', () => { - expect(escapeRegExp(']')).toBe('\\]'); - }); - - test('character: {', () => { - expect(escapeRegExp('{')).toBe('\\{'); - }); - - test('character: }', () => { - expect(escapeRegExp('}')).toBe('\\}'); - }); - - test('character: |', () => { - expect(escapeRegExp('|')).toBe('\\|'); - }); -}); diff --git a/packages/backend-common/src/util/escapeRegExp.ts b/packages/backend-common/src/util/escapeRegExp.ts deleted file mode 100644 index bc78967ebe..0000000000 --- a/packages/backend-common/src/util/escapeRegExp.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Escapes a given string to be used inside a RegExp. - * - * Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions - */ -export const escapeRegExp = (text: string) => { - return text.replace(/[.*+?^${}(\)|[\]\\]/g, '\\$&'); -};