Hilary grunt#2517
Conversation
There was a problem hiding this comment.
The goal is for institutions to be able to add their own widgets next to oae-core, e.g. oae-gt. These widgets should be included in the production build as well.
|
I just tried this, and during the build I got the following error: /Users/nicolaas/Desktop/SakaiOAE/ui/newOAE/3akai-ux/target/optimized/ui/css/oae.main.css Also, when trying to run this in the browser, the UI is not loading at all. First of all, it can't find any of the above CSS files, as they should have been inlined. It also can't find the oae.bootstrap.js file, which it tries to locate at /shared/oae/api/ab72e9d3.oae.bootstrap.cachcd382602.e.caced0d91c5.he.cache.js but actually just is in /shared/oae/api/ab72e9d3.oae.bootstrap.cache.js. It looks like all of the individual api.js files are still there, which I think will cause too many requests for an initial pageload. In the old UI, all API files were merged into oae.dependencies. We should try to do something similar. |
|
all the individual api files are actually inlined into the [hash].oae.api.cache.js file, they remain in place so they can be referenced individually, but reading in oae.api won't result in additional calls. The old build left them in place as well. I'm looking into the filename mangling. |
|
I also just noticed that there is no node_modules folder in the optimized folder. |
|
I think this fixes all the listed issues, you'll have to use the version of grunt-ver in my master though until chrisdanford/grunt-ver#2 is resolved |
There was a problem hiding this comment.
This should have been removed
|
stuartf: can we point our package.json to your grunt-ver repo until the referenced issue is resolved? |
|
I've switched grunt-ver over to my repo in package.json and deleted the stray npmignore |
|
Can you take a look at the conflict? |
… hilary-grunt Conflicts: nginx.conf ui/css/oae.main.css
|
I fixed the merge conflict and pushed it to my hilary-grunt branch. All of the files now seem properly hashed, but unfortunately this isn't working when tried in the browser. The first failure is in /shared/oae/api/oae.bootstrap.js, which still has Any chance you can have a look at this before Monday's demo? |
There was a problem hiding this comment.
This is a very clever solution to an otherwise hairy problem. I haven't looked too deep into the mechanics here yet, but am wondering if it is possible to take the cultureMap a step further and have it store the full path+hash, keyed by the locale, rather than just the hash. So the consuming code wouldn't always need to construct it with the hash?
The result would be that this consumer code would rather be:
var bundlesToLoad = ['/ui/bundles/default.properties', cultureMap.bundles[locale]];
And the hash = '.' + cultureMap.bundles[locale]; code wouldn't need to exist here or in l10n.
This only makes sense if the hash isn't needed for other purposes than just constructing the URL to the culture bundle.
There was a problem hiding this comment.
I think the previous build system had a better approach for this problem. It would just hash the bundles folder and replace the bundles path inside of the codebase. As these would generate unique paths for the bundles, there was no need for something like the cultureMap. My preference would be to try to avoid the culturemap if possible.
There was a problem hiding this comment.
How does the code get the hash value of the bundle directory?
There was a problem hiding this comment.
It used to do an in-code string replacement of the unhashed path with the hashed path.
|
Sorry this hasn't had much review love over the past little while. Testing passes, just a few general comments I'd like addressed but otherwise looks good to merge. Good work @stuartf ! I imagine now that this tests out well, hashing would be next? Are there any known issues with the hashing procedure? Some initial testing shows that it doesn't work OOTB, but that isn't unexpected given we asked to have concat/minification working first. |
|
Pushed fixes for the review issues, I've left the dynamic hash resolution as is for now, because it might have to change when we fix the other hashing issues. |
|
Doing a Should these change? |
Conflicts: node_modules/oae-core/activity/js/activity.js
|
Looking at the full paths vs aliases, if they're in oae.api they generally don't have to be changed, but I think they can be. The ones in changepic definitely need to be fixed, I'll get those fixed on Monday. |
Conflicts: node_modules/oae-core/contentpreview/js/contentpreview.js
|
@stuartf I've submit a PR to your PR which fixes an issue with timeouts. Looks like the aliases for oae.api.util and oae.api.i18n were not the right way to go, but rather define oae.api directly as you suggested. |
oae.api.i18n for imports
|
@mrvisser I didn't take your patch unmodified, but the above should be equivalent. |
Conflicts: shared/vendor/js/jquery-plugins/jquery.infinitescroll-sakai.js
|
merged your commit |
* Upgrading to require.js 2.1.4 * Fixing x-dependency issue in oae.api.util Conflicts: shared/oae/api/oae.bootstrap.js
|
I just tried this locally, and it doesn't look like I can get this to work. I get the following error: However, I can see the output, and it doesn't quite reflect the way in which the old production build used to work. I see the following HTTP requests when opening the page: We can see that there is only 1 CSS file (2 if there would be a page CSS file), which is the expected optimal behaviour. However, in the old production build, all of the JS libraries and OAE apis would be condensed into a single file (oae.dependencies), which significantly cuts down the number of requests and improves performance. I'm fine with 2 separate files, one for oae.core and one for all 3rd party libraries, but I don't think we should have all of the files loaded individually. Is there anything we're currently doing with Require.JS that's preventing the old production build behaviour? |
|
I discovered the "exports" issue while working on hashing locally, that was my bad as I cleaned things up for the PR. I just finished up hashing locally, I'll look at doing this as well. Since hashing finished so quickly after the "define" functionality was fixed, I think I may just resubmit a PR with it all completed. Hopefully later today. |
There was a problem hiding this comment.
Can you update the README to reflect these changes?
|
Did a review as well. |
|
I've addressed @nicolaasmatthijs 's comments in a fork in my hilary-grunt branch. I will close this and submit a new PR with Stuart's work here plus hashing and review fixes. |
production build in grunt