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

Migration bot #625

Closed
tj opened this issue Dec 20, 2015 · 18 comments
Closed

Migration bot #625

tj opened this issue Dec 20, 2015 · 18 comments
Milestone

Comments

@tj
Copy link
Member

tj commented Dec 20, 2015

Will implement this sometime unless someone wants to have some fun before me!

  • fetch list of middleware etc from npm
  • transform gen functions to async functions
  • transform yields to awaits
  • warn on use of co-isms (yield {}, yield [], etc)
  • send pull-request for 2.x support

This doesn't need to really perform the PRs any time soon, but ideally we're ready for it when the time comes.

Related: #621

@haoxins
Copy link
Member

haoxins commented Dec 21, 2015

transform yields to awaits

So, the recommended way for koa@2's middlewares is async/await(babel compiled for now), not use Promise directly ?

@dead-horse
Copy link
Member

So, the recommended way for koa@2's middlewares is async/await(babel compiled for now), not use Promise directly ?

definitely.

@tj
Copy link
Member Author

tj commented Dec 21, 2015

@coderhaoxin yea I think it's pointless to convert everything to promises, the yield -> async is almost a 1:1 change, promises are a little more complicated that way, and everyone will just be doing it all over again otherwise. I'm not suggesting babel here either though, just that we have something available for when Node gets async/await

@tejasmanohar
Copy link
Member

So, the recommended way for koa@2's middlewares is async/await(babel compiled for now), not use Promise directly ?

+1. Either use Babel compiled (and still keep it on next dist-tag, not latest) or just wait but converting to the raw Promise-based API is not worth the effort since it's regression (IMO).

@SupaJoon
Copy link
Contributor

I'd be happy to work on these things but I may need some guidance!

@tejasmanohar
Copy link
Member

@aquascaper just ask whenever you have questions / need help :)

@tj Were you planning to run this bot on all koa 1.x middleware you can find in NPM or just the "official" ones (koajs/* repos)? I think it'd be fair to run them on ones we don't maintain as well since most of the "koa" related packages on NPM are middleware (since there's not much else I can think of that you can write for Koa haha).

@tj
Copy link
Member Author

tj commented Dec 26, 2015

yea probably everything, could test drive on a few of the koajs/* ones first

@tejasmanohar
Copy link
Member

👍 fair

@jonathanong
Copy link
Member

If anyone wants to get started on this, I will make an empty repo in this org and add you to the team.

@jonathanong jonathanong added this to the 2.0.0 milestone Jan 18, 2016
@Tankenstein
Copy link

I'm interested in doing this, need a couple days before i can start though.

@magicdawn
Copy link

warn on use of co-isms (yield {}, yield [], etc)

how about warn this in co.
cause foo = async function(){ } & foo = co.wrap(function*(){ }) are alomost same. but you can yield {}, yield [], yield thunk, and await can not.

@sibelius
Copy link

@tj consider using a codemod to transform javascript code using https://github.com/facebook/jscodeshift

Take a look at this: https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb#.vh2b6nqse

@shime
Copy link
Contributor

shime commented Sep 29, 2016

@jonathanong I would love to start on this, what's the next step?

@jonathanong
Copy link
Member

@shime start from scratch? i'm not sure anyone has started on this yet

@shime
Copy link
Contributor

shime commented Sep 30, 2016

@jonathanong yup, sent you an email.

@hedgerh
Copy link

hedgerh commented Oct 4, 2016

@shime @jonathanong let me know if i can do anything to help. jscodeshift, linked above by @sibelius, looks like it could be pretty handy for the transforms. https://github.com/facebook/jscodeshift

@shime
Copy link
Contributor

shime commented Oct 5, 2016

@hedgerh sure, yeah that's a good idea. feel free to submit PRs to related middleware, I haven't submitted any yet.

@jonathanong
Copy link
Member

I don't think we need this anymore :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests