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

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).


#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"
    }
  }

#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);