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 how to execute jscodeshift #32996
Conversation
I'm not sure if something has changed, but transforms I've run locally have failed lately due to configuration issues. Copied [default options](https://github.com/facebook/jscodeshift/blob/48f5d6d6e5e769639b958f1a955c83c68157a5fa/parser/babylon.js), plus `importAssertions`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a question. (Feel free to punt if this is blocking development.)
Instead of explicitly copy-pasting the default configs here and having to maintain this file when things change, is there a way to say this config file extends whatever is default?
No, I looked but couldn't find that. It doesn't seem like |
I see. This might've changed in a recent release: https://github.com/facebook/jscodeshift/releases The reason we didn't detect it as a breaking change is because we haven't version locked amphtml/build-system/tasks/sweep-experiments/index.js Lines 101 to 110 in cde4736
I'm not opposed to your adding it as a dependency and switching to the API instead of the CLI: https://www.npmjs.com/package/jscodeshift#the-jscodeshift-api. With this, we'll get a renovate PR for every new version, and we can preemptively detect and fix breaking changes. |
The jscodeshift api refers to the object passed in a transform's implementation, not the Runner itself. The Runner doesn't seem to be intentionally accessible, but some do use it. However, it didn't work for me. This shouldn't be an issue for versioning though.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after moving the config dir into test-configs/
. (See comment below.)
This shouldn't be an issue for versioning though.
npx jscodeshift
will use the local copy if added topackage.json
Excellent, this works too.
I'm not sure if something has changed, but transforms I've run locally have failed lately due to configuration issues. Copied default options, plus
importAssertions
.