2
votes

when I've been adding dependencies to a project. I've been using the npm install command followed up by seeing where the build fails then adding dependencies into the aurelia.json file. Is this the expected workflow / is there a way to add the file dependencies into aurelia.json during the install?

eg. I want to install aurelia-materialize so I

npm install aurelia-materialize materialize --save 

this saves it to the project dependencies and then I run

au build

so I get some build errors starting with

{ uid: 8,
name: 'writeBundles',
branch: false,
error:
 { [Error: ENOENT: no such file or directory, open 'F:\Oct2016\au-mat-test-drive\src\materialize-css.js']
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'F:\\Oct2016\\au-mat-test-drive\\src\\materialize-css.js',
  moduleTree: [ 'main' ],
  fileName: 'F:/Oct2016/au-mat-test-drive/src/main.js' },
  duration: [ 0, 32674160 ],
  time: 1476238675900 }

and so then I add the materialize-css into the aurelia.json dependency

 {
        "name" : "materialize-css",
        "path": "../node_modules/materialize-css/dist/js",
        "main" : "materialize"
      },

then I get the same error when it cant locate / serve jquery so I npm install jquery and then add the following to the aurelia.json

      {
        "name" : "jquery",
        "path": "../node_modules/jquery/dist",
        "main" : "jquery"
      },

then it looks for a hammerjs dep, so I npm install it and then add the following into aurelia.js

      {
        "name" : "hammerjs",
        "path": "../node_modules/hammerjs",
        "main" : "hammer"
      }

its not a terrible workflow and eventually I get everything installed .. but I haven't seen anybody talking about this back and forth game for installing libs. Am I missing something?

Dev note: proper instuctions to install aurelia-materialize-bridge are here. I'm leaving the question as is because I used a similar workflow when installing a different plugin.

1
CLI is currently in alpha phase. They are planning to improve on that - you won't be required to manually edit aurelia.json file. - Miroslav Popovic
As Miroslav said, we're gonna be dealing with this. Sorry for the inconvenience while we get it up to snuff. It's a pain in the butt, I know. - Ashley Grant
okay, sounds great - monkeyhouse

1 Answers

0
votes

Per the comments, the process is as designed for now.

It may be improved as the CLI tooling matures.