feedhenry-templates / fh-api-mapper

API Mapping Tool
Apache License 2.0
8 stars 12 forks source link

Bower components aren't installed in FeedHenry #23

Open cianclarke opened 9 years ago

cianclarke commented 9 years ago

@lfryc You had more experience with Bower than I, maybe you can look at this? Because apps in Dynofarm start with node application.js, we can't specify a start script of grunt start, and it seems can't do any work on start. The same issue happens with our LESS stylesheets, but worked around that by including LESS middleware.

Some ideas: 1) Try an NPM postinstall script which uses node_modules/.bin/grunt (because there's no global Grunt in dynofarm). - I couldn't get this to work, and it also meant moving all of the grunt stuff from being a devDependency to a regular dependency, which kinda sucks. 2) Move to using NPM for client side package management (TIL: this is preferable anyway) 3) Just check back in bower_components for now...

Right now, this is a show stopper for phase 1.

lfryc commented 9 years ago

I've dived into this a bit and it seems that there is no perfect solution to this problem:

1) it may work but does not seem viable

2) with client-side deps in node_modules/ we will have to copy them to public/lib to avoid exposing them all

3) this is actually what I counted with first - check in all public/lib deps, which is subset of what is required downloaded to bower_components, it is most straightforward solution at this point

lfryc commented 9 years ago

Other options are:

4) usemin + useminPrepare (requires grunt compilation step) https://github.com/yeoman/grunt-usemin#the-useminprepare-task

5) Use of NPM deps + browserify (only for JS)

6) Webpack (requires checking in compiled dependencies)

lfryc commented 9 years ago

So only solution which doesn't require compilation step is (3), which is I'm in favor of as of now.

cianclarke commented 9 years ago

+1 for 3) for now, and we can revisit. @jasonmadigan , any suggestions for a better solution for us here? tl;dr - using bower, but cannot do "grunt bower" in RHMAP because node application.js. Would like to move away from Bower based on what I learned in previous thread

jasonmadigan commented 9 years ago

3) is what we've ended up doing for templates before

A post-install hook might work too

NPM (+Browserify) seems to be the way the winds are blowing, so I'd say that might be the best option?