-
Notifications
You must be signed in to change notification settings - Fork 11
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
RA-1121/OMRSJS-5 migrate to webpack #15
Conversation
okk, I forgot about tests |
I'm not able to make bitHound - Code test pass, as it fails on Yeoman placeholders. |
- [x] Local deploy with Gulp | ||
- [x] Package management with [Bower](http:https://bower.io/) | ||
- [x] Production build with [Webpack](https://webpack.github.io/) | ||
- [x] Local deploy with [Webpack](https://webpack.github.io/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is minor, but we probably only need the first Webpack link :).
Right now |
```` | ||
|
||
Be sure to include the following in your `html` files at the position you want the Bower dependencies injected: | ||
Be sure to include the loading statement in your `.js` files at the modules you want your dependencies injected: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rewrite this sentence as:
To use the installed package, import it as follows:
I've fixed packing |
"build:deploy": "npm run clean && webpack --progress --colors --mode=dev --target=web", | ||
"watch": "npm run clean && webpack --progress --colors --watch --mode=dev --target=web", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"zip": "bestzip dist/<%= appId %>.zip dist/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an issue with putting zip in dist. Basically bestzip also tried to zip the zip. For that reason I put zip outside of dist. See rkorytkowski/openmrs-owa-conceptdictionary@3b2de69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads up!
Hey @psbrandt, is there anything else You want me to amend? |
In further testing I have found out that keeping 2 independent entry chunks (for css and js) in one bundle file is not the best idea, scripts didn't work. Creating separate bundle for css files fixed the problem. |
@PawelGutkowski I'll take another look at this today. |
"test": "echo \"Error: no test specified\" && exit 1" | ||
"clean": "rimraf dist && rimraf coverage*", | ||
"build": "webpack --progress --colors --mode=production --target=web", | ||
"build:prod": "npm run clean && npm run test && npm run build && npm run zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a build:dev
script so that it's possible to build a non-minified version for debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@psbrandt Done.
The |
I have overlooked that, fixed. |
When I install a package, it seems like Webpack is including it in npm install --save moment and then, if my import moment from 'moment';
(function () {
'use strict';
document.addEventListener("DOMContentLoaded", function(event) {
console.log('OpenMRS Open Web App Started.');
console.log(moment().format('YYYY-MM-DD'));
});
}()); it works, but |
I'm still trying to figure out how to install CSS-only packages (e.g. animate.css), or packages that contain both CSS and JS (e.g. Bootstrap). Have you been able to get such examples working? |
I don't think so. All I'm doing is what I posted in the comment above. I guess you are referring to this section of entry: {
app : `${__dirname}/app/js/owa.js`,
css: `${__dirname}/app/css/owa.css`,
vendor : [
'angular'
]
}, Can you update the README to explain this requirement? |
Yeah, that's the part I meant. I have updated README. |
I've got |
Installing bootstrap by webpack is painful, but there's bootstrap-webpack, which makes it quite easy. From my little experience I have to say that unfortunately, a lots of libraries are not adjusted to be used with webpack, and need some tricks/wrap packages to be installed. |
With the latest change, the app icon is working if I do
Note the extra What is the reason that you are now including |
Yes, I have the same zip structure. Thanks for noticing, we overlooked that issue in Concept Dictionary, too. I will fix it later. |
There is nothing wrong with using the I think after the ZIP file is corrected we can land this PR. Thanks for all the hard work! We've made it a bit more complicated to add and use different packages (because Webpack makes it more complicated), so I think having good documentation and examples would be a good thing. I will try to find the time to work on that, but PRs will always be welcome :). |
On master branch I couldn't change I'm happy to help. About documentation, we are planning to create video tutorial for development using this generator and openmrs-contrib-uicommons. If You got any certain ideas to improve documentation, ping me, I will certainly help! |
@rkorytkowski, @sunbiz, how do you feel about including the version in the URL? Doing it this way would allow us to have multiple versions of the same app installed. |
@psbrandt, personally I wouldn't include the version in the URL. It will be troublesome to handle when adding links to an app from other apps unless we can provide a default version with URL consistent between versions. I think the benefits do not justify the complexity behind supporting multiple versions of an app. |
Okay @rkorytkowski, that reasoning makes sense to me. When I download the Concept Dictionary OWA, the filename has a version in it (as required by Bintray), so I suspect that if I were to install it into the OWA Module, it will have that version in the URL. How do you think we should handle this? Whatever strategy we choose, we should definitely bake it into the generator (if applicable) sooner rather than later. I guess a few options are:
I think my preference is probably number 3 (when extracting). |
I think the filename should not matter at all to the OWA module. It should read app id from manifest.webapp and put it under correct url. |
Agreed, so in that case we don't need to change anything here, and I think we merge this if you agree. |
I agree with the merge. |
No description provided.