Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VSCode launch.json debugging configuration in README.md #576

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,10 @@ It's recommended that you set up your codemod project to all debugging via the V
],
"console": "internalConsole",
"sourceMaps": true,
"outFiles": []
"outFiles": [],
"windows": {
"program": "${workspaceRoot}/node_modules/jscodeshift/bin/jscodeshift.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try ${workspaceRoot}/node_modules/.bin/jscodeshift.cmd and see if that works - for more consistency with how it's done for other platforms.

Copy link
Author

@saiki987 saiki987 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reply.
When I tried to launch debugger using it, I got the following error in DEBUG CONSOLE:

C:\Program Files\Volta\node.exe --nolazy .\node_modules\.bin\jscodeshift.cmd --dry --print -t transform.js --parser babel --run-in-band target.js
Uncaught SyntaxError .\node_modules\.bin\jscodeshift.cmd:1
@IF EXIST "%~dp0\node.exe" (
^

SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at <anonymous> (node:internal/modules/cjs/loader:1220:27)
    at <anonymous> (node:internal/modules/cjs/loader:1310:10)
    at <anonymous> (node:internal/modules/cjs/loader:1119:32)
    at <anonymous> (node:internal/modules/cjs/loader:960:12)
    at executeUserEntryPoint (node:internal/modules/run_main:81:12)
    at <anonymous> (node:internal/main/run_main_module:23:47)
Process exited with code 1

It seems that vscode runs .\node_modules\.bin\jscodeshift.cmd using node.

When I ran .\node_modules\.bin\jscodeshift.cmd --dry --print -t transform.js --parser babel --run-in-band target.js it was successfull but I couldn't find any settings in launch.json to do this.

}
},
{
"name": "Debug All JSCodeshift Jest Tests",
Expand Down