@navikt/aksel
Version:
Aksel command line interface. Codemods and other utilities for Aksel users.
32 lines (31 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = transformer;
const move_variant_to_data_color_1 = require("../../../utils/move-variant-to-data-color");
const migrationConfigToggleSub = {
component: "Chips.Toggle",
prop: "variant",
changes: {
action: { color: "accent" },
neutral: { color: "neutral" },
},
};
const migrationConfigToggleDirect = Object.assign(Object.assign({}, migrationConfigToggleSub), { component: "ChipsToggle" });
const migrationConfigRemovableSub = Object.assign(Object.assign({}, migrationConfigToggleSub), { component: "Chips.Removable" });
const migrationConfigRemovableDirect = Object.assign(Object.assign({}, migrationConfigToggleSub), { component: "ChipsRemovable" });
function transformer(file, api) {
const configs = [
migrationConfigToggleSub,
migrationConfigToggleDirect,
migrationConfigRemovableSub,
migrationConfigRemovableDirect,
];
let source = file.source;
for (const config of configs) {
const newSource = (0, move_variant_to_data_color_1.moveVariantToDataColor)(Object.assign(Object.assign({}, file), { source }), api, config);
if (newSource) {
source = newSource;
}
}
return source;
}