Use Ionic CLI as NodeJS library

Is it possible to use Ionic CLI as a library in node?

So this would be possible:

const ionic = require('ionic');

Because I am struggling with building a package, getting the id and then downloading that package after it’s been built.

Perhaps the ionic-app-lib lets you do that. (Haven’t tried though.)