Skip to content

Commit

Permalink
Adding version number to bundled OWA file name (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Male Michael authored and dkayiwa committed Feb 1, 2018
1 parent 5116316 commit a716539
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.0",
"version": "1.0.0-beta",
"name": "openmrs-addOnManager",
"description": "This will help in uploading the openmrs open web apps and omod files",
"launch_path": "index.html",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"nyc": {
"exclude": [
"tests/**/*.js",
"openmrs-addonmanager/libs/**/*.js",
"webpack.*.js",
"server.babel.js",
"libs/**/*.js",
"dist/**/*.js",
"coverage/**/*.js"
Expand Down
10 changes: 9 additions & 1 deletion webpack.sample.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ const WebpackOnBuildPlugin = require('on-build-webpack');

const nodeModulesDir = path.resolve(__dirname, '../node_modules');

require.extensions['.webapp'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
const manifest = require('./app/manifest.webapp');

const THIS_APP_ID = 'openmrs-addonmanager';

const THIS_APP_VERSION = JSON.parse(manifest).version;

let plugins = [];
const nodeModules = {};

Expand Down Expand Up @@ -84,7 +91,8 @@ if (env === 'production') {
plugins.push(new WebpackOnBuildPlugin(function(stats){
//create zip file
let archiver = require('archiver');
let output = fs.createWriteStream(THIS_APP_ID+'.zip');
let output = THIS_APP_VERSION ? fs.createWriteStream(`${THIS_APP_ID}-${THIS_APP_VERSION}.zip`)
:fs.createWriteStream(`${THIS_APP_ID}.zip`);
let archive = archiver('zip');

output.on('close', function () {
Expand Down

0 comments on commit a716539

Please sign in to comment.