ember-codemod-pod-to-octane
Version:
Codemod to un-pod Ember apps, addons, and engines
21 lines (20 loc) • 743 B
JavaScript
import { join } from 'node:path';
import { findFiles } from '@codemod-utils/files';
import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapServices(options) {
const { podPath, projectRoot } = options;
const podDir = join('tests/unit', podPath);
const filePaths = findFiles(`${podDir}/**/service-test.{js,ts}`, {
ignoreList: [join('tests/unit', podPath, 'services/**')],
projectRoot,
});
return filePaths.map((oldFilePath) => {
const newFilePath = renamePodPath(oldFilePath, {
podDir,
replace: (key) => {
return `tests/unit/services/${key}-test`;
},
});
return [oldFilePath, newFilePath];
});
}