ember-codemod-pod-to-octane
Version:
Codemod to un-pod Ember apps, addons, and engines
29 lines (28 loc) • 938 B
JavaScript
import { findFiles } from '@codemod-utils/files';
import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapComponents(options) {
const { projectRoot } = options;
const podDir = 'addon/components';
const filePathsForClass = findFiles(`${podDir}/**/component.{d.ts,js,ts}`, {
projectRoot,
});
const filePathsForStylesheet = findFiles(`${podDir}/**/styles.{css,scss}`, {
projectRoot,
});
const filePathsForTemplate = findFiles(`${podDir}/**/template.hbs`, {
projectRoot,
});
return [
...filePathsForClass,
...filePathsForStylesheet,
...filePathsForTemplate,
].map((oldFilePath) => {
const newFilePath = renamePodPath(oldFilePath, {
podDir,
replace: (dir) => {
return `addon/components/${dir}`;
},
});
return [oldFilePath, newFilePath];
});
}