Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between 'ionic build' and 'cordova build'?

I started learning how to build mobile apps using the ionic framework.
I do see people using ionic build and others use cordova build.
I will like to know the difference between the two and when to use them.

like image 986
ammezie Avatar asked Mar 24 '16 13:03

ammezie


2 Answers

They are the same. (emphasis added)

The build command builds an app for a specific platform. Pass in either ios or android to generate platform specific code in the platforms subdirectory.

The build command is a proxy for Cordova’s build command.

Ionic | build CLI

like image 85
OneCricketeer Avatar answered Oct 15 '22 11:10

OneCricketeer


Looking at the code https://github.com/driftyco/ionic-cli/blob/master/lib/ionic/cordova.js ionic build and cordova build seems to be the same. No conditionals set for 'build' command there. Building command requires platform so it sets isPlatformCmd within the code, but it is used only with 'add' or 'remove' commands.

So the only difference for the 'build' seems to be returning success return code no matter how internally executed cordova ends.

.then(function() {
  return self.runCordova(cmdName, argv);
})
.then(function(runCode) {
  //We dont want to do anything if the cordova command failed
  if(runCode !== 0 || argv.nosave) {
    return
  }
  ...
}
like image 26
BartBiczBoży Avatar answered Oct 15 '22 11:10

BartBiczBoży