UNPKG

ember-codemod-add-component-signatures

Version:
24 lines (23 loc) 738 B
import { getBaseComponent } from '../../utils/components.js'; import { passSignatureToBaseComponent, updateConstructor, updateReferences, } from './create-signature/index.js'; export function createSignature(file, data) { const { baseComponentName } = getBaseComponent(file); if (baseComponentName === undefined) { return file; } // eslint-disable-next-line prefer-const let { interfaceName, newFile } = passSignatureToBaseComponent(file, { baseComponentName, data, }); newFile = updateConstructor(newFile, { data, }); if (interfaceName === undefined) { return newFile; } return updateReferences(newFile, { data, interfaceName, }); }