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

webrtc: add tooling to allow using jscodeshift codemods #11524

Merged
merged 3 commits into from Jun 25, 2018

Conversation

fippo
Copy link
Contributor

@fippo fippo commented Jun 15, 2018

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.

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.
Copy link
Contributor

@alvestrand alvestrand left a 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))
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commented-out code?

// 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]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete obsolete(?) code?

@alvestrand alvestrand merged commit 59384fa into web-platform-tests:master Jun 25, 2018
@fippo fippo deleted the codemods-are-awesome branch June 25, 2018 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants