I’d like to frequently update the library of an Ionic 2 alpha project. Can anyone recommend an easy way to keep a project in sync with the latest Ionic 2 alpha version via command line?
For instance, would using ionic lib update work or should I just edit “ionic-framework” in package.json ?
Running ionic lib returns “undefined” for “Local Ionic Version”, and the “Latest Ionic Version” is set to 1.1.0, so I’m a little nervous to update the library via command line.
We’re moving away from bower in v2. Running ionic lib update is running bower update ionic under the hood, so this won’t work with v2.
I would recommend (for now) updating the package.json file to the alpha version you’d like, the latest is currently 2.0.0-alpha.31, and then running npm install. You may want to remove the ionic-framework folder from node_modules prior to doing this, as it can fix some issues.
Note: we found some performance issues with alpha 31 and we are working through them, so it may be better to stay on alpha.30 or below until we get a more stable release out.
There were also some changes to paths in alpha 31, so if you choose to update to alpha.31 you may want to look at the conference app to see what to update in the webpack.config.
Just to clear some things up. The package called ionic on npm is for the Command Line Interface (CLI). So when you run npm install -g ionic@alpha you are updating the CLI which allows you to type commands such as ionic serve and ionic info.
The package called ionic-framework is what holds the source code for Ionic 2 and allows you to use Ionic components in your app. That can be found here: https://www.npmjs.com/package/ionic-framework
Normally when you want to add a package to a project you would install it with a --save flag and it would add itself to the package.json file. We have already added it though to the starters and conference app, so when you download the conference app and run npm install you are installing the ionic-framework package into node_modules in order to be used. The starter app runs npm install for you when you start a new project.
So for right now since the version of ionic-framework is already listed in package.json you can update it manually in that file to update to a specific version and then run npm install inside the project directory. You can also run npm install ionic-framework --save to update to the latest version. I imagine we will add a command to do this for you in the future but it hasn’t been discussed yet.
This is something we plan on going over in the docs in detail, but we haven’t yet. Let me know if anything I said was confusing.
Also, make sure you run ionic info inside of the project in order to see the Ionic version:
Your system information:
Cordova CLI: 5.3.3
Gulp version: CLI version 3.9.0
Gulp local: Ionic Version: 2.0.0-alpha.34
Ionic CLI Version: 2.0.0-alpha.23
Ionic App Lib Version: 2.0.0-alpha.22
ios-deploy version: Not installed
ios-sim version: 5.0.3
OS: Mac OS X Yosemite
Node Version: v0.12.4
Xcode version: Xcode 6.4 Build version 6E35b
And I just looked at the link you posted @richardshergold - those are instructions for using the master branch of Ionic 2 to develop your app, which I do not recommend since it is not stable.