remove deprecations packages/config-loader/src/loader.ts:63

Signed-off-by: Colton Padden <colton.padden@fastmail.com>
This commit is contained in:
Colton Padden
2021-12-15 18:48:46 -05:00
parent 6b69b44862
commit 67d6cb3c7e
6 changed files with 9 additions and 29 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/config-loader': patch
---
Removed deprecated option `configPaths` as it has been superseded by `configTargets`
-1
View File
@@ -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) {
-1
View File
@@ -59,7 +59,6 @@ export async function loadCliConfig(options: Options) {
? async name => process.env[name] || 'x'
: undefined,
configRoot: paths.targetRoot,
configPaths: [],
configTargets: configTargets,
});
-5
View File
@@ -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>;
@@ -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"
```
+4 -10
View File
@@ -118,7 +118,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [],
env: 'production',
}),
@@ -146,7 +145,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [{ url: configUrl }],
env: 'production',
remote: {
@@ -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({
@@ -207,7 +207,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: ['/root/app-config.yaml'],
configTargets: [{ path: '/root/app-config.yaml' }],
env: 'production',
}),
@@ -231,7 +230,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [
{ path: '/root/app-config.yaml' },
{ path: '/root/app-config.development.yaml' },
@@ -274,7 +272,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [{ path: '/root/app-config.substitute.yaml' }],
env: 'development',
}),
@@ -302,7 +299,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [],
watch: {
onChange: onChange.resolve,
@@ -353,7 +349,6 @@ describe('loadConfig', () => {
await expect(
loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [{ url: configUrl }],
watch: {
onChange: onChange.resolve,
@@ -401,7 +396,6 @@ describe('loadConfig', () => {
await loadConfig({
configRoot: '/root',
configPaths: [],
configTargets: [],
watch: {
onChange: () => {
-12
View File
@@ -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[];
@@ -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'))