How to migrate Bower dependencies to npm in a project?

I have a project that currently uses ember version 2.7 and Bower for managing dependencies, including jQuery (jquery#1.12.3 ). I would like to migrate these dependencies to npm for better package management.

{
  "name": "frontend-upgrade",
  "dependencies": {
    "ember": "~2.7.0",
    "ember-qunit-notifications": "0.1.0",
    "bootstrap": "^3.3.7",
    "spectrum": "^1.8.0",
    "moment": "^2.15.1",
    "faye-browser": "^1.1.2",
    "owl.carousel": "^2.1.6",
    "offline": "^0.7.18",
    "select2": "3.5.2",
    "bootstrap-material-datetimepicker": "./vendor/bootstrap-material-datetimepicker"
  },
  "resolutions": {
    "jquery": "1.12.3"
  }
}

I’d recommend moving one at a time. You may need to update them when you move them but for the most part they should be portable between the package managers. Make sure you change anywhere they’re being imported e.g. ember-cli-build.js/brocfile.js (i forget which you likely have at that version). The ember package is called ember-source in the npm friendly version so you want something like this in your package.json:

"ember-source": "~2.14.0",

The npm page suggests that ember-source 2.11.0 was the first version published so you may need to update to ember 2.11.0 at least before migrating that to npm. It looks like you’re already working on that though :smile:

As @dknutsen said it is probably best to upgrade first, id say 2.12.0 as i think that was considered the first official version and is an LTS release. Also it is unlikely that you need ember-qunit-notifications. moment can moved to your package.json and you can either use ember-auto-import v1 or ember-cli-moment-shim to import it like a module.

From my experience i think it also maybe be beneficial to migrate from select2 to ember-power-select. You should also be able to use a early version for ember power-select