Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Explicity list aurelia.json dependencies in package.json

Tags: aurelia, powershell, npm, node, aurelia-cli

There is a known bug, in which npm does not install module dependencies. A workaround is to explicitly list them as top-level dependencies. Here is a script that transfers dependencies from aurelia.json into package.json.

PS> $obj = Get-Content aurelia_project/aurelia.json | ConvertFrom-JSON

PS> $obj.build.bundles | `
Select-Object -ExpandProperty dependencies | `
ForEach-Object { if($_ -is [System.String]) { $_ } else { $_.Name } } | `
ForEach-Object { npm install $_ --save }