Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Support Many Kinds of Projects #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 36 additions & 8 deletions lib/commands/print-failing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,47 @@ module.exports = {

availableOptions: [],

run() {
appRoot() {
let project = this.project;

if (project.isEmberCLIAddon()) {
return 'addon';
} else if (project.isModuleUnification()) {
return 'src';
} else {
return 'app';
}
},

_scanForHbsFiles(dir) {
return walkSync(dir, { globs: ['**/*.hbs'] });
},

getTemplateFiles() {
let project = this.project;
let modulePrefix = project.config().modulePrefix;
let appRoot = this.appRoot();

if (project.isEmberCLIAddon()) {
let files = this._scanForHbsFiles(appRoot);
let moreFiles = this._scanForHbsFiles('tests/dummy/app');

return files.concat(moreFiles);
} else if (project.isModuleUnification()) {
return this._scanForHbsFiles(appRoot);
} else {
return this._scanForHbsFiles(appRoot);
}
},

run() {
let appRoot = this.appRoot();
let modulePrefix = this.project.config().modulePrefix;
let linter = new Linter();
let templatesWithErrors = [];

let templateFiles = walkSync('app').filter(file => {
// remove any non-hbs files
return path.extname(file) === '.hbs';
});
let templateFiles = this.getTemplateFiles();

templateFiles.forEach(file => {
let filePath = path.join('app', file);
let filePath = path.join(appRoot, file);
let contents = fs.readFileSync(filePath, { encoding: 'utf8' });
let moduleId = path.join(modulePrefix, file).slice(0, -4);

Expand Down