Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing JS Build Step? #25

Open
abretaud opened this issue Dec 18, 2017 · 6 comments
Open

Missing JS Build Step? #25

abretaud opened this issue Dec 18, 2017 · 6 comments

Comments

@abretaud
Copy link
Contributor

Hi,
I followed the instructions in the README to build the javascript. The commands succeeded, but I get a 404 error in my browser on app-bundle-4faf7ffa80.js.
I have this url which returns the expected js file: http://localhost:3300/sites/all/modules/tripal_phylotree/theme/js/aurelia/scripts/vendor-bundle-9b7c49cfad.js but then it tries to download http://localhost:3300/tripal/phylotree/scripts/app-bundle-4faf7ffa80.js.
I'm wondering if the app-bundle file should be placed somewhere else after being built, or if there is something to adapt in the src?

@adf-ncgr
Copy link
Contributor

adf-ncgr commented Dec 19, 2017

Hi-
I'm not sure I'm exactly following what you're trying to do, but I think you want to load the aurelia bundle using something like what we have done in the tripal template file here:

// finally, use a regular script tag to inject the aurelia boostrapper

// finally, use a regular script tag to inject the aurelia boostrapper // it will populate the aurelia-app div, above. printf('<script src="%s/aurelia/scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>', $js_dir)

e.g. in view-source:https://legumeinfo.org/chado_phylotree/phytozome_10_2.59235205
<script src="/sites/all/modules/tripal/tripal_phylogeny/theme/js/aurelia/scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>

let me know if I misunderstood your issue; if I can't help sort it out, I can certainly find someone in our group more qualified to speak to js bundling issues than I am :)

@abretaud
Copy link
Contributor Author

My goal is just to test the installation of tripal_phylotree on a fresh instance of tripal serving on http://localhost:3300/tripal/ (deployed with https://github.com/erasche/docker-tripal, but it shouldn't matter).

My specific problem was that, just as on legumeinfo.org, I have this tag properly generated in tripal_phylotree_base.tpl.php:

<script src="/sites/all/modules/tripal/tripal_phylogeny/theme/js/aurelia/scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>

However, this vendor-bundle.js file loads the app-bundle with the relative url ../scripts/app-bundle.js. As it is relative to the html page at http://localhost:3300/tripal/phylotree/Test1 => the url generated is http://localhost:3300/tripal/scripts/app-bundle.js which is invalid and gives a 404 error.

I've tried to play with the bundling config in aurelia, but couldn't find a way to replace ../scripts/app-bundle.js by a proper value. I ended up adding an alias in my apache configuration:

Alias "/tripal/phylotree/scripts/" "/var/www/html/sites/all/modules/tripal_phylotree/theme/js/aurelia/scripts/"

I feel like you're doing something similar for legumeinfo.org.

I see 2 ways to close this issue:

  1. document the change I made to apache config in https://github.com/legumeinfo/tripal_phylotree#javascript-build-steps
  2. change the way aurelia bundles the app to use correct urls

I can make a PR for 1), but 2) looks too complicated for me :)

@adf-ncgr
Copy link
Contributor

OK, I think I understand better now; if you look at

// route for static scripts/ content; this is the aurelia-cli build folder.

you will see where a route is being defined for URL chado_phylotree/scripts/ -> phylotree_static_scripts
which is described as:
/**

  • phylotree_static_scripts
  • workaround for drupal having terrible support for serving up static content.
  • js/aurelia/scripts is the build folder for au build script.
  • @param string filename
  • @InGroup tripal_phylotree
    */

Maybe there are better ways of doing this in drupal- I vaguely remember when suggested this slurp-the-file-and-spit-it-back-hack to the primary developer of this module (who has since left the group). In any case, I'm guessing the issue with your setup is that your URL structure is a bit different (looks like we are expecting chado_phylotree for most of our endpoints so you may run into other issues downstream too?- maybe there is a more flexible way we should be supporting how people choose to deploy this, let me know if you have thoughts).

@abretaud
Copy link
Contributor Author

Ah ok, now I understand what's happening: I loaded my test tree using the tripal loader which defines this unexpected url for the loaded tree https://github.com/tripal/tripal/blob/7.x-2.x/tripal_phylogeny/includes/tripal_phylogeny.chado_node.inc#L499

I'll make more tests loading data with your perl scripts.
Anyway, using the tripal loader causes other problems as you can't enable both tripal_phylogeny and tripal_phylotree at the same time on a tripal instance (some functions have the same name in both).

@adf-ncgr
Copy link
Contributor

thanks for the update on this. You aren't planning to attend PAG this year, by any chance? If so, we might see if we could find a time to sit down with someone from the tripal core development group and talk about a path forward that would at least minimize the confusion, if not actually try to get the independent development efforts re-synced with each other. If not, we'll find another opportunity for that...

@abretaud
Copy link
Contributor Author

No, sorry I won't go to PAG this year. I might be able to go to GCC/BOSC in june, maybe there will be a gmod meeting as they did for gcc2016?

For the time being, I'll just use the perl scripts, but on the long term you're right it would be good to sync with tripal developments. I'm not sure what's been ported from tripal2 to tripal3, I can have a look at it too as using tripal3 is also in my plans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants