diff --git a/lib/entry-points.js b/lib/entry-points.js index 9fa4a1cd3..7ff75dcc3 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -148352,6 +148352,7 @@ async function parseRemoteFileAddress(actionState, configFile) { } // src/config/file.ts +var LOCAL_PATH_PREFIX = "./"; async function getConfigFileInput({ logger, actions, @@ -149713,7 +149714,7 @@ async function initConfig(actionState, inputs) { return config; } function isRelativePath(configPath) { - return configPath.startsWith("./"); + return configPath.startsWith(LOCAL_PATH_PREFIX); } function containsAtRef(configPath) { return configPath.includes("@"); diff --git a/src/config-utils.ts b/src/config-utils.ts index 737bea8bd..2a6678bf5 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -31,7 +31,7 @@ import { parseUserConfig, UserConfig, } from "./config/db-config"; -import { getRemoteConfig } from "./config/file"; +import { getRemoteConfig, LOCAL_PATH_PREFIX } from "./config/file"; import { parseRegistries, type RegistryConfigNoCredentials, @@ -1278,13 +1278,13 @@ export async function initConfig( } /** - * Determines if `configPath` is explicitly local. That is, it starts with "./". - * A configuration file path that starts with "./" is always treated as a local path. + * Determines if `configPath` is explicitly local. That is, it starts with `LOCAL_PATH_PREFIX`. + * A configuration file path that starts with `LOCAL_PATH_PREFIX` is always treated as a local path. * * @param configPath The path to test. */ function isRelativePath(configPath: string): boolean { - return configPath.startsWith("./"); + return configPath.startsWith(LOCAL_PATH_PREFIX); } /** @@ -1305,9 +1305,9 @@ function containsAtRef(configPath: string): boolean { * @returns True if it is local, or false otherwise. */ function isLocal(configPath: string): boolean { - // If the path starts with "./", it is explicitly local. + // If the path starts with `LOCAL_PATH_PREFIX`, it is explicitly local. // This allows local paths that would otherwise contain '@' - // to be used with a "./" prefix. + // to be used with a `LOCAL_PATH_PREFIX` prefix. if (isRelativePath(configPath)) { return true; } diff --git a/src/config/file.ts b/src/config/file.ts index 5ff2dee08..06c31eb97 100644 --- a/src/config/file.ts +++ b/src/config/file.ts @@ -11,6 +11,11 @@ import { ConfigurationError } from "../util"; import { parseUserConfig, UserConfig } from "./db-config"; import { parseRemoteFileAddress } from "./remote-file"; +/** + * The prefix that can be specified to indicate that a path should be treated as a local file address. + */ +export const LOCAL_PATH_PREFIX = "./"; + /** * Gets the value that is configured for the configuration file, if any. */