3rd party libs with enyo-dev

Hi,

I'm trying to wrap my head around the new enyo-dev structure.
My application uses moment.js and with 2.5 I used bower to get moment.js included in my application.
Since there was no 'official' build platform for enyo I used the grunt/bower combo.

How would that work with the new enyo-dev ?

( a help page on this subject would be great as well )

Bart

Comments

  • edited March 2016
    Agree that some further documentation is needed for enyo-dev. This is a good topic to cover!

    In this case, I'd recommend using either headScripts or tailScripts in your .enyoconfig file to instruct enyo-dev to include the lib without bundling it. Both options can be specified on the command line too (--head-scripts and --tail-scripts, respectively).
      "headScripts": [
        "bower_components/moment/min/moment.min.js"
      ],
    
  • well actually I want enyo-dev to bundle it, I want it to download the bower repo and install it in lib/bower

    The current .enyoconfig libraries + sources + targets construction seems to limit me to git repos ?

    I ended up with:
       "libraries": [
    "enyo",
    "layout",
    "moment"
    ],
    "sources": {
    "enyo": "https://github.com/enyojs/enyo.git",
    "layout": "https://github.com/enyojs/layout.git",
    "moment":"https://github.com/moment/moment.git"
    },
    Which works for moment.js , but not all libraries have released versions in their git repo ( e.g. openlayers )

    another solution might be to have 'init hooks' where I can write a command to execute on 'enyo init' which allows me to run bower install ??
  • There aren't any plans right now to add non-git sources to enyo init. It was designed to support the initialization of enyo and its libs and not arbitrary sources. It can work with other package management systems like bower or npm but isn't a replacement for them. enyo pack will discover any library installed in libDir (./lib by default) or ./node_modules regardless of how it got there (via npm, bower, or enyo init).

    That said, this is good feedback for us. We have quite a bit of experience with how the tools are used internally but it helps to see how others expect them to behave.
  • Thanks for the feedback, I understand that you are not going to adopt x amount of dependency managers, but putting the statement below into the docs would help tremendously.
    enyo pack will discover any library installed in libDir (./lib by default) or ./node_modules regardless of how it got there (via npm, bower, or enyo init).
    I think the way forward is to wrap enyo init a grunt script which does the rest.
  • In the meantime I gained a bit more experience, I was wondering what the intended usage of the 'library' project would be.
    creating my own kinds as a library ?
  • Potentially. We have internal use cases but it's also useful for testing out the library via tools like jsFiddle. If you had a shared library that you didn't want to bundle in apps either for maintenance or caching purposes, a library build might be a good choice.
  • edited June 2
    hey guys, i found out while fiddling in 2.7 with one of my project. I managed to incorporate moment.min.js downloaded from the site. What i did

    1. create the folder thirdparty and place the moment.min.js inside.
    2. copy the thirdparty folder and place it inside the lib folder. the ones with enyo folder.
    3. just pack the whole project again. "enyo pack" via terminal.
    4. required the exact js file inside the page enyo i wanted. see code below.
    5. i noticed later on, a new file is called thirdparty.js a moment.js converted into some common js structure.
    var MomentJS = require('thirdparty/moment.min.js');
Sign In or Register to comment.