refactor(config): remove legacy config reference handling and streamline YAML management
- Deleted legacy config reference handling functions and related migration scripts to simplify the codebase. - Updated documentation to reflect the removal of legacy YAML paths and configurations. - Adjusted existing YAML management processes to ensure compatibility with the new mustache-style syntax. - Removed tests related to legacy config references, focusing on current functionality and ensuring clarity in the testing suite.
This commit is contained in:
@@ -6,32 +6,19 @@ import { useVariables } from "../../api/hooks.js";
|
||||
const VAR_PEEK_MAX = 48;
|
||||
const MUSTACHE_RE =
|
||||
/\{\{\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)*)\s*\}\}/g;
|
||||
const LEGACY_PREFIX_RE = /^\s*\$(VAR|SECRET|CONTEXT)_([A-Za-z0-9._-]*)\s*$/;
|
||||
|
||||
/**
|
||||
* @param {unknown} value
|
||||
* @returns {{
|
||||
* kind: "mustache" | "legacy",
|
||||
* kind: "mustache",
|
||||
* path?: string,
|
||||
* root?: string,
|
||||
* name?: string,
|
||||
* legacyKind?: string,
|
||||
* legacyName?: string,
|
||||
* } | null}
|
||||
*/
|
||||
function describeConfigRef(value) {
|
||||
if (typeof value !== "string") return null;
|
||||
const trimmed = value.trim();
|
||||
const legacy = LEGACY_PREFIX_RE.exec(trimmed);
|
||||
if (legacy) {
|
||||
const legacyKind =
|
||||
legacy[1] === "VAR" ? "variable" : legacy[1] === "SECRET" ? "secret" : "context";
|
||||
return {
|
||||
kind: "legacy",
|
||||
legacyKind,
|
||||
legacyName: legacy[2] ?? "",
|
||||
};
|
||||
}
|
||||
MUSTACHE_RE.lastIndex = 0;
|
||||
const match = MUSTACHE_RE.exec(trimmed);
|
||||
if (!match) return null;
|
||||
@@ -90,20 +77,6 @@ export function ConfigRefHint({ value, owner }) {
|
||||
|
||||
if (!ref) return null;
|
||||
|
||||
if (ref.kind === "legacy") {
|
||||
const hint =
|
||||
ref.legacyKind === "variable"
|
||||
? `{{ vars.${ref.legacyName || "name"} }}`
|
||||
: ref.legacyKind === "secret"
|
||||
? `{{ secrets.${ref.legacyName || "name"} }}`
|
||||
: `{{ context.${ref.legacyName || "name"} }}`;
|
||||
return (
|
||||
<p className="text-xs text-error">
|
||||
legacy ${ref.legacyKind} ref — use <span className="font-mono">{hint}</span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
if (!isVar) {
|
||||
const label =
|
||||
ref.root === "secrets"
|
||||
|
||||
Reference in New Issue
Block a user