gkz / grasp

JavaScript structural search, replace, and refactor
http://graspjs.com
MIT License
1.28k stars 33 forks source link

0.6.0 beta - Flow and JSX support #107

Open gkz opened 7 years ago

gkz commented 7 years ago

Hey guys, Check out and test support for Flow type annotations and JSX by installing the beta with npm install grasp@beta

Still to do:

kristianmandrup commented 7 years ago

Sweet :)

gkz commented 7 years ago

@ainthek @adros let me know if I'm missing anything that you have in your fork

kristianmandrup commented 7 years ago

Congrats!

I worked on a major refactoring to split it up into smaller parts that make code more readable and easier to tweak, adjust, unit test etc. I've also added support for a better way to use replace and search as APIs, with support for filter actions to f.ex append/prepend specific nodes, not just Raw.

Was very difficult for me to use existing docs and understand how to use custom replace functions. Please improv docs and tests, esp. covering examples for classes and ES6 stuff, flow, jsx etc.

Cheers!

adros commented 7 years ago

I have one more commit, which I haven't include in any PR

https://github.com/gratex/grasp/commit/54d889a654f7b9318d7279ba6

It was just a quick workaround, not widly tested. Take a look at if if you want and I may create PR if you think it's suitable....

ainthek commented 7 years ago

Christian: yeah docs are in very "strange" style. See grasp-samples and grasp-tools repo. It took me while do decode gkz thinking.

gkz commented 7 years ago

Can you expand on how they are "strange", what could be done to improve them?

kristianmandrup commented 7 years ago

For one add better, more real life examples. I couldn't figure out how to use the replace callback function. Also, no examples for methods in classes etc. Examples are only for very simple cases like adding two numbers and such.