Skip to content

Commit 1c72768

Browse files
committed
fix standalone transform runs - resolve path of transform
in the issue you linked [1] from jscodeshift, i think you forgot the `path.resolve` for non-http(s) imports (not even sure how they'd work tbh). i tried running a local transform and it didn't work, but with this fix it did regardless of where i called the `packages/cli/bin/codeshift-cli.js` from. i think you might've been using the packages and not the --transforms flag so i understand why you could've missed it 😅 tbh there are more improvements to make w/ the local transforms (see [2]) but this is the first step :D [1] facebook/jscodeshift#398 [2] #48 (comment) Signed-off-by: Kipras Melnikovas <[email protected]>
1 parent 7ecbe19 commit 1c72768

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/cli/src/main.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import semver from 'semver';
22
import chalk from 'chalk';
3+
import path from 'path';
34
import ora from 'ora';
45
import { PluginManager } from 'live-plugin-manager';
56
import merge from 'lodash/merge';
@@ -181,9 +182,10 @@ Make sure the package name "${pkgName}" is correct and try again.`,
181182
);
182183

183184
for (const transform of transforms) {
184-
console.log(chalk.green('Running transform:'), transform);
185+
const resolvedTransformPath = path.resolve(transform);
186+
console.log(chalk.green('Running transform:'), resolvedTransformPath);
185187

186-
await jscodeshift.run(transform, paths, {
188+
await jscodeshift.run(resolvedTransformPath, paths, {
187189
verbose: flags.verbose,
188190
dry: flags.dry,
189191
print: true,

0 commit comments

Comments
 (0)