You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/06/14 21:18:42 UTC

[airavata-django-portal] branch master updated: Adding webpack build to make API JS available to non-vuejs Django apps

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/master by this push:
     new de77232  Adding webpack build to make API JS available to non-vuejs Django apps
de77232 is described below

commit de77232a7d0ef7f3eb128a7b20b2aca3b38a8937
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 14 17:12:52 2019 -0400

    Adding webpack build to make API JS available to non-vuejs Django apps
---
 django_airavata/apps/api/babel.config.js   |  6 ++++--
 django_airavata/apps/api/package.json      | 17 ++++++++++-------
 django_airavata/apps/api/webpack.config.js | 11 +++++++++++
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/django_airavata/apps/api/babel.config.js b/django_airavata/apps/api/babel.config.js
index 10db965..17c7e92 100644
--- a/django_airavata/apps/api/babel.config.js
+++ b/django_airavata/apps/api/babel.config.js
@@ -1,6 +1,8 @@
+// Use the following to verify that the config file is loaded
+// console.log("loaded babel.config.js");
 const presets = [
   [
-    "@babel/env",
+    "@babel/preset-env",
     {
       useBuiltIns: "usage"
     }
@@ -13,7 +15,7 @@ module.exports = {
   plugins,
   env: {
     test: {
-      presets: ["@babel/env"]
+      presets: ["@babel/preset-env"]
     }
   }
 };
diff --git a/django_airavata/apps/api/package.json b/django_airavata/apps/api/package.json
index a893506..01514e6 100644
--- a/django_airavata/apps/api/package.json
+++ b/django_airavata/apps/api/package.json
@@ -9,8 +9,8 @@
   "license": "Apache-2.0",
   "repository": "https://github.com/apache/airavata-django-portal",
   "scripts": {
-    "build": "babel static/django_airavata_api/js -d static/django_airavata_api/dist",
-    "watch": "babel static/django_airavata_api/js --watch -d static/django_airavata_api/dist",
+    "build": "webpack",
+    "watch": "webpack --watch",
     "test": "jest",
     "test:watch": "jest --watch",
     "lint": "eslint ./static/django_airavata_api/js/"
@@ -22,16 +22,18 @@
     "uuid": "^3.3.2"
   },
   "devDependencies": {
-    "@babel/cli": "^7.1.2",
-    "@babel/core": "^7.2.2",
+    "@babel/cli": "^7.4.4",
+    "@babel/core": "^7.4.5",
     "@babel/plugin-transform-runtime": "^7.1.0",
-    "@babel/preset-env": "^7.1.0",
+    "@babel/preset-env": "^7.4.5",
     "babel-core": "^7.0.0-bridge.0",
     "babel-jest": "^23.6.0",
     "eslint": "^5.12.0",
     "eslint-plugin-import": "^2.14.0",
     "jest": "^23.6.0",
-    "regenerator-runtime": "^0.13.1"
+    "regenerator-runtime": "^0.13.1",
+    "webpack": "^4.34.0",
+    "webpack-cli": "^3.3.4"
   },
   "eslintConfig": {
     "root": true,
@@ -42,7 +44,8 @@
     },
     "env": {
       "browser": true,
-      "es6": true
+      "es6": true,
+      "node": true
     }
   },
   "browserslist": [
diff --git a/django_airavata/apps/api/webpack.config.js b/django_airavata/apps/api/webpack.config.js
new file mode 100644
index 0000000..115b11a
--- /dev/null
+++ b/django_airavata/apps/api/webpack.config.js
@@ -0,0 +1,11 @@
+const path = require("path");
+
+module.exports = {
+  entry: "./static/django_airavata_api/js/index.js",
+  output: {
+    path: path.resolve(__dirname, "static/django_airavata_api/dist/"),
+    filename: "airavata-api.js",
+    library: "AiravataAPI"
+  },
+  mode: "production"
+};