Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

feat: add Koa2 support#117

Merged
DominicKramer merged 16 commits intogoogleapis:masterfrom
mike-marcacci:koa2
Aug 6, 2018
Merged

feat: add Koa2 support#117
DominicKramer merged 16 commits intogoogleapis:masterfrom
mike-marcacci:koa2

Conversation

@mike-marcacci
Copy link
Copy Markdown
Contributor

@mike-marcacci mike-marcacci commented May 3, 2018

Fixes #8

  • Tests and linter pass1
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)2

1 I added tests to "system-tests", which I didn't get running locally. Also, the existing koa test should be failing, given that the code targets koa@1 while it depends on koa@2. I assume these aren't used?

2 Docs for all middleware are missing from README.md, so I didn't add any, and README_OLD.md is clearly "old".

@googlebot
Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@mike-marcacci
Copy link
Copy Markdown
Contributor Author

CLA signed.

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@DominicKramer
Copy link
Copy Markdown
Contributor

Awesome. Thanks for contributing this. I think it looks good, but I need to think more about whether there should be separate koa and koa2 properties. For hapi, the hapi property works for both hapi6 and hapi7. I'm not sure if it possible to do this with koa.

@mike-marcacci
Copy link
Copy Markdown
Contributor Author

@DominicKramer that’s fair, and it should be possible to support both by doing an argument count. I can go ahead and update this, but I’m also curious, do you know why the koa1 tests aren’t failing right now?

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 15, 2018
@DominicKramer
Copy link
Copy Markdown
Contributor

Thank you for looking into how to support Koa 1 and 2 together. It looks like there isn't a koa interface unit test. This is something that I will need to create.

@mike-marcacci
Copy link
Copy Markdown
Contributor Author

Hey @DominicKramer - I changed this to work with both koa1 and koa2. I did escape the type system a bit with some any casts, which probably isn't ideal. Feel free to add better typing, or perhaps I'll have time to look at that soon.

@DominicKramer
Copy link
Copy Markdown
Contributor

@mike-marcacci Thanks for working on this. It looks really good. I will take care of updating the types for you. Thanks.

@mike-marcacci
Copy link
Copy Markdown
Contributor Author

Awesome! Thanks so much @DominicKramer. I did also want to reiterate my note from the original PR: I'm pretty sure the "system-tests" aren't actually being run, at least locally with npm test. You might want to confirm this before merging incoming PRs in general :)

@DominicKramer
Copy link
Copy Markdown
Contributor

@mike-marcacci Sorry, I missed your "system tests" comment. It is expected that the system tests are not run with npm test. The system tests and samples tests are run separately using the npm run system-test and npm run samples-test commands and are handled by CircleCI. Thank you, though, for asking about this.

@googlebot
Copy link
Copy Markdown

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jun 12, 2018
@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jun 12, 2018
@mike-marcacci
Copy link
Copy Markdown
Contributor Author

mike-marcacci commented Jun 12, 2018

🤦🏻‍♂️ I guess I should have read the package.json. Also it looks like I inadvertently pulled in some greenkeeper commits and broke the CLA googlebot, so I rebased and forced-pushed.

@DominicKramer
Copy link
Copy Markdown
Contributor

No worries.

@DominicKramer
Copy link
Copy Markdown
Contributor

There were a few issues unrelated to this PR that are blocking this PR from landing. Some are fixed in PR #183 and PR #185. There is another in the pipeline. When those are done, this PR should be unblocked.

mike-marcacci and others added 5 commits August 3, 2018 09:21
The Koa middleware has been updated to return an object that is both a Promise and Iterator, supporting both Koa 1.x and 2.x
Comment thread src/interfaces/koa.ts Outdated
}
};
}
} No newline at end of file

This comment was marked as spam.

This comment was marked as spam.

Comment thread src/interfaces/koa2.ts Outdated
@@ -0,0 +1,69 @@
/**
* Copyright 2016 Google Inc. All Rights Reserved.

This comment was marked as spam.

This comment was marked as spam.

@DominicKramer DominicKramer changed the title add koa2 support feat: add Koa2 support Aug 6, 2018
@DominicKramer DominicKramer merged commit 13e86c9 into googleapis:master Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement. in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants