Skip to content

Instantly share code, notes, and snippets.

@dtolb
Last active June 28, 2016 19:05
Show Gist options
  • Select an option

  • Save dtolb/233ce88a2a6ea3e3cb89eaf3e99ee373 to your computer and use it in GitHub Desktop.

Select an option

Save dtolb/233ce88a2a6ea3e3cb89eaf3e99ee373 to your computer and use it in GitHub Desktop.
Node SDK Updates

Feedback for node sdk v2.x

Node v2.x was started a while ago, since then we may want to update some design patterns

Linter

Suggest moving from Jshint & jscs to pure eslint the local webteam has been using pure xo

Estimated time to migration: 3 hours

Test suite

Currently running Should JS The local webteam suggested moving to Ava. Ava runs tests 100% asynchronously so forces tests to be atomic which in turn forces better test practices.

Estimated time to migration: 8 hours

ES6

Suggest moving to Classes (Read more here)

Moving to let and const More here

Estimated time to migration: 8 horus

Using native promises and ditching callback support

Instead of using bluebird promises us native and drop support for callback style

Estimated time to migration: 8 hours

Switch out request for popsicle

Use the popsicle library instead of request for making the API requests. Popsicle returns promises by default so it will better line up with our modern stack and no longer require a bluebird promise wrapper around request. It is also currently being used by the local webteam in other projects. popsicle

Esimated time to migration: 1 hours

Switch API requests to async functions

Use the async/await syntax in the catapult client instead of the current callback structure. An async function returns a promise by default, so you can still consume it similarly as if it just returned a promise manually. It also allows us to write cleaner code that is easier to read/edit/understand. Async/Await ES7

Esimated time to migration: 2 hours

@illiriks
Copy link

Test suite: Atomic tests can be written in Should/Mocha. We can move to Ava, but the amount of effort necessary to migrate could simply be expended on ensuring use of best practices within Should/Mocha. Ava will require a switch from istanbul to nyc, which may require sourcemaps. We'd also have to reconfigure other scripts.
Dropping callback support: It makes it a lot harder for people who want to use our code with callback-style code to do that. I like the current solution of providing everything. Bluebird promises are compatible with native ones in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment