Updating Ember.js with moment.js, lost bower and now? - ember.js

We have been using moment for the past few year in our software via ember-moment. After some time with production version frozen we are now updating. First step was to move up to 2.16 when we got the perception that we should not use shim any more, and so we don't know how to do regarding the moment dependency.
The goal is to update until most recent versions 3.x

just use ember-moment. ember-moment switched to using npm a while ago.
Actually ember-moment uses ember-cli-moment-shim which does all you need.
You can just remove ember-moment, moment and ember-cli-moment-shim from your bower.json and package.json and then do ember install ember-moment and it will install all of it to your package.json.

Related

Updating Loopback 4

I am using Loopback 4 to create a REST-ful API. I'm a mobile developer by trade so typescript et al is all pretty new to me, so please be kind ;)
I created the app using CLI v1.21.4, and saw a message to say that an update is available. I therefore updated my global installation of the CLI. But then when I try and run one of the commands such as lb4 model I see the message:
The project was originally generated by #loopback/cli#1.21.4.
The following dependencies are incompatible with #loopback/cli#1.23.1:
typescript: ~3.5.3 (cli ~3.6.3)
#loopback/authentication: ^2.2.2 (cli ^3.1.1)
I would of course like to take advantage of these newer modules, but I am unsure how to update my app scaffolding and dependencies. Could anyone offer some advice please?
Please check out https://github.com/strongloop/loopback-next/issues/3608:
During lb4 app, we add the cli version to .yo.rc.json, such as:
{
"#loopback/cli": {
"version": "1.21.4"
}
}
lb4 -v lists compatible modules that are released with the cli.
lb4 commands check if the project has incompatible versions with the current cli and prompts users to force or exit.
I would of course like to take advantage of these newer modules, but I am unsure how to update my app scaffolding and dependencies.
The process for updating dependencies is not specific to LoopBack. If you are using npm, then simply run npm update.
Please note that TypeScript often introduces backwards-incompatible changes in semver-minor releases, 3.6 brought few of them. Be prepared to manually fix few compilation errors after the upgrade.
I think that npm update is not going to jump from v2 to v3 for #loopback/authentication, you have to request that upgrade explicitly:
$ npm install #loopback/authentication#latest
There is now a supported update procedure, which is documented here:
https://loopback.io/doc/en/lb4/Update-generator.html
It seems to be simply:
# Ensure you have the latest version of the CLI tool
npm install -g #loopback/cli
# Then ask the tool to check which packages should be upgraded
lb4 update

Should I upgrade from LTS to another LTS ember version?

I've been trying to upgrade my ember app from 2.18 to 3.4.4 and I just want to know if I chose the correct ember version which is 3.4.4? Any response is much appreciated. Also what are the disadvantages or issues I may face if I jump from 2.18 to 3.8.1?
My personal recommendation is to upgrade from one LTS to the next LTS version. There's a great video from Ember Map that discusses a great strategy for upgrading your ember apps which I will summarize here in case the link ever goes stale.
Upgrade all forwards-compatible packages
Upgrade 3rd-party dependencies and addons, one at a time
Upgrade Ember CLI and friends using ember-cli-update
And in my opinion, use ember-cli-update --to next-lts-version-here. Once you upgrade to the LTS, fix deprecations and tests until all green, and then continue. I used this process to go from 2.16 -> 3.8 over the weekend
The latest long term support is 3.8. here is release cycle. You can jump to 3.8 if suits you.
There is a addon named ember-cli-update. It applies changes automatically. Also you can checkout the ember-blog to learn changes.

EmberJS: How to update Ember CLI based apps

Angular has https://update.angular.io/ that guides with the proper way to update (along with dependencies et al.). Likewise, is there a way to know how to update an Ember app properly?
Obviously, changing the version of the ember package in bower.json and doing an bower install && npm install doesn't seem to be the ideal way.
Detailed update information are included in release notes provided for ember-cli on GitHub: https://github.com/ember-cli/ember-cli/releases/
For projects that aren't using a very old version, the workflow is mostly this one:
Update globally installed ember-cli to latest stable release
Update globally installed ember-cli-update to latest stable release
Clean up your project by deleting tmp, dist and node_modules folders.
Run ember-cli-update to update project to match current blueprint.
Run ember-cli-update --run-codemods to update project to match current best practices.
Before ember-cli-update has become the official tool for updating projects, running ember init again after updating projects ember-cli dependency manually was the officially recommended workflow. ember-cli#3.2.0 was the last release for which this workflow was recommended. But ember-cli-update should support all versions for which a tag exists in ember-new-output repo, which should be true for all stable releases of ember-cli.
You could of course update your dependencies individually and not follow the recommended configuration provided by ember-cli. But be aware that uncommon combination may not work as stable as you are used to.
If your app still uses Ember App Kit, which has been deprecated in 2014, you could find a migration guide in their readme. But you should consider carefully if rewriting wouldn't be quicker than updating such an outdated app.
You can find a complete step-by-step guide for upgrading an ember here,
https://cli.emberjs.com/release/basic-use/upgrading/

How to create a ember version specific project?

When i use,
ember new projname
project is getting created with 2.7.0 ember version. I want to create a older version ember project. What i should use? [i checked options that can be used with new command, but none helps for this.]
Here's what I ended up doing:
create a new directory for my project and cd inside of it
npm init (enter through some bogus details, doesn't matter, we're going to erase soon)
npm install --save-dev ember-cli#desired.version
delete package.json and package-lock.json
ember new app
This got me a node_modules folder with the desired version of ember, and then also allowed me to use the ember cli to generate a project. It will create a folder with the name of the app, of course, and you can safely delete the node_modules folder in the app's parent directory.
This feels like a little bit of a round-about way of doing things, but it worked, and it seemed easier than trying to mess with my global versions.
Hope this helps someone out!
Ember new will create project at the most current version installed on your system.
There are 2 ways around this.
Install an older version of ember-cli globally for the desired version. The benefit would be that you create a new app at the desired version from the get go:
(change #2.11.0 to the desired version from https://github.com/emberjs/ember.js/releases)
npm uninstall -g ember-cli
npm cache clean
npm install -g ember-cli#2.11.0
Keep the current ember-cli version and then downgrade by changing the ember value in package.json :
(this will work for small version changes, not major changes)
you will need to re init your ember app (change 2.11.0 to what you need from https://github.com/emberjs/ember.js/releases)
rm -rf node_modules dist tmp
npm install --save-dev ember-cli#2.11.0
ember init
Node.js is required with every Ember installation and you have to check which version of node is required for the desired version of Ember you want to install. Most likely itll work well with the version currently installed.
you can download the latest (LTS) from: https://nodejs.org/en/
or older versions from: https://nodejs.org/dist/
OSx for example https://nodejs.org/dist/v4.7.0/node-v4.7.0-linux-x64.tar.gz
results

How do I use ember-cli with the LTS release channel?

I would like to update an addon to the long term support release channel using ember-cli. How do I do this?
I know I can put a different version of ember and ember-data in de bower.json and package.json files. But will updates of ember-cli not interfere with these older versions?
Also what is the lts release of ember-data?
The current LTS is 2.4, so you need to open your bower.json and in the ember line, put the following:
"ember": "~2.4.0"
This should install the latest 2.4 at the time of the install.
But will updates of ember-cli not interfere with these older versions?
Ember CLI is mostly decoupled from Ember itself, so it can be used with almost any version. When ember.js is converted into an addon (like what happened with ember-data), you'll need to mind the update instructions for it, so you continue to use the bower package instead of the npm addon.
At the moment Ember Data does not have an LTS.