Calypso Cannibalizer – v4

The first versions of this tool were intended as a joke, a mock to the monolythic structure that Calypso relies on (which is effective indeed). It was a simple tool that backed the opposition Calypso has received from devs used to the modular worlds from Javascript and NodeJS Package Manager system.

The original idea was to have a tool to make the monolith, a modular piece of software. It was mainly oriented to extract React components and add them to any of your given projects as a new module (not node_module, but a new file/directory in your original file structure).

These first versions grabbed any given dir or file from the Calypso source repostiory, downloaded it, and analyzed the file’s dependencies in order to be able to add those dependencies to your main package.json. But as I got to work closer with Calypso, I found more value in other libs and components that are part of the Calypso framework. High order components, utilities, etc.

This new version just downloads the module you’re extracting, and reports which imports/requires are declared in the files. It’s up to you to add them to you package.json because it was not too straightforward just to add a bunch of new dependencies to a component you may want to refactor for another project.

Link to the Gist

https://gist.github.com/oskosk/92bf5ede266a97602f4ae2e8d078159e