Including libraries, both standard and 3rd party

I'm following http://enyojs.com/docs/latest/developer-guide/getting-started/conversion-to-2.7.html to convert an app to 2.7, and have also read http://enyojs.com/docs/latest/developer-guide/getting-started/creating-and-building-an-app.html and http://enyojs.com/docs/latest/developer-guide/getting-started/first-steps.html

Having deleted the old copies of libraries such as onyx, layout, enyo-webos, and enyo-animated, and run the command

enyo init --template=onyx-app
how do I re-install libraries?

I see in .enyoconfig there's a member called libraries

Comments

  • Running enyo init should have cloned the repos into the lib directory. I'm assuming you didn't see any errors when running it. If you run that command in an empty directory, does it set it up correctly?
  • edited May 2016
    Yes, add the additional libraries to the .enyoconfig "libraries":, "sources": and "targets": and then run enyo init again inside the project root. Since you should have already gotten onyx and layout from the init you ran above, you just need to add enyo-webos and enyo-animated. This seems to work:
    
      "libraries": [
        "enyo",
        "onyx",
        "layout",
        "enyo-ilib",
        "enyo-webos",
        "enyo-animated"
      ],
      "sources": {
        "enyo": "https://github.com/enyojs/enyo.git",
        "onyx": "https://github.com/enyojs/onyx.git",
        "layout": "https://github.com/enyojs/layout.git",
        "enyo-ilib": "https://github.com/enyojs/enyo-ilib.git",
        "enyo-webos": "https://github.com/enyojs/enyo-webos.git",
        "enyo-animated": "https://github.com/DougReeder/enyo-animated.git"
      },
      "targets": {
        "enyo": "2.7.0",
        "onyx": "2.7.0",
        "layout": "2.7.0",
        "enyo-ilib": "2.7.0",
        "enyo-webos": "master",
        "enyo-animated": "master"
      }, 
    You could also make a template if you want to re-use it. I made one with the enyo-webos and enyo-luneos libraries added and some other little tweaks here: https://github.com/bbito/onyx-webos-app
  • Thanks, @bbito! I misunderstood the question. Once you've updated the config, you can rerun enyo init and it will clone any new libraries into lib.
  • Thanks, that did it!

    It would be helpful to include this info in http://enyojs.com/docs/latest/developer-guide/getting-started/creating-and-building-an-app.html and whether calling enyo-init with a template updates .enyoconfig
  • @reeder29 - For the record, I tried running enyo init -t onyx-webos-app in the test project I created to test the .enyoconfig I showed above including your enyo-animated library. It looks to me like the -t (template) option is ignored if there is an existing .enyoconfig file in the project. The .enyoconfig file was not modified and the enyo-luneos library that exists in the template I called was not cloned into the project, nor was your enyo-animated library, which does not exist in the template I specified removed.
  • That behavior does not sound unreasonable, but enyo init ought to be clearer about what it is and isn't doing.

    [I should note that enyo-animated hasn't actually yet been converted to 2.7 yet.]
  • I was inspired to try to improve the enyo-dev README.md, but the behavior is a little quirky. The section on enyo init's -t, --template option is correct in stating "The name of the template a new project should be initialized from" because it is intended to be used with new projects. It can be used with an existing project if you hide or delete .enyoconfig and package.json, but it is quirky in that the 1st time I run enyo init -t onyx-webos-app it will fail with WARN enyo-dev/init: Failed to initialize the template and at this point it has copied the new .enyoconfig and package.json into the project from the template, but has not cloned any libraries into lib. When run a second time it will complete without error and clone any missing libraries. So if you want to run a template on an existing project it is possible, but a little quirky...
    @reeder29 I did see that enyo-animated wasn't 2.7 style, but when I tested, the repo was successfully cloned into lib regardless.
  • Did you ever finish up a PR for the README.md in enyo-dev?
  • Hi @RoySutton I took a look, but ended up thinking that addressing edge cases like applying a template to an existing project would do more harm than good. I think the only improvement I could think of would be some more about the intended behavior/use of some parts of dev (e.g. libraries), but I would rely on the team for that type of information.
  • Great, thanks! There are certainly some features of enyo-dev that could be documented better.
Sign In or Register to comment.