Change variable name

Signed-off-by: Matto <muhamadto@gmail.com>
This commit is contained in:
Matto
2021-10-26 21:50:49 +11:00
parent 988c5b8421
commit 855d460611
3 changed files with 21 additions and 13 deletions
+6 -6
View File
@@ -49,8 +49,8 @@ export type LoadConfigOptions = {
configTargets: ConfigTarget[];
env?: string;
experimentalEnvFunc?: EnvFunc;
remote?: Remote;
watch?: Watch;
remote?: LoadConfigOptionsRemote;
watch?: LoadConfigOptionsWatch;
};
// @public
@@ -75,10 +75,10 @@ export function readEnvConfig(env: {
[name: string]: string | undefined;
}): AppConfig[];
// Warning: (ae-missing-release-tag) "Remote" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "LoadConfigOptionsRemote" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type Remote = {
export type LoadConfigOptionsRemote = {
reloadIntervalSeconds: number;
};
@@ -90,10 +90,10 @@ export type TransformFunc<T extends number | string | boolean> = (
},
) => T | undefined;
// Warning: (ae-missing-release-tag) "Watch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "LoadConfigOptionsWatch" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type Watch = {
export type LoadConfigOptionsWatch = {
onChange: (configs: AppConfig[]) => void;
stopSignal?: Promise<void>;
};
+6 -1
View File
@@ -30,4 +30,9 @@ export type {
TransformFunc,
} from './lib';
export { loadConfig } from './loader';
export type { ConfigTarget, LoadConfigOptions, Watch, Remote } from './loader';
export type {
ConfigTarget,
LoadConfigOptions,
LoadConfigOptionsWatch,
LoadConfigOptionsRemote,
} from './loader';
+9 -6
View File
@@ -31,7 +31,7 @@ import { isValidUrl } from '@backstage/integration';
export type ConfigTarget = { path: string } | { url: string };
export type Watch = {
export type LoadConfigOptionsWatch = {
/**
* A listener that is called when a config file is changed.
*/
@@ -43,7 +43,7 @@ export type Watch = {
stopSignal?: Promise<void>;
};
export type Remote = {
export type LoadConfigOptionsRemote = {
/**
* An optional remote config reloading period, in seconds
*/
@@ -71,12 +71,12 @@ export type LoadConfigOptions = {
/**
* An optional remote config
*/
remote?: Remote;
remote?: LoadConfigOptionsRemote;
/**
* An optional configuration that enables watching of config files.
*/
watch?: Watch;
watch?: LoadConfigOptionsWatch;
};
/**
@@ -198,7 +198,7 @@ export async function loadConfig(
const envConfigs = await readEnvConfig(process.env);
const watchConfigFile = (watchProp: Watch) => {
const watchConfigFile = (watchProp: LoadConfigOptionsWatch) => {
const watcher = chokidar.watch(configPaths, {
usePolling: process.env.NODE_ENV === 'test',
});
@@ -227,7 +227,10 @@ export async function loadConfig(
}
};
const watchRemoteConfig = (watchProp: Watch, remoteProp: Remote) => {
const watchRemoteConfig = (
watchProp: LoadConfigOptionsWatch,
remoteProp: LoadConfigOptionsRemote,
) => {
const hasConfigChanged = async (
oldRemoteConfigs: AppConfig[],
newRemoteConfigs: AppConfig[],