Best way to upgrade Aurelia-Cli apps

What is the best way to keep an Aurelia-CLI application up to date? It would be nice if there was a CLI option that would update (at least all Aurelia modules) so that we can keep up-to-date on Aurelia Projects

2 Likes

My personal procedure is to create a new project using au new then use kdiff to compare the aurelia_project/tasks folders of the new project with my existing one.

I have a custom task which I added to build.ts so I can’t just copy new project files over the top. If it were possible to have these custom tasks outside of the tasks folder and somehow loaded through the configuration that would be handy (and would allow a copy/paste from a new project when cli updates).

2 Likes

I run a grep to get all aurelia specific dependencies used in my code.

grep -rhoP "import.*\Kaurelia-[^']+" src | sort | uniq

From this I created a npm script to install dependencies with @latest

Here tthe relevant part of my package.json

{
    "name": "some-frontend",
    "description": "An Aurelia client application.",
    "version": "0.1.0",
    "repository": {
      "type": "git",
      "url": "https://github.bus.zalan.do/goodbuy/abba-frontend"
    },
    "scripts": {
      "update-aurelia": "npm i -D aurelia-bootstrapper@latest aurelia-configuration@latest aurelia-dependency-injection@latest aurelia-dialog@latest aurelia-event-aggregator@latest aurelia-framework@latest aurelia-http-client@latest aurelia-http-client-mock@latest aurelia-i18n@latest aurelia-metadata@latest aurelia-pal-browser@latest aurelia-path@latest aurelia-polyfills@latest aurelia-router@latest aurelia-templating@latest aurelia-templating-resources@latest aurelia-testing@latest"
    }
  }
2 Likes

I just wrote a task that handles updating all ‘aurelia???’ packages. No doubt it’s not full proof but simplifies writing out all the packages manually.

/*
*   This file will update all aurelia framework packages.
*   Just run from cmd "node update-aurelia.js"
*/

const package = require('../../package.json');
const npm = require('npm');
const dependencies = Object.assign(package.dependencies, package.devDependencies);
const exec = require('child_process').exec;

let aureliaPackages = '';


for (let [k, v] of Object.entries(dependencies)) {
    if (/aurelia/ig.test(k)) aureliaPackages += `${k}@latest `;
}

child = exec(`npm i ${aureliaPackages} -S`).stderr.pipe(process.stderr);

1 Like

I just updated a large project using CLI beta 13 to 15. Everything runs, but there are numerous differences in the package-lock.json from a new beta 15 app. With all the modules and dependencies, how does one keep everything up to date without au new and copying everything over. It is difficult to keep the git history correct if doing this.

Also, I used ncu to check for updates and it caught the Aurelia modules in the package.json file. What about the other Aurelia modules that are not listed in the package? How do we keep those up to date?

1 Like

I too need this answer, I always do the au new approach

1 Like

Anyone on the Aurelia team have some advice for this? Perhaps it would be possible to add a command to the CLI, like au upgrade to bring all the Aurelia modules and configuration up to the same level you would have if you created a new project with au new.

1 Like

This will be much more achievable with Aurelia 2 since it is a monorepo and we can pin a version with all relevant versions pinned as well. So we can be on Aurelia 2.0.1 and Aurelia-Router 2.0.0 but the
au upgrade 2.0.1 would be able to associate the older version of the router to the newer version of aurelia. Version synching is also much more achievable.

1 Like