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

Code cleanup #120

Merged
merged 13 commits into from
Feb 2, 2018
Merged

Code cleanup #120

merged 13 commits into from
Feb 2, 2018

Conversation

BehindTheMath
Copy link
Collaborator

  • Code cleanup
  • Cleanup parse-options tests
  • Clean up README
  • Remove old switchFallback code

Copy link
Collaborator

@robinnorth robinnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the proposed changes look good to me!

There are a few more long-standing code comments that could possibly do with removing as part of a cleanup too -- things like commented-out module require calls and disabled experimental code. https://github.com/MoOx/pjax/blob/master/lib/switches.js has a lot of examples of this. https://github.com/MoOx/pjax/blob/master/lib/switches-selectors.js#L15-L20 and https://github.com/MoOx/pjax/blob/master/index.js#L12 also spring to mind.

Finally, do we still need the polyfill for Function.prototype.bind? AFAIK it's supported on all platforms that also fully support the History API.

@BehindTheMath
Copy link
Collaborator Author

I'll take a look at those later.

BTW, you should also be able to push commits to this PR. Just checkout upstream/cleanup/misc-cleanup, and then push your commits back to the upstream branch.

@robinnorth
Copy link
Collaborator

Sure, thanks! I made comments rather than commits to avoid stepping on your toes, but if you like, I can action the changes I suggested. Equally happy to leave them to you, if you like.

@BehindTheMath
Copy link
Collaborator Author

Everything looks good, but I think we should leave this open until we're ready to release 0.2.5, in case there's anything we want to add.

@robinnorth
Copy link
Collaborator

Sounds good to me, hopefully we can get 0.2.5 out fairly soon!

BehindTheMath and others added 6 commits January 31, 2018 22:19
- Rename objects for clarity and inline unneeded objects
- Remove unneeded tests
- Use Object.keys().length instead of a custom function
- Use typeof === "object" instead of a custom function that checks
  the prototype tree as well, since we don't expect anything but an
  object literal.
@robinnorth robinnorth force-pushed the cleanup/misc-cleanup branch from 4f6690a to 1eb43f7 Compare January 31, 2018 22:21
@robinnorth
Copy link
Collaborator

I've actioned the items I suggested previously and rebased against master to keep this PR up-to-date. I can't think of anything else that needs cleaning up at present, other than possibly the description in package.json (and adding a contributors attribute?).

script.async = false; // force synchronous loading of peripheral js
if (src !== "") {
script.src = src
script.async = false // force asynchronous loading of peripheral js
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robinnorth I'm confused. Why did you change this back? I thought we agreed it was synchronous.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I guess I didn't quite successfully resolve that merge conflict... Will fix.

@MoOx
Copy link
Owner

MoOx commented Feb 1, 2018

(I think it's probably time for 1.0 ;) )

@BehindTheMath
Copy link
Collaborator Author

@robinnorth What do you think about that last commit (2ec4c14)?

@BehindTheMath
Copy link
Collaborator Author

BehindTheMath commented Feb 1, 2018

It looks like after this PR is merged, all issues milestoned for 0.2.5 will be closed.

Is there anything else that needs to be done before working on releasing 0.2.5?

@robinnorth
Copy link
Collaborator

@robinnorth What do you think about that last commit (2ec4c14)?

The library was obviously modularised with testability in mind, but these modules have never had corresponding tests, so it's probably OK to inline them like this.

Is there anything else that needs to be done before working on releasing 0.2.5?

Only a version bump and any changes to package.json (I added you and I as contributors, hope that's OK) and then we're good to go! Do you have npm publish access?

@BehindTheMath
Copy link
Collaborator Author

I added you and I as contributors, hope that's OK

@MoOx Should we add everyone who contributed (https://github.com/MoOx/pjax/graphs/contributors)?

Do you have npm publish access

I do not. I'll update the changelog and version number, and then @MoOx can publish it.

@BehindTheMath
Copy link
Collaborator Author

The library was obviously modularised with testability in mind

With that in mind, should we move out loadUrl(), loadContent(), and afterAllSwitches() to separate files?

@robinnorth
Copy link
Collaborator

With that in mind, should we move out loadUrl(), loadContent(), and afterAllSwitches() to separate files?

It would be great to modularise and be able to independently test these methods, as they're basically the core of the whole library, but it's probably going to be a bit of an undertaking to do so right now. I think we should get this next release out and then add this as an aim for the next major milestone (and close #21 in the process).

@BehindTheMath
Copy link
Collaborator Author

Sounds good.

So we're just waiting on @MoOx for an answer about other contributors, and then we can merge this. I have a branch with the updated changelog and the version bump that I'll rebase and push once this is merged.

@MoOx
Copy link
Owner

MoOx commented Feb 2, 2018

Do whatever you feel appropriate.
I can give you npm access if you want or I can release it too. Just tell me what you prefer.

To make changelog easier I would recommend you in the future to only use "Squash and merge" option when merging PR. That helps to have a clean git history with kind of "one pr = one feature or a bugfix" history, which is easy to review and create release notes from.

@BehindTheMath
Copy link
Collaborator Author

I can give you npm access if you want or I can release it too. Just tell me what you prefer.

If you can give me access, we won't have to bother you in the future. I'll DM you on Twitter.

To make changelog easier I would recommend you in the future to only use "Squash and merge" option when merging PR. That helps to have a clean git history with kind of "one pr = one feature or a bugfix" history, which is easy to review and create release notes from.

I wasn't sure which to use, since it looks like in the past sometimes merge commits were used instead of squashing. Also, using merge commits doesn't require as much rebasing. But we can start squashing.

@MoOx
Copy link
Owner

MoOx commented Feb 2, 2018

You have been added to npm ;)

For the merging, it's a recommendation. At the time I made this lib, not sure it was a thing :D

@BehindTheMath
Copy link
Collaborator Author

You have been added to npm ;)

Great, thanks.

Do whatever you feel appropriate.

@robinnorth What do you think? Should we add anyone else?

@robinnorth
Copy link
Collaborator

@BehindTheMath it's up to you -- we could add/ask to add anyone who has ever made a contribution via a PR and add a note encouraging future contributors to add themselves to the list when making a PR, or we could just list contributors who have made a significant contribution (i.e. multiple PRs)/have commit access to the repo, or leave it as is. My personal inclination is that one PR doesn't really qualify for 'contributor' status, but you were here before me, so I'll defer to you on this 😄

@BehindTheMath
Copy link
Collaborator Author

BehindTheMath commented Feb 2, 2018

I don't want to slight anyone by leaving them out, but at the same time I think it will get unwieldy if there's a huge list of everyone who submitted commits.

I'm going to leave it as it is, and if anyone wants, they can add themselves in.

@BehindTheMath BehindTheMath merged commit a72880d into master Feb 2, 2018
@BehindTheMath BehindTheMath deleted the cleanup/misc-cleanup branch February 2, 2018 14:52
@robinnorth
Copy link
Collaborator

I think that's a sensible approach 👍

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

Successfully merging this pull request may close these issues.

3 participants