Skip to content

Commit 2821bdb

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)
1 parent 79d64ff commit 2821bdb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/cli/src/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'path';
12
import semver from 'semver';
23
import chalk from 'chalk';
34
import { PluginManager } from 'live-plugin-manager';
@@ -126,9 +127,10 @@ export default async function main(paths: string[], flags: Flags) {
126127
);
127128

128129
for (const transform of transforms) {
129-
console.log(chalk.green('Running transform:'), transform);
130+
const resolvedTransformPath = path.resolve(transform);
131+
console.log(chalk.green('Running transform:'), resolvedTransformPath);
130132

131-
await jscodeshift.run(transform, paths, {
133+
await jscodeshift.run(resolvedTransformPath, paths, {
132134
verbose: 0,
133135
dry: flags.dry,
134136
print: true,

0 commit comments

Comments
 (0)