Skip to content

Commit 9ba5660

Browse files
authored
Merge pull request #156 from zhanwang626/improve-compatibility-with-ember-template-recast
fix the break when running ember-template-recast
2 parents 8d384c9 + 8f2ce8e commit 9ba5660

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bin-support.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async function runJsTransform(root, transformName, args, extensions = DEFAULT_JS
4848
async function runTemplateTransform(root, transformName, args) {
4949
const execa = require('execa');
5050
const chalk = require('chalk');
51+
const path = require('path');
5152
const { parseTransformArgs } = require('./options-support');
5253
const { getTransformPath } = require('./transform-support');
5354

@@ -56,10 +57,12 @@ async function runTemplateTransform(root, transformName, args) {
5657
try {
5758
let transformPath = getTransformPath(root, transformName);
5859
let binOptions = ['-t', transformPath, ...paths];
60+
let templateRecastDir = path.dirname(require.resolve('ember-template-recast/package.json'));
61+
let templateRecastPkg = require('ember-template-recast/package');
62+
let templateRecastBinPath = path.join(templateRecastDir, templateRecastPkg.bin);
5963

60-
return execa('ember-template-recast', binOptions, {
64+
return execa(templateRecastBinPath, binOptions, {
6165
stdio: 'inherit',
62-
preferLocal: true,
6366
env: {
6467
CODEMOD_CLI_ARGS: JSON.stringify(options),
6568
},

0 commit comments

Comments
 (0)