Best way to upgrade Aurelia-Cli apps

#1

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

#2

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

#3

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

#4

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

#5

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

#6

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

1 Like