fromFluidHandlers
fromFluidHandlers(
fluidHandlers,options?):PolicyDefinition[]
Defined in: adapters/fluidFramework.ts:210
Converts FluidFramework handlers to repopo PolicyDefinitions.
This adapter bridges the gap between FluidFramework’s build-tools policy system and repopo’s policy system, allowing you to reuse existing Fluid policies in repopo.
Parameters
Section titled “Parameters”fluidHandlers
Section titled “fluidHandlers”An array of FluidFramework Handler objects to convert.
options?
Section titled “options?”Optional configuration applied to all conversions.
Returns
Section titled “Returns”An array of repopo PolicyDefinitions.
Remarks
Section titled “Remarks”Key differences handled by this adapter:
-
Handler signature: Fluid uses
(file, root) => string | undefined, repopo uses(args) => PolicyHandlerResult -
File paths: Fluid passes absolute paths, repopo passes repo-relative paths. The adapter converts between the two.
-
Return types: Fluid returns
string | undefined(error message or success), repopo returnstrue | PolicyFailure | PolicyFixResult
For a single handler, wrap it in an array: fromFluidHandlers([handler]).
Example
Section titled “Example”import { fromFluidHandlers, makePolicy } from "repopo";import { copyrightFileHeaderHandlers, fluidCaseHandler } from "@fluidframework/build-tools";
// Convert multiple handlers with a namespace prefixconst FluidCopyrightPolicies = fromFluidHandlers(copyrightFileHeaderHandlers, { namePrefix: "Fluid:",});
// For a single handler, wrap it in an arrayconst [FluidCasePolicy] = fromFluidHandlers([fluidCaseHandler]);
const config: RepopoConfig = { policies: [ ...FluidCopyrightPolicies.map(p => makePolicy(p)), makePolicy(FluidCasePolicy), ],};