Skip to content

Commit e660109

Browse files
committed
Refactored migrator by creating findTemplates method
1 parent e3953ff commit e660109

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/migrator.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ module.exports = class Migrator {
2525
return classFilePaths;
2626
}
2727

28+
findTemplates() {
29+
const templateFolderPath = path.join(this.projectRoot, 'app/templates');
30+
const templateFilePaths = glob.sync(`${templateFolderPath}/**/*.hbs`);
31+
32+
return templateFilePaths;
33+
}
34+
2835
skipTemplatesUsedAsLayoutName(templateFilePaths) {
2936
const classFilePaths = this.findClassicComponentClasses();
3037
const componentsWithLayoutName = getLayoutNameTemplates(classFilePaths);
@@ -64,8 +71,7 @@ module.exports = class Migrator {
6471
templateFilePaths = this.skipTemplatesUsedAsLayoutName(templateFilePaths);
6572

6673

67-
let sourceTemplatesPath = path.join(this.projectRoot, 'app/templates');
68-
var sourceTemplateFilePaths = glob.sync(`${sourceTemplatesPath}/**/*.hbs`);
74+
let sourceTemplateFilePaths = this.findTemplates();
6975
let templatesInPartials = getPartialTemplates(sourceTemplateFilePaths);
7076
if (templatesInPartials.length) {
7177
templateFilePaths = templateFilePaths.filter(sourceTemplateFilePath => {

0 commit comments

Comments
 (0)