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
webrtc: add tooling to allow using jscodeshift codemods #11524
webrtc: add tooling to allow using jscodeshift codemods #11524
Conversation
adds the tooling used in https://bugs.chromium.org/p/chromium/issues/detail?id=836871 to the WPT repository to allow anyone to run it. See https://github.com/facebook/jscodeshift for documentation on jscodeshift.
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.
A few nits to clean up; skipping lint (or the lint check for console.log) would make the bot enjoy it more.
I was reading about the magic of package-lock.json the other day; I didn't understand it. But if it's not going to be checked in, should it be added to .gitignore?
export default function transformer(file, api) { | ||
const j = api.jscodeshift; | ||
return j(file.source) | ||
// .forEach(path => console.log(path)) |
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.
Remove commented-out code?
webrtc/tools/html-codemod.js
Outdated
// read back file, resubstitute | ||
const newScript = fs.readFileSync(scriptFilename, 'utf-8').toString(); | ||
|
||
// const modifiedContent = originalContent.replace(script[0], script[1] + newScript + script[script.length - 1]); |
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.
Delete obsolete(?) code?
adds the tooling used in https://bugs.chromium.org/p/chromium/issues/detail?id=836871
to the WPT repository to allow anyone to run it.
See https://github.com/facebook/jscodeshift for documentation on jscodeshift.
@alvestrand if you want to test it out try running
node html-codemod.js codemod-peerconnection-addcleanup ../protocol/video-codecs.https.html
from the tools directory.@foolip tagging you so you know there is something for codemods and can make introductions if someone asks about them or making large changes procedurally
Also removes package-lock.json. This is dev-tooling, a lock file makes no sense.