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
(feat) refactored to allow route templates to be overridden #81
Conversation
Encountered a few pathing issues - sorting them out. |
1262dc2
to
5967a31
Compare
Other than my comment re: require, I think this is good to go. |
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.
fwiw - I have it running locally with this code;
const env = process.env.NODE_ENV;
console.error('Environment', env);
let canImportByAlias = true;
if (env === 'test') {
canImportByAlias = false;
}
Seems to produce the same result but also allows you to run with a linked npm package..
let canImportByAlias: boolean; | ||
try { | ||
require('tsoa'); | ||
require.resolve('tsoa'); |
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.
This feels problematic if you're trying to test with a project that is linked locally to tsoa. I tested, and if using link - require always throws an error.
If this is only there to support the tests running - could we perhaps use NODE_ENV instead to set the environment to test - and change the imports that way instead?
5967a31
to
68eaffb
Compare
Final update;
Also ran yarn to update the lock file. |
@cadriel Thanks for doing this work! We've needed something like this for a while. One issue with the PR right now is the use of |
Sure, np. :) I'll push in an update that makes use of cross-env momentarily. I also have some more work that reduces the amount of code produced in the routes.ts - and instead defer's it to two middleware functions. One handles the parameter checking in the same way (but passes the validated args in the request) - the other loads the controller by way of a factory service. Not quite ready yet, but if you were interested in those changes I could push them in too when ready. |
68eaffb
to
145d611
Compare
Updated to use cross-env. |
Thanks @cadriel . Sure, I'll wait to merge until those changes come up. |
Looks like there's still some issues building on Windows. I'll look into these and let you know once I have it running there. |
Ok @lukeautry; This is now building and testing fine in both MacOS and Windows 10 for me. |
…ss-env to ensure cross platform compatability
a03b731
to
1440707
Compare
You can probably merge this one now if you're happy with it. The other work I mentioned above I'll create another PR for in the future. |
Hi, |
Should be able to merge it in this weekend.
…On Mar 25, 2017 1:38 AM, "Christian Serron" ***@***.***> wrote:
Hi,
When do you think this will be ready to be merged in?
We are actually waiting for something like this to be implemented in our
TSOA project.
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#81 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AIXUAFHLIuObRiK5pwuuFErZ9DDg9GtGks5rpKhmgaJpZM4Mf31k>
.
|
Merged, released in 1.1.7. Thanks @cadriel! |
np :) |
First stab at refactoring the way route templates are handled.
Note: I'm very tempted to move the hardcoded handlebar content in
routeGenerator.ts
on aroundline: 50
to the templates too, but wanted your thoughts first @lukeautry.Otherwise - all tests are passing and this seems to be working ok.