gcal-cli icon indicating copy to clipboard operation
gcal-cli copied to clipboard

Refactore index.js to be able to be required programmatically

Open 92bondstreet opened this issue 6 years ago • 6 comments

What?

This MR contains largely a smooth refactoring to use gcal-cli also in a programmatically way.

How?

  • add the bin entry point bin.js
  • move google apis method to api.js
  • expose client, api and core method from index.js
  • add Do directives doc for the first authorization installation
  • settle bulk promises instead of call them with Promise.all

92bondstreet avatar Sep 14 '18 13:09 92bondstreet

Thanks for the PR! It's a huge refactor so let me take a close look at it :) I think it's big enough to be released as an upgraded major version.

Btw what do you mean by dynamic way? Exposing the methods to be able to be required programmatically?

toniov avatar Sep 15 '18 14:09 toniov

I edited also the description and the MR title to be explicit about the programmatically way.

92bondstreet avatar Sep 17 '18 09:09 92bondstreet

The next step will be to upgrade dependencies and move googleapis from v21 to v33

92bondstreet avatar Sep 19 '18 14:09 92bondstreet

Regarding all refactoring and new features, we could also open the PR to a dedicated branch.

92bondstreet avatar Sep 19 '18 14:09 92bondstreet

Regarding all refactoring and new features, we could also open the PR to a dedicated branch.

Since this is quite big I think that's a good idea! We could separate it in several PRs to a dedicated branch, and at the end merge that branch with master in a final PR.

toniov avatar Sep 19 '18 15:09 toniov

I created a branch called 2.0.0.

This order could be nice, so we can isolate possible bugs:

  1. Architecture refactor (splitting files and so on, not changing code)
  2. Code refactor (e.g. changing Promise.all() with pSettle)
  3. Upgrading dependencies
  4. New functionality (e.g. enable?)

toniov avatar Sep 20 '18 01:09 toniov