Coding Week 9&10: GSoC’ 22 with SCoRe Lab

Pranjal Walia
Leopards Lab
Published in
3 min readSep 4, 2022

In this post, I’ll be talking about how the consequent weeks of coding went. You can read my previous post about weeks 7&8 here as well.

This time we’re gonna be talking a bit about SDK management as it was my primary focus after implementing the code generation module, something about which I’ve been talking for a while but this time let’s get to it.

Let’s get started by understanding modules in node.

Modules in JavaScript

Consider modules to be the same as JavaScript libraries i.e. a set of functions you want to include in your application. In modern software development, modules organize software code into self-contained chunks that together make up a larger, more complex application. Node comes packaged with a host of native modules such as path, http etc.

JavaScript modules are typically of two types, commonjs and ES modules. The ES module format is the official standard format to package JavaScript code for reuse and most modern web browsers natively support the modules. Node.js, however, supports the CommonJS module format by default. CommonJS modules load using require(), and variables and functions export from a CommonJS module with module.exports.

JavaScript Module Ecosystem

The ES module format was introduced in Node.js v8.5.0 as the JavaScript module system was standardized. Being an experimental module, the --experimental-modules flag was required to successfully run an ES module in a Node.js environment. The need for ES modules to be adopted by node arose from all the security implications of the require statement.

SDK Packaging with multiple modules

All services are implemented as separate modules and exposed via a factory class typically in a JavaScript based SDK.

As for the SDK I have built for AliCloud, I’ve used TypeScript to build the module and post compilation modules are stored in dist folder.

diststands for distribution, Mainly mode modules have srcand distfolder. srccomprising of the sources code and distcontaining the distributive code, which is published and usable by other packages. On publishing to npm, it makes sense only to package the dist folder into the tarball and avoid src for possible security implications.

GSoC was a all about learning and during the course of these few weeks, I learnt how to make SDK and a lot more about working with classes in JavaScript (even if they’re not a natively supported feature). It was really an amazing learning experience to work on an SDK.

Epilogue 🔚

Over the course of this week, I was experimenting with JavaScript modules and classes. Additionally, I was verifying successful publications of the SDK as an NPM module. Now all the services are completed, packaged within the SDK and the SDK has been tested. I’ll be working on improving the documentation of my work over the final week.

Well, this is the end of the line for now, till next time! Follow me on my socials in case of any questions, tips, and guidance pertaining to GSoC or anything in general.

Connect with me: Linkedin, Github, Twitter 😀

--

--