Skip to content

Commit

Permalink
Removed unnecessary joins (#67)
Browse files Browse the repository at this point in the history
refactor: Removed unnecessary joins

Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
  • Loading branch information
ijlee2 and ijlee2 authored Oct 11, 2024
1 parent 6a9c5e7 commit 2266bb0
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function mapComponentClasses(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, 'components', '**', 'component.{d.ts,js,ts}'),
join('app', podPath, 'components/**/component.{d.ts,js,ts}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function mapComponentStylesheets(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, 'components', '**', 'styles.{css,scss}'),
join('app', podPath, 'components/**/styles.{css,scss}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function mapComponentTemplates(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, 'components', '**', 'template.hbs'),
join('app', podPath, 'components/**/template.hbs'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapRouteAdapters(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(join('app', podPath, '**', 'adapter.{js,ts}'), {
const filePaths = findFiles(join('app', podPath, '**/adapter.{js,ts}'), {
projectRoot,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapRouteControllers(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, '**', 'controller.{js,ts}'),
{
projectRoot,
},
);
const filePaths = findFiles(join('app', podPath, '**/controller.{js,ts}'), {
projectRoot,
});

return filePaths.map((oldFilePath) => {
const newFilePath = renamePodPath(oldFilePath, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapRouteModels(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(join('app', podPath, '**', 'model.{js,ts}'), {
const filePaths = findFiles(join('app', podPath, '**/model.{js,ts}'), {
projectRoot,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapRouteRoutes(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(join('app', podPath, '**', 'route.{js,ts}'), {
const filePaths = findFiles(join('app', podPath, '**/route.{js,ts}'), {
projectRoot,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapRouteSerializers(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, '**', 'serializer.{js,ts}'),
{
projectRoot,
},
);
const filePaths = findFiles(join('app', podPath, '**/serializer.{js,ts}'), {
projectRoot,
});

return filePaths.map((oldFilePath) => {
const newFilePath = renamePodPath(oldFilePath, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function mapRouteStylesheets(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, '!(components)', '**', 'styles.{css,scss}'),
join('app', podPath, '!(components)/**/styles.{css,scss}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function mapRouteTemplates(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('app', podPath, '!(components)', '**', 'template.hbs'),
join('app', podPath, '!(components)/**/template.hbs'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { renamePodPath } from '../../../../../utils/files/index.js';
export function mapServices(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(join('app', podPath, '**', 'service.{js,ts}'), {
const filePaths = findFiles(join('app', podPath, '**/service.{js,ts}'), {
projectRoot,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ export function mapComponents(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join(
'tests/integration',
podPath,
'components',
'**',
'component-test.{js,ts}',
),
join('tests/integration', podPath, 'components/**/component-test.{js,ts}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ export function mapRouteControllers(options: Options): FilePathMapEntries {
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
*/
const filePaths1 = findFiles(
join(
'tests/unit',
podPath,
'!(controllers)',
'**',
'controller-test.{js,ts}',
),
join('tests/unit', podPath, '!(controllers)/**/controller-test.{js,ts}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function mapRouteRoutes(options: Options): FilePathMapEntries {
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
*/
const filePaths1 = findFiles(
join('tests/unit', podPath, '!(routes)', '**', 'route-test.{js,ts}'),
join('tests/unit', podPath, '!(routes)/**/route-test.{js,ts}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function mapServices(options: Options): FilePathMapEntries {
const { podPath, projectRoot } = options;

const filePaths = findFiles(
join('tests/unit', podPath, '!(services)', '**', 'service-test.{js,ts}'),
join('tests/unit', podPath, '!(services)/**/service-test.{js,ts}'),
{
projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { join } from 'node:path';

import { findFiles } from '@codemod-utils/files';

import type {
Expand All @@ -12,7 +10,7 @@ export function mapServices(options: Options): FilePathMapEntries {
const { projectRoot } = options;

const filePaths = findFiles(
join('tests/unit/!(services)/**/service-test.{js,ts}'),
'tests/unit/!(services)/**/service-test.{js,ts}',
{
projectRoot,
},
Expand Down

0 comments on commit 2266bb0

Please sign in to comment.