-
-
Notifications
You must be signed in to change notification settings - Fork 194
index event
#89
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
index event
#89
Conversation
|
Any update on this? |
index.js
Outdated
| if (listenerCount(this, 'directory') !== 0) { | ||
| this.emit('directory') | ||
| if (listenerCount(this, 'directory')) { | ||
| this.emit('directory', path) |
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.
Adding a new argument to the directory event does not seem related to adding an index event. Can you please restructure this pull request to only do what was described in the pull request summary and ping me when you have updated it?
|
I've just rebased my changes over master and tests are passing, would you be able to merge it? |
|
The comment I made on your code hasn't been addressed yet. Please address it and I'll take another look :)! |
Sorry, I missed the comment :-P I've just fixed it and move the |
|
Code rebased and tests passing. Can we focus on that over the other pull-requests? This is the most important for NodeOS at this moment... |
|
Sure! Can you use typeof instead of instanceof for function checks? Why do we need both an option and an event? Is it not possible to just have one or the other? |
|
At first I added an event like 'directory' and so, but later found it was easier to use an optional callback. In fact, if I would redesign the API, I would remove all the events except error and just use optional callbacks, |
|
I have just changed |
|
Cool! Why do we need both an option and an event? Is it not possible to just have one or the other? If we can use events over function options that would better fit in the current API. I know the API may not be what everyone is used to, but it is what I have inherited, and it doesn't sound like you want to wait for a discussion on changing the way the API works to land this feature :) At the very least, you need to move the test you made for the index event out of the section for the index option and add documentation for that to the README as well. |
| } | ||
|
|
||
| this._extensions = opts.extensions !== undefined | ||
| ? normalizeList(opts.extensions, 'extensions option') |
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.
Is this a necessary change for this PR?
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.
normalizeList() now return an empty list when the input is undefined, so the check here is bloated.
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.
I don't see any changes to normalizeList in your PR. Perhaps I should be clearer: don't include changes in your PR that are not accomplishing your goal. These types of changes need to be different PRs. Please revert this change.
| set `false` or to supply a new index pass a string or an array | ||
| in preferred order. | ||
| By default *send* supports "index.html" files. To disable this, set index option | ||
| to `false`, or you can be able to supply a new index passing a string with the |
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.
"you can be able to" doesn't sound right. I think probably just remove those words?
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.
And passing would become just pass
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.
That's formal english... As you want.
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.
That's formal english... As you want.
I'm sorry, I can't seem to figure out what your response means...
|
And I was jus able to sit down a s review your pull request, woot! We can get this moving along for sure :) I just had a few questions and comments; some in this conversation itself and some inline in the code. |
Yes, we could use just one of them, and in fact it would be better to use optional callbacks only, I just added the event to be on pair with the API, but I would remove them.
I'm open for a discussion about changing how the API works, it's just that this seemed to be ready to merge and wanted to use upstream code ASAP. I think events-based API should be deprecated and use optional callbacks instead, it's the correct behaviour and what everybody expects:
This also makes the API more explicit about what can and what can't do? What do you think?
Where should I put the test for the |
|
We can discuss a new API style for this module, absolutely, but no new API style will be merged for months to come, because this module is locked to the release schedule of Express.js itself. Even this new feature will not get released until a minor release of Express.Js is scheduled. I wish we had all this conversation 3 months ago,when I started commenting on the changes, as it would have ended up with the 4.14 Express.js release. I don't have time this weekend to discuss and think about an entire change to the API of this module, only have been able to sneak in reviewing these changes as a simple feature addition, as it sounded like you were interested in landing. I'll try to circle back to this PR another day when I have some time to discuss a new API :) |
That's totally insane, being so much specific it should have its own lifecycle, specially for this backward compatible things... And if not, semantic versioning is just for that...
Ok, send me an email when you have time to discuss it. |
You're always welcome to use another module or fork this module. This is not up for discussion, I'm sorry. This code could have easily just been embedded into Express core. It is broken out for you to use it without Express, not to have a different release schedule, I'm sorry this is an inconvenience to you. We barely have enough people to maintain all this module, let alone for them all yo have different release timelines,meaning we have to create multiple lineages for modules when security vulnerabilities come out. I feel like this is getting a little too headed foe me, so I'm not longer going to participate in this PR for time time being. Another member of the organization is welcome to pick up moving this PR forward... |
|
I'm currently using a fork of this repo, the point of willing my changes to be merged is to clean up and have a consistent repo, but just by suggesting to use a repo, although acceptable, only contribute to degrade npm ecosystem. On NodeOS we lack a lot of people too, being so picky with the pull-requests just makes everybody losing their time and willing to not contribute anymore. Everybody lose :-( |
|
Your PR is just never going to land, as you have not even hinted that you are willing to make any changes to your PR, and our philosophies for maintain seems to be too different: You suggest that I just merge anything without question, and I only want to merge quality code. These are unfortunately mutually exclusive. If you want to get a feature added, please work to add the feature with the API we have, rather than debate which API style is better. |
|
I did all the changes that you tell me to do. You are not looking for quality code, but a clean and verbose commits history. If you really wanted to have quality code, you'll start by thinking about changing the API, but I only hinted about that and tried to adapt to the current code style and project organization. If you are not willing to maintain this project is ok, just give me permissions and I'll maintain it in your place. |
I'm not sure why you say this, as there are many, many open comments on your code above, and no commits since any of them. No changes I can see.
No. |
Allow to render a custom
indexpage from a function.