Skip to content
This repository was archived by the owner on Jul 2, 2018. It is now read-only.
This repository was archived by the owner on Jul 2, 2018. It is now read-only.

Update import-collection to work on non-bower and non-flat directories. #97

Closed

Description

@sorohan

Currently import-collection only works on a folder that contains a bower.json with the bower_components installed.

It should be able to look at any directory, find all the model.xml files in the directory (recursively), and zip/import each directory that contains a model.xml file.

The goal is to support a file structure like:

statics
    bower.json
    target/bower_components/... <-- dependencies
    src/... <-- project files (widgets/containers/etc - could be nested directory)

And run "bb import-collection -t statics" to import both bower_components, and the src files.

The tricky part, and the reason it currently relies on bower, is that the components need to be imported in the correct order. It's currently using the bower dependency tree (bower list), flattening the dependency tree, and ordering the imports based on that.

So it still needs a way to order the dependencies, but it shouldn't be reliant on bower. Maybe it could order the imports the same way yapi does - although I would like if it could still generate a dependency tree for the ordering.

We also want to be able to generate a distribution zip which contains both bower_components and the src files, and be able to use bb-cli to import that.

Activity

  1. craigwalkeruk commented on Nov 2, 2015

    @craigwalkeruk

    Yapi would import on XML and not packages. It's ordering was based not on dependencies but by sorting context, extendedItemName and parentItem. Importing Items should be far simpler; import all features first, then Templates, then the rest (Widgets, Containers, Master pages).

    Assuming that we don't import item packages to portal catalogs yet.

    Or am I missing something?

  2. assigned and unassigned on Nov 2, 2015
  3. igord commented on Nov 3, 2015

    @igord
    Contributor

    @sorohan , import-item has a new feature since 0.2.1 and it can import and watch whole directory of items, check help. It doesn't rely on bower to sort anything, it just imports child directories one by one.
    Once you use import-collection, continue using import-item with collection option and it should be good.

    @craigwalkeruk when importing package, model.xml will be imported first, so it is same as with yapi. It will fail if extendedItem and parentItem are not installed already. Instead of parsing model.xml, we declare dependencies in bower.json (so we have semver of items also). Once bower resolves versions, we take a resolved list and do topological sort (I found this library that does fine job, but in import-collection we are using Ben's implementation)

  4. sorohan commented on Nov 3, 2015

    @sorohan
    ContributorAuthor

    @igord that's not the point. You can't use import-item with the collection option to import an entire collection, and you can't use import-collection on the statics the way we want to structure them now. Not everything should be a bower_component, only the outside dependencies (like launchpad). The bower_components should be separate from the project source files, but all imported together.

    We also need to zip up a directory of components (maybe the statics dir, or maybe the itemRoot/statics, i'm not sure) and have a CI server handle importing them.

    @craigwalkeruk we discussed using such a simple approach for ordering the imports, but it fails for things like containers that depend on other containers. We decided ordering based on the declared dependencies made the most sense. But I think now a simpler approach like you suggest will be more flexible.

  5. sorohan commented on Nov 4, 2015

    @sorohan
    ContributorAuthor

    @craigwalkeruk @igord I remember now why we're depending on bower. It's so we can automatically import 3rd party libraries as CXP features (angular, etc).

  6. igord commented on Dec 30, 2015

    @igord
    Contributor

    bb import-item -Wli
    is watching collection and importing all items on init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions