Skip to content

Commit

Permalink
use Robs suggestion on template location
Browse files Browse the repository at this point in the history
  • Loading branch information
thoov committed Mar 1, 2021
1 parent dc53b63 commit f693f31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
17 changes: 3 additions & 14 deletions packages/compat/src/compat-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { MacrosConfig } from '@embroider/macros/src/node';
import bind from 'bind-decorator';
import { pathExistsSync } from 'fs-extra';
import { tmpdir } from 'os';
import { dirname } from 'path';
import { Options as AdjustImportsOptions } from '@embroider/core/src/babel-plugin-adjust-imports';

interface TreeNames {
Expand Down Expand Up @@ -318,10 +317,6 @@ class CompatAppAdapter implements AppAdapter<TreeNames> {
return this.configTree.readConfig().rootURL;
}

private templateCompilerPath(): string {
return 'ember-source/vendor/ember/ember-template-compiler';
}

strictV2Format() {
return false;
}
Expand Down Expand Up @@ -380,15 +375,9 @@ class CompatAppAdapter implements AppAdapter<TreeNames> {

@Memoize()
resolveTemplateCompilerPath() {
// we cannot assume this will be resolvable from the project root as it might be
// symlinked. Instead we should the package location and grab the template
// compiler from it.
let emberSourcePkg = this.allActiveAddons.find(p => p.name === 'ember-source');
if (emberSourcePkg) {
return resolveSync(this.templateCompilerPath(), { basedir: dirname(dirname(emberSourcePkg.root)) });
}

return resolveSync(this.templateCompilerPath(), { basedir: this.root });
let emberSource = this.oldPackage.app.project.findAddonByName('ember-source');
let templateCompilerPath = emberSource.absolutePaths.templateCompiler;
return templateCompilerPath;
}

// unlike `templateResolver`, this one brings its own simple TemplateCompiler
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/src/v1-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class V1App {
private _implicitScripts: string[] = [];
private _implicitStyles: string[] = [];

protected constructor(protected app: EmberApp, protected packageCache: PackageCache) {}
protected constructor(public app: EmberApp, protected packageCache: PackageCache) {}

// always the name from package.json. Not the one that apps may have weirdly
// customized.
Expand Down

0 comments on commit f693f31

Please sign in to comment.