rotundasoftware / cartero

Modular front end development for multi-page web applications.
MIT License
204 stars 25 forks source link

Support depreciated component.json alongside bower.json #5

Closed colinwren closed 11 years ago

colinwren commented 11 years ago

Right now Cartero only supports the bower.json file name for bower bundles. component.json was depreciated 3 moths ago in favor of bower.json but there are many bower packages that still use it and so it would be nice (and probably very easy) to support it.

I ran into this while trying to use Underscore.string which still has a component.json.

dgbeck commented 11 years ago

Hi Colin,

Is the format for the old Bower component.json file the same as the format that Component uses? Could we potentially support both formats in one swoop, or are they different?

colinwren commented 11 years ago

They are a little different, being able to support both would depend on what properties Cartero uses. The name and version properties are the same but dependencies is a little different:

Component

To resolve to Component dependencies you would have to replace the / with a - to find the correct bundle.

  "dependencies": {
    "component/tip": "0.2.1",
    "component/jquery": "*",
    "component/inherit": "0.0.2"
  }
└── components
    ├── component-inherit
    ├── component-jquery
    └── component-tip

Bower

  "dependencies": {
    "jquery": "~1.9.1",
    "handlebars": "1.0.0-rc.4"
  }
├── bower_components
│   ├── ember
│   ├── handlebars
│   └── jquery

It would be possible to detect wether the component.json was for Bower or for Component based on some of the properties, for example, compontent.json files for Component always have a repo property. Once you knew if the component.json was for Bower or Component you could resolve dependencies accordingly.

dgbeck commented 11 years ago

Going to hold off on this until we get some more requests for this functionality.