mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-22 09:29:42 +01:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
23 lines
658 B
TypeScript
23 lines
658 B
TypeScript
import type { TemplateFunctionPlugin } from "@yaakapp/api";
|
|
|
|
export function migrateTemplateFunctionSelectOptions(
|
|
f: TemplateFunctionPlugin,
|
|
): TemplateFunctionPlugin {
|
|
const migratedArgs = f.args.map((a) => {
|
|
if (a.type === "select") {
|
|
// Migrate old options that had 'name' instead of 'label'
|
|
type LegacyOption = { label?: string; value: string; name?: string };
|
|
a.options = a.options.map((o) => {
|
|
const legacy = o as LegacyOption;
|
|
return {
|
|
label: legacy.label ?? legacy.name ?? "",
|
|
value: legacy.value,
|
|
};
|
|
});
|
|
}
|
|
return a;
|
|
});
|
|
|
|
return { ...f, args: migratedArgs };
|
|
}
|