-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
node_modules | ||
.project | ||
*~ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,24 +13,18 @@ For further documentation about OpenMRS Open Web Apps see | |
|
||
### Production Build | ||
|
||
You will need NodeJS 4+ installed to do this. See the install instructions | ||
[here](https://nodejs.org/en/download/package-manager/). | ||
You will need NodeJS 4+ installed to do this. See the install instructions [here](https://nodejs.org/en/download/package-manager/). | ||
|
||
Once you have NodeJS installed, you need to install Gulp and Bower (first time | ||
only) as follows: | ||
```` | ||
npm install -g gulp bower | ||
```` | ||
Once you have NodeJS installed, install the dependencies (first time only): | ||
|
||
Install the dependencies (first time only): | ||
|
||
``` | ||
npm install && bower install | ||
```sh | ||
npm install | ||
``` | ||
Build the distributable using [Gulp](http:https://gulpjs.com/) as follows: | ||
|
||
```` | ||
gulp | ||
Build the distributable using [Webpack](https://webpack.github.io/) as follows: | ||
|
||
````sh | ||
npm run build:prod | ||
```` | ||
|
||
This will create a file called `<%= appId %>.zip` file in the `dist` directory, | ||
|
@@ -41,7 +35,7 @@ which can be uploaded to the OpenMRS Open Web Apps module. | |
To deploy directly to your local Open Web Apps directory, run: | ||
|
||
```` | ||
gulp deploy-local | ||
npm run build:deploy | ||
```` | ||
|
||
This will build and deploy the app to the `<%= localDeployDirectory %>` | ||
|
@@ -70,25 +64,36 @@ will need the `APP_ENTRY_POINT` entry in your `config.json` file: | |
Run Browsersync as follows: | ||
|
||
``` | ||
gulp watch | ||
npm run watch | ||
``` | ||
|
||
### Extending | ||
|
||
Install [Bower](http:https://bower.io/) packages dependencies as follows: | ||
Install [npm](http:https://npmjs.com/) packages dependencies as follows: | ||
|
||
```` | ||
bower install --save <package> | ||
````sh | ||
npm install --save <package> | ||
```` | ||
|
||
Be sure to include the following in your `html` files at the position you want | ||
the Bower dependencies injected: | ||
To use the installed package, import it as follows: | ||
|
||
````js | ||
//import and assign to variable | ||
import variableName from 'package'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comments above about these few lines ↑ |
||
```` | ||
<!-- bower:js --> | ||
<!-- endbower --> | ||
|
||
To contain package in vendor bundle, remember to add it to vendor entry point array, eg.: | ||
|
||
````js | ||
entry: { | ||
app : `${__dirname}/app/js/owa.js`, | ||
css: `${__dirname}/app/css/owa.css`, | ||
vendor : [ | ||
'package', | ||
...//other packages in vendor bundle | ||
] | ||
}, | ||
```` | ||
Do the same for your Bower stylesheet dependencies, but replace `js` with `css`. | ||
|
||
Any files that you add manually must be added in the `app` directory. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we need to make a decision about whether we want to promote ES2015 (my preference) or whether we want to promote ES5. If we want to promote ES2015, then we should not show examples of the old syntax. We should also update the template to look more like ES2015.
What do you think @rkorytkowski?
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.
I agree with promoting ES2015 (ES6) in the owa generator and using proper ES6 imports here. That said there are not yet many examples of code in ES6 so I expect ES5 and ES6 to interleave in our codebase. I do not think it's a bad thing and we should not force ourselves to always use the ES6 syntax. Similarly we do not force using the Java 8 syntax instead of Java 7. Let's allow for an evolution and not a revolution :)
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.
Agreed. I just think we should have our examples in ES2015 to nudge people in the right direction 😄. That said, I am planning to add ESLint to the generator and using the Airbnb style (for non-Angular projects), which gives you warnings if you don't use ES2015.
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.
In that case, I am removing old syntax example to avoid confusement.