UNPKG

ember-codemod-pod-to-octane

Version:

Codemod to un-pod Ember apps, addons, and engines

22 lines (21 loc) 755 B
import { findFiles } from '@codemod-utils/files'; import { renamePodPath } from '../../../../../utils/files/index.js'; export function mapComponents(options) { const { projectRoot } = options; const podDir = 'app/components'; const filePathsForClass = findFiles(`${podDir}/**/component.js`, { projectRoot, }); const filePathsForTemplate = findFiles(`${podDir}/**/template.js`, { projectRoot, }); return [...filePathsForClass, ...filePathsForTemplate].map((oldFilePath) => { const newFilePath = renamePodPath(oldFilePath, { podDir, replace: (dir) => { return `app/components/${dir}`; }, }); return [oldFilePath, newFilePath]; }); }