Skip to content

Commit

Permalink
remove deprecations packages/config-loader/src/loader.ts:63
Browse files Browse the repository at this point in the history
Signed-off-by: Colton Padden <colton.padden@fastmail.com>
  • Loading branch information
cmpadden committed Dec 16, 2021
1 parent 6b69b44 commit 67d6cb3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-apricots-raise.md
@@ -0,0 +1,5 @@
---
'@backstage/config-loader': patch
---

Removed deprecated option `configPaths` as it has been superseded by `configTargets`
1 change: 0 additions & 1 deletion packages/backend-common/src/config.ts
Expand Up @@ -202,7 +202,6 @@ export async function loadBackendConfig(options: {
const config = new ObservableConfigProxy(options.logger);
const { appConfigs } = await loadConfig({
configRoot: paths.targetRoot,
configPaths: [],
configTargets: configTargets,
watch: {
onChange(newConfigs) {
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/lib/config.ts
Expand Up @@ -59,7 +59,6 @@ export async function loadCliConfig(options: Options) {
? async name => process.env[name] || 'x'
: undefined,
configRoot: paths.targetRoot,
configPaths: [],
configTargets: configTargets,
});

Expand Down
5 changes: 0 additions & 5 deletions packages/config-loader/api-report.md
Expand Up @@ -45,7 +45,6 @@ export function loadConfig(
// @public
export type LoadConfigOptions = {
configRoot: string;
configPaths: string[];
configTargets: ConfigTarget[];
env?: string;
experimentalEnvFunc?: (name: string) => Promise<string | undefined>;
Expand Down Expand Up @@ -103,8 +102,4 @@ export type TransformFunc<T extends number | string | boolean> = (
visibility: ConfigVisibility;
},
) => T | undefined;

// Warnings were encountered during analysis:
//
// src/loader.d.ts:33:5 - (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/config-loader" does not have an export "configTargets"
```
14 changes: 4 additions & 10 deletions packages/config-loader/src/loader.test.ts
Expand Up @@ -118,7 +118,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [],
env: 'production',
}),
Expand Down Expand Up @@ -146,7 +145,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [{ url: configUrl }],
env: 'production',
remote: {
Expand All @@ -173,8 +171,10 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: ['/root/app-config2.yaml'],
configTargets: [{ path: '/root/app-config.yaml' }],
configTargets: [
{ path: '/root/app-config.yaml' },
{ path: '/root/app-config2.yaml' },
],
env: 'production',
}),
).resolves.toEqual({
Expand Down Expand Up @@ -207,7 +207,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: ['/root/app-config.yaml'],
configTargets: [{ path: '/root/app-config.yaml' }],
env: 'production',
}),
Expand All @@ -231,7 +230,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [
{ path: '/root/app-config.yaml' },
{ path: '/root/app-config.development.yaml' },
Expand Down Expand Up @@ -274,7 +272,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [{ path: '/root/app-config.substitute.yaml' }],
env: 'development',
}),
Expand Down Expand Up @@ -302,7 +299,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [],
watch: {
onChange: onChange.resolve,
Expand Down Expand Up @@ -353,7 +349,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [{ url: configUrl }],
watch: {
onChange: onChange.resolve,
Expand Down Expand Up @@ -401,7 +396,6 @@ describe('loadConfig', () => {

await loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [],
watch: {
onChange: () => {
Expand Down
12 changes: 0 additions & 12 deletions packages/config-loader/src/loader.ts
Expand Up @@ -59,11 +59,6 @@ export type LoadConfigOptions = {
// The root directory of the config loading context. Used to find default configs.
configRoot: string;

/** Absolute paths to load config files from. Configs from earlier paths have lower priority.
* @deprecated Use {@link configTargets} instead.
*/
configPaths: string[];

// Paths to load config files from. Configs from earlier paths have lower priority.
configTargets: ConfigTarget[];

Expand Down Expand Up @@ -114,13 +109,6 @@ export async function loadConfig(
.filter((e): e is { path: string } => e.hasOwnProperty('path'))
.map(configTarget => configTarget.path);

// Append deprecated configPaths to the absolute config paths received via configTargets.
options.configPaths.forEach(cp => {
if (!configPaths.includes(cp)) {
configPaths.push(cp);
}
});

const configUrls: string[] = options.configTargets
.slice()
.filter((e): e is { url: string } => e.hasOwnProperty('url'))
Expand Down

0 comments on commit 67d6cb3

Please sign in to comment.