[SOLVED] How to add to project @aurelia-ux/datepicker 0.11.1?

First of all, thanks for great aurelia ux, I use the latest available version.

My aurelia.json (Aurelia CLI, SystemJS, Sass) was updated several times with sections like this:

     {
        "name": "@aurelia-ux/button",
        "main": "index",
        "path": "../node_modules/@aurelia-ux/button/dist/amd",
        "resources": [
          "**/*.{css,html}"
        ]
      }

Furthermore, the nested dependencies for every ux component were added. It was a necessary step because of dependency errors in browser console. Looks like messy workaround but it works, correct me if I do it wrong:

      {
        "name": "@aurelia-ux/button/ux-button",
        "path": "../node_modules/@aurelia-ux/button/dist/amd",
        "main": "ux-button"
      } 

The datepicker component is more complicated, its nested (sub)dependecies
@aurelia-ux/datepicker/ux-calendar/resources/datetime-utility,
@aurelia-ux/datepicker/ux-datepicker/resources/datetime-utility and some others are actually aliases with the same path.

Aurelia CLI traces first entry in aurelia.json and ignores others. So datepicker resources cannot be injected.

Any idea how to fix it?

Use unreleased (but going to be) auto-tracing cli

  1. update your package.json to use the branch: "aurelia-cli": "huochunpeng/cli#at23",
  2. remove datepicker config from your aurelia.json.
  3. just load the plugin in main.js aurelia.use.plugin('@aurelia-ux/datepicker');

It just works.

  1. optional but recommended. Read the test guide in the PR, trim off your dependencies (including ux button) in aurelia.json, you will rarely need to touch them again.
2 Likes

Thank you, @huochunpeng, I’ll try
PS Yes, now it works