Updating Ionic2 Alpha

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.

If you wanted to develop against the 2.0 branch of ionic, you could clone the repo locally and use npm link to symlink it, but I don’t recommend it as it is not stable. See these notes for more information: https://github.com/driftyco/ionic/tree/2.0/scripts#developing-against-ionic-locally

Sorry if any of this is confusing, we’re still working through it. :slight_smile:

3 Likes

Awesome. Thank you for the reply. I’ve been really enjoying working with ionic 2.

2 Likes

Glad to hear that! :slight_smile: If you run into any issues or have any feedback, please open an issue on our github: https://github.com/driftyco/ionic/issues

How can we know the last version of the alpha ?

The latest version of 2.0 can be found on npm here: https://www.npmjs.com/package/ionic-framework

And we are working on keeping the conference app up to date with the latest version: https://github.com/driftyco/ionic-conference-app

1 Like

@brandyshea how exactly do I update my version of Ionic 2 ?

If I type

ionic info

I get:

Cordova CLI: 5.4.0
Gulp version: CLI version 3.9.0
Gulp local:
Ionic CLI Version: 2.0.0-alpha.23
Ionic App Lib Version: 2.0.0-alpha.22
ios-deploy version: 1.8.2
ios-sim version: 5.0.3
OS: Mac OS X Yosemite
Node Version: v0.12.4
Xcode version: Xcode 7.1.1 Build version 7B1005

(I’m now on El Capitan so not sure why it still says Yosemite but thats another issue I guess?)

This page says the latest version of Ionic 2 is 2.0.0-alpha.34 so I tried updating mine my typing:

npm update -g ionic@alpha

Presumably this is not correct (I’m very new to all this npm stuff) because typing ionic info still gives me:

Ionic CLI Version: 2.0.0-alpha.23
Ionic App Lib Version: 2.0.0-alpha.22

What do I have to do to make sure I’m running the latest version?

Sorry @brandyshea just seen the other notes about updating. Will try that.

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. :slight_smile:

4 Likes

Thank you - that helps a lot.

1 Like

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.

1 Like

Based on this, it would seem more logical to change/alias the “ionic” package to “ionic-cli”, and avoid all the confusions.

@brandyshea I’ve removed that link from my post now just in case it caused anyone to do the wrong thing.

1 Like

You’re a saint, thank you :smile:

You saved me from posting this question again

1 Like