diff --git a/.eslintignore b/.eslintignore index b5b25be8e..8e8bced70 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -/frontend/tests/* +/frontend/tests/dist/* diff --git a/.eslintrc.json b/.eslintrc.json index d8cac4e3c..9d0f7efc1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,26 +1,29 @@ { - "env": { - "browser": true, - "commonjs": true, - "es6": true - }, - "extends": "eslint:recommended", - "plugins": ["vue"], - "parserOptions": { - "sourceType": "module" - }, - "rules": { - "indent": [ - "error", - 2 - ], - "linebreak-style": [ - "error", - "unix" - ], - "semi": [ - "error", - "always" - ] - } + "env": { + "browser": true, + "commonjs": true, + "es6": true + }, + "extends": "eslint:recommended", + "plugins": ["vue"], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + 2 + ], + "linebreak-style": [ + "error", + "unix" + ], + "semi": [ + "error", + "always" + ] + }, + "globals": { + "QUnit": true + } } diff --git a/bower.json b/bower.json index c7598f7a4..30d8b5e50 100644 --- a/bower.json +++ b/bower.json @@ -1,32 +1,32 @@ { - "name": "simphony-remote-deps", - "version": "0.0.0", - "homepage": "https://github.com/simphony/simphony-remote", - "authors": [ - "Stefano Borini " - ], - "ignore": [ - "**/.*", - "node_modules", - "test", - "tests" - ], - "dependencies": { - "bootstrap": "components/bootstrap#~3.3.7", - "font-awesome": "~4.5", - "ionicons": "~2.0.1", - "jquery": "components/jquery#~2.0", - "datatables.net": "~1.10.12", - "datatables.net-dt": "~1.10.12", - "admin-lte": "~2.3.11", - "html5shiv": "~3.7.3", - "respond": "~1.4.2", - "vue": "^2.2.6", - "vue-router": "^2.5.2", - "vue-form": "^4.0.0", - "lodash": "~4.17.4" - }, - "devDependencies": { - "blanket": "^1.1.7" - } + "name": "simphony-remote-deps", + "version": "0.0.0", + "homepage": "https://github.com/simphony/simphony-remote", + "authors": [ + "Stefano Borini " + ], + "ignore": [ + "**/.*", + "node_modules", + "test", + "tests" + ], + "dependencies": { + "bootstrap": "components/bootstrap#~3.3.7", + "font-awesome": "~4.5", + "ionicons": "~2.0.1", + "jquery": "components/jquery#~2.0", + "datatables.net": "~1.10.12", + "datatables.net-dt": "~1.10.12", + "admin-lte": "~2.3.11", + "html5shiv": "~3.7.3", + "respond": "~1.4.2", + "vue": "^2.2.6", + "vue-router": "^2.5.2", + "vue-form": "^4.0.0", + "lodash": "~4.17.4" + }, + "devDependencies": { + "blanket": "^1.1.7" + } } diff --git a/frontend/tests/helpers.js b/frontend/tests/helpers.js index 68423b8fa..814b70628 100644 --- a/frontend/tests/helpers.js +++ b/frontend/tests/helpers.js @@ -1,11 +1,11 @@ var Vue = require("vuejs"); var getRenderedText = function(Component, propsData) { - var Ctor = Vue.extend(Component); - var vm = new Ctor({ propsData: propsData }).$mount(); - return vm.$el.textContent; + var Ctor = Vue.extend(Component); + var vm = new Ctor({ propsData: propsData }).$mount(); + return vm.$el.textContent; }; module.exports = { - getRenderedText: getRenderedText + getRenderedText }; diff --git a/frontend/tests/tests/test_analytics.js b/frontend/tests/tests/test_analytics.js index 2700f6a69..cfca6070b 100644 --- a/frontend/tests/tests/test_analytics.js +++ b/frontend/tests/tests/test_analytics.js @@ -1,31 +1,31 @@ var gamodule = require("gamodule"); window.apidata = { - base_url: "/", - prefix: "/" + base_url: "/", + prefix: "/" }; QUnit.module("Google Analytics"); QUnit.test("test without analytics", function (assert) { - var result=[]; - window.ga = function(cmd, id, auto) { - result[0] = [cmd, id, auto]; - }; - window.apidata.analytics = undefined; - var ga = gamodule.init(); - assert.notEqual(ga, undefined); - assert.equal(result.length, 0); + var result=[]; + window.ga = function(cmd, id, auto) { + result[0] = [cmd, id, auto]; + }; + window.apidata.analytics = undefined; + var ga = gamodule.init(); + assert.notEqual(ga, undefined); + assert.equal(result.length, 0); }); QUnit.test("test with analytics", function (assert) { - var result=[]; - window.ga = function(cmd, id, auto) { - result[0] = [cmd, id, auto]; - }; - window.apidata.analytics = {"tracking_id": "X"}; - var ga = gamodule.init(); - assert.notEqual(ga, undefined); - assert.equal(result[0][0], "create"); - assert.equal(result[0][1], "X"); - assert.equal(result[0][2], "auto"); + var result=[]; + window.ga = function(cmd, id, auto) { + result[0] = [cmd, id, auto]; + }; + window.apidata.analytics = {"tracking_id": "X"}; + var ga = gamodule.init(); + assert.notEqual(ga, undefined); + assert.equal(result[0][0], "create"); + assert.equal(result[0][1], "X"); + assert.equal(result[0][2], "auto"); }); diff --git a/frontend/tests/tests/test_urlutils.js b/frontend/tests/tests/test_urlutils.js index f93d7d294..42a46b61f 100644 --- a/frontend/tests/tests/test_urlutils.js +++ b/frontend/tests/tests/test_urlutils.js @@ -2,5 +2,5 @@ var urlutils = require("urlutils"); QUnit.module("URL Utils"); QUnit.test("path_join", function (assert) { - assert.equal(urlutils.url_path_join("foo", "bar", "baz"), "foo/bar/baz"); + assert.equal(urlutils.url_path_join("foo", "bar", "baz"), "foo/bar/baz"); }); diff --git a/frontend/tests/tests/test_utils.js b/frontend/tests/tests/test_utils.js index e46459706..c8b8fa2a8 100644 --- a/frontend/tests/tests/test_utils.js +++ b/frontend/tests/tests/test_utils.js @@ -2,13 +2,13 @@ var utils = require("utils"); QUnit.module("Utils"); QUnit.test("update", function (assert) { - var o1 = {"foo": "bar"}; - var o2 = {"bar": "baz"}; + var o1 = {"foo": "bar"}; + var o2 = {"bar": "baz"}; - utils.update(o1, o2); + utils.update(o1, o2); - assert.deepEqual(o1, { - "foo": "bar", - "bar": "baz" - }); + assert.deepEqual(o1, { + "foo": "bar", + "bar": "baz" + }); }); diff --git a/frontend/tests/tests/user/mock_jsapi.js b/frontend/tests/tests/user/mock_jsapi.js index 915e65502..baa23da3f 100644 --- a/frontend/tests/tests/user/mock_jsapi.js +++ b/frontend/tests/tests/user/mock_jsapi.js @@ -1,61 +1,60 @@ var $ = require("jquery"); module.exports = { - Application: { - data: { - "12345": { - image: { - name: "app1", - ui_name: "Application 1", - icon_128: "", - description: "description", - policy: { - allow_home: true, - volume_source: "", - volume_target: "", - volume_mode: "" - }, - configurables: [ - "resolution" - ] - } - }, - "67890": { - image: { - name: "app2", - ui_name: "Application 2", - icon_128: "", - description: "description", - policy: { - allow_home: true, - volume_source: "", - volume_target: "", - volume_mode: "" - }, - configurables: [] - } - } - }, - create: function() { - }, - delete: function() { - }, - retrieve: function(id) { - return $.when(this.data[id]); - - }, - items: function() { - return $.when(["12345", "67890"], this.data); + Application: { + data: { + "12345": { + image: { + name: "app1", + ui_name: "Application 1", + icon_128: "", + description: "description", + policy: { + allow_home: true, + volume_source: "", + volume_target: "", + volume_mode: "" + }, + configurables: [ + "resolution" + ] } - }, - Container: { - create: function() { - }, - delete: function() { - }, - retrieve: function() { - }, - items: function() { + }, + "67890": { + image: { + name: "app2", + ui_name: "Application 2", + icon_128: "", + description: "description", + policy: { + allow_home: true, + volume_source: "", + volume_target: "", + volume_mode: "" + }, + configurables: [] } + } + }, + create: function() { + }, + delete: function() { + }, + retrieve: function(id) { + return $.when(this.data[id]); + }, + items: function() { + return $.when(["12345", "67890"], this.data); + } + }, + Container: { + create: function() { + }, + delete: function() { + }, + retrieve: function() { + }, + items: function() { } -}; \ No newline at end of file + } +}; diff --git a/frontend/tests/tests/user/test_application_label.js b/frontend/tests/tests/user/test_application_label.js index 0a7248d13..63f81b9d7 100644 --- a/frontend/tests/tests/user/test_application_label.js +++ b/frontend/tests/tests/user/test_application_label.js @@ -1,7 +1,6 @@ var Vue = require("vuejs"); var ApplicationListModel = require("user/ApplicationListModel"); var ApplicationLabel = require("user/vue-components/ApplicationLabel"); -var $ = require("jquery"); require("filters"); QUnit.module("user.app_label"); @@ -31,7 +30,7 @@ QUnit.test("application name", function(assert) { done(); }); - }) + }); }); }); @@ -69,6 +68,6 @@ QUnit.test("rendering stop button", function (assert) { done(); }); - }) + }); }); }); diff --git a/frontend/tests/tests/user/test_application_list_view.js b/frontend/tests/tests/user/test_application_list_view.js index 3ce38a967..5b746ac2f 100644 --- a/frontend/tests/tests/user/test_application_list_view.js +++ b/frontend/tests/tests/user/test_application_list_view.js @@ -5,86 +5,86 @@ require("filters"); QUnit.module("user.app_list_view"); QUnit.test("rendering list", function (assert) { - var done = assert.async(); + var done = assert.async(); - var model = new ApplicationListModel(); - var appListView = new ApplicationListView({ - data: function() { return { model: model }; } - }).$mount(); + var model = new ApplicationListModel(); + var appListView = new ApplicationListView({ + data: function() { return { model: model }; } + }).$mount(); - assert.ok(model.loading); + assert.ok(model.loading); + assert.equal( + appListView.$el.querySelector("#loading-spinner").style.display, + "" + ); + + model.update().done(function() { Vue.nextTick(function() { + assert.equal( + appListView.$el.querySelector("#no-app-msg").style.display, + "none" + ); + assert.equal( + appListView.$el.querySelector("#loading-spinner").style.display, + "none" + ); assert.equal( - appListView.$el.querySelector("#loading-spinner").style.display, - "" + appListView.$el.querySelector("#applistentries").children.length, + model.appList.length ); - model.update().done(function() { Vue.nextTick(function() { - assert.equal( - appListView.$el.querySelector("#no-app-msg").style.display, - "none" - ); - assert.equal( - appListView.$el.querySelector("#loading-spinner").style.display, - "none" - ); - assert.equal( - appListView.$el.querySelector("#applistentries").children.length, - model.appList.length - ); - - done(); - })}); + done(); + });}); }); QUnit.test("rendering nothing in the list", function (assert) { - var done = assert.async(); + var done = assert.async(); - var model = new ApplicationListModel(); - var appListView = new ApplicationListView({ - data: function() { return { model: model }; } - }).$mount(); + var model = new ApplicationListModel(); + var appListView = new ApplicationListView({ + data: function() { return { model: model }; } + }).$mount(); - model.loading = false; + model.loading = false; - Vue.nextTick(function() { - assert.equal( - appListView.$el.querySelector("#no-app-msg").style.display, - "" - ); - assert.equal( - appListView.$el.querySelector("#loading-spinner").style.display, - "none" - ); - assert.equal( - appListView.$el.querySelector("#applistentries").children.length, - 0 - ); - - done(); - }); + Vue.nextTick(function() { + assert.equal( + appListView.$el.querySelector("#no-app-msg").style.display, + "" + ); + assert.equal( + appListView.$el.querySelector("#loading-spinner").style.display, + "none" + ); + assert.equal( + appListView.$el.querySelector("#applistentries").children.length, + 0 + ); + + done(); + }); }); QUnit.test("search form", function (assert) { - var done = assert.async(); + var done = assert.async(); - var model = new ApplicationListModel(); - var appListView = new ApplicationListView({ - data: function() { return { model: model }; } - }).$mount(); + var model = new ApplicationListModel(); + var appListView = new ApplicationListView({ + data: function() { return { model: model }; } + }).$mount(); - model.update().done(function() { Vue.nextTick(function() { - assert.notEqual(appListView.visibleList.length, 0); + model.update().done(function() { Vue.nextTick(function() { + assert.notEqual(appListView.visibleList.length, 0); - appListView.searchInput = "heho"; + appListView.searchInput = "heho"; - Vue.nextTick(function() { - assert.equal(appListView.visibleList.length, 0); - assert.equal( - appListView.$el.querySelector("input[name=q]").value, - "heho" - ); + Vue.nextTick(function() { + assert.equal(appListView.visibleList.length, 0); + assert.equal( + appListView.$el.querySelector("input[name=q]").value, + "heho" + ); - done(); - }) - })}); + done(); + }); + });}); }); diff --git a/frontend/tests/tests/user/test_application_view.js b/frontend/tests/tests/user/test_application_view.js index 84e3d6fd4..0a763405f 100644 --- a/frontend/tests/tests/user/test_application_view.js +++ b/frontend/tests/tests/user/test_application_view.js @@ -5,66 +5,66 @@ require("filters"); QUnit.module("user.app_view"); QUnit.test("rendering form", function (assert) { - var done = assert.async(); + var done = assert.async(); - var model = new ApplicationListModel(); - var appView = new ApplicationView({ - data: function() { return { model: model }; } - }).$mount(); + var model = new ApplicationListModel(); + var appView = new ApplicationView({ + data: function() { return { model: model }; } + }).$mount(); - model.update().done(function() { Vue.nextTick(function() { - assert.equal(appView.$el.children[0].tagName, 'DIV'); - assert.ok(appView.$el.children[0].classList.contains('row')); + model.update().done(function() { Vue.nextTick(function() { + assert.equal(appView.$el.children[0].tagName, 'DIV'); + assert.ok(appView.$el.children[0].classList.contains('row')); - assert.equal( - appView.$el.querySelector('.box-title').innerHTML, - model.appList[0].appData.image.ui_name - ); + assert.equal( + appView.$el.querySelector('.box-title').innerHTML, + model.appList[0].appData.image.ui_name + ); - // Simulate application starting - model.appList[0].status = 'STARTING'; + // Simulate application starting + model.appList[0].status = 'STARTING'; - assert.equal( - appView.$el.querySelector('.box-title').innerHTML, - model.appList[0].appData.image.ui_name - ); - assert.equal( - appView.$el.querySelector('#app-description').innerHTML, - model.appList[0].appData.image.description - ); + assert.equal( + appView.$el.querySelector('.box-title').innerHTML, + model.appList[0].appData.image.ui_name + ); + assert.equal( + appView.$el.querySelector('#app-description').innerHTML, + model.appList[0].appData.image.description + ); - done(); - })}); + done(); + });}); }); QUnit.test("rendering iframe", function (assert) { - var done = assert.async(); + var done = assert.async(); - var model = new ApplicationListModel(); - var appView = new ApplicationView({ - data: function() { return { model: model }; } - }).$mount(); + var model = new ApplicationListModel(); + var appView = new ApplicationView({ + data: function() { return { model: model }; } + }).$mount(); - model.update().done(function() { - // Simulate application running - model.appList[0].status = 'RUNNING'; - model.appList[0].appData.container = {}; - model.appList[0].appData.container.url_id = 'https://127.0.0.1:1234/'; + model.update().done(function() { + // Simulate application running + model.appList[0].status = 'RUNNING'; + model.appList[0].appData.container = {}; + model.appList[0].appData.container.url_id = 'https://127.0.0.1:1234/'; - Vue.nextTick(function() { - assert.equal(appView.$el.children[0].tagName, 'IFRAME'); + Vue.nextTick(function() { + assert.equal(appView.$el.children[0].tagName, 'IFRAME'); - // Render form again by selecting the other application which is stopped - model.selectedIndex = 1; + // Render form again by selecting the other application which is stopped + model.selectedIndex = 1; - Vue.nextTick(function() { - assert.equal( - appView.$el.querySelector('.box-title').innerHTML, - model.appList[1].appData.image.ui_name - ); + Vue.nextTick(function() { + assert.equal( + appView.$el.querySelector('.box-title').innerHTML, + model.appList[1].appData.image.ui_name + ); - done(); - }); - }); + done(); + }); }); + }); }); diff --git a/frontend/tests/tests/user/test_configurables.js b/frontend/tests/tests/user/test_configurables.js index 78d379d09..c56e9cffa 100644 --- a/frontend/tests/tests/user/test_configurables.js +++ b/frontend/tests/tests/user/test_configurables.js @@ -3,20 +3,20 @@ var Resolution = require("user/configurables/Resolution"); QUnit.module("user.configurables"); QUnit.test("instantiation", function (assert) { - var resolutionConf = new configurables.resolution(); + var resolutionConf = new configurables.resolution(); - assert.equal(resolutionConf.tag, "resolution"); - assert.deepEqual(resolutionConf.configDict, { resolution: "Window" }); - assert.notEqual(resolutionConf.asConfigDict().resolution, "Window"); + assert.equal(resolutionConf.tag, "resolution"); + assert.deepEqual(resolutionConf.configDict, { resolution: "Window" }); + assert.notEqual(resolutionConf.asConfigDict().resolution, "Window"); - resolutionConf.configDict = { resolution: '1280x1024' }; - assert.equal(resolutionConf.asConfigDict().resolution, '1280x1024'); + resolutionConf.configDict = { resolution: '1280x1024' }; + assert.equal(resolutionConf.asConfigDict().resolution, '1280x1024'); }); QUnit.test("view", function (assert) { - var propsData = { configDict: { resolution: "Window" } }; - var component = new Resolution({propsData: propsData}).$mount(); + var propsData = { configDict: { resolution: "Window" } }; + var component = new Resolution({propsData: propsData}).$mount(); - assert.notEqual(component.$el.querySelector("select"), null); - assert.equal(component.$el.querySelector("select").children.length, 5); + assert.notEqual(component.$el.querySelector("select"), null); + assert.equal(component.$el.querySelector("select").children.length, 5); }); diff --git a/frontend/tests/tests/user/test_models.js b/frontend/tests/tests/user/test_models.js index f04db2bb2..175daf577 100644 --- a/frontend/tests/tests/user/test_models.js +++ b/frontend/tests/tests/user/test_models.js @@ -2,16 +2,16 @@ var ApplicationListModel = require("user/ApplicationListModel"); QUnit.module("user.ApplicationListModel"); QUnit.test("instantiation", function (assert) { - var model = new ApplicationListModel(); + var model = new ApplicationListModel(); - assert.equal(model.appList.length, 0); - assert.equal(model.selectedIndex, null); + assert.equal(model.appList.length, 0); + assert.equal(model.selectedIndex, null); - model.update().done(function() { - assert.equal(model.appList.length, 2); - assert.equal(model.selectedIndex, 0); + model.update().done(function() { + assert.equal(model.appList.length, 2); + assert.equal(model.selectedIndex, 0); - assert.equal(model.appList[0].appData.image.configurables[0], "resolution"); - assert.equal(model.appList[0].configurables[0].configDict.resolution, "Window"); - }); + assert.equal(model.appList[0].appData.image.configurables[0], "resolution"); + assert.equal(model.appList[0].configurables[0].configDict.resolution, "Window"); + }); }); diff --git a/frontend/tests/tests/vue/components/test_ConfirmDialog.js b/frontend/tests/tests/vue/components/test_ConfirmDialog.js index d2fea8c32..38a2104e0 100644 --- a/frontend/tests/tests/vue/components/test_ConfirmDialog.js +++ b/frontend/tests/tests/vue/components/test_ConfirmDialog.js @@ -1,15 +1,14 @@ -var Vue = require("vuejs"); var ConfirmDialog = require("toolkit-dir/ConfirmDialog"); var helpers = require("helpers"); QUnit.module("ConfirmDialog"); QUnit.test("rendering", function (assert) { - assert.equal(helpers.getRenderedText(ConfirmDialog, { - title: "This is the title", - closeCallback: function() {} - }), "This is the title Cancel Ok"); + assert.equal(helpers.getRenderedText(ConfirmDialog, { + title: "This is the title", + closeCallback: function() {} + }), "This is the title Cancel Ok"); - assert.equal(helpers.getRenderedText(ConfirmDialog, { - title: "This is the title" - }), "This is the title Ok"); + assert.equal(helpers.getRenderedText(ConfirmDialog, { + title: "This is the title" + }), "This is the title Ok"); }); diff --git a/frontend/tests/tests/vue/components/test_DataTable.js b/frontend/tests/tests/vue/components/test_DataTable.js index 29cf10c6e..93b0cd496 100644 --- a/frontend/tests/tests/vue/components/test_DataTable.js +++ b/frontend/tests/tests/vue/components/test_DataTable.js @@ -1,19 +1,18 @@ -var Vue = require("vuejs"); var DataTable = require("toolkit-dir/DataTable"); -var helpers = require("helpers") +var helpers = require("helpers"); QUnit.module("DataTable"); QUnit.test("rendering", function (assert) { - assert.equal(helpers.getRenderedText(DataTable, { - headers: ["foo", "bar"], - rows: [[1,2], [3,4]], - globalActions: [{ - label: "New", - callback: function() {} - }], - rowActions: [{ - label: "Remove", - callback: function() {} - }] - }), "New foobar Actions 12 Remove34 Remove"); + assert.equal(helpers.getRenderedText(DataTable, { + headers: ["foo", "bar"], + rows: [[1,2], [3,4]], + globalActions: [{ + label: "New", + callback: function() {} + }], + rowActions: [{ + label: "Remove", + callback: function() {} + }] + }), "New foobar Actions 12 Remove34 Remove"); }); diff --git a/webpackfile-test.js b/webpackfile-test.js index cb73eff9e..aae21b502 100644 --- a/webpackfile-test.js +++ b/webpackfile-test.js @@ -4,57 +4,56 @@ var components = path.resolve(__dirname, "remoteappmanager/static/bower_componen var js = path.resolve(__dirname, "frontend"); module.exports = { - entry: { - testsuite: path.resolve(tests, "testsuite.js") - }, - - output: { - path: path.resolve(tests, "dist"), - filename: "[name].js" - }, - - resolve: { - extensions: ["*", ".js", ".vue"], - alias: { - lodash: path.resolve(components, "lodash/dist/lodash"), - jquery: path.resolve(components, "admin-lte/plugins/jQuery/jquery-2.2.3.min"), - vuejs: path.resolve(components, "vue/dist/vue"), - "vue-router": path.resolve(components, "vue-router/dist/vue-router"), - "vue-form": path.resolve(components, "vue-form/dist/vue-form"), - - "user-resources": path.resolve(tests, "tests/user/mock_jsapi"), - gamodule: path.resolve(js, "gamodule"), - urlutils: path.resolve(js, "urlutils"), - utils: path.resolve(js, "utils"), - - vue: path.resolve(js, "vue"), - filters: path.resolve(js, "vue/filters"), - errorReceiver: path.resolve(js, "vue/errorReceiver"), - toolkit: path.resolve(js, "vue/toolkit/toolkit"), - "toolkit-dir": path.resolve(js, "vue/toolkit"), - - helpers: path.resolve(tests, "helpers"), - - admin: path.resolve(js, "admin"), - user: path.resolve(js, "user"), - } - }, - - module: { - rules: [ - { - test: /\.js$/, - exclude: /(node_modules|bower_components)/, - use: { - loader: 'babel-loader' - } - }, - { - test: /\.vue$/, - use: { - loader: 'vue-loader' - } - } - ] + entry: { + testsuite: path.resolve(tests, "testsuite.js") + }, + + output: { + path: path.resolve(tests, "dist"), + filename: "[name].js" + }, + + resolve: { + extensions: ["*", ".js", ".vue"], + alias: { + lodash: path.resolve(components, "lodash/dist/lodash"), + jquery: path.resolve(components, "admin-lte/plugins/jQuery/jquery-2.2.3.min"), + vuejs: path.resolve(components, "vue/dist/vue"), + "vue-router": path.resolve(components, "vue-router/dist/vue-router"), + "vue-form": path.resolve(components, "vue-form/dist/vue-form"), + + "user-resources": path.resolve(tests, "tests/user/mock_jsapi"), + gamodule: path.resolve(js, "gamodule"), + urlutils: path.resolve(js, "urlutils"), + utils: path.resolve(js, "utils"), + + vue: path.resolve(js, "vue"), + filters: path.resolve(js, "vue/filters"), + toolkit: path.resolve(js, "vue/toolkit/toolkit"), + "toolkit-dir": path.resolve(js, "vue/toolkit"), + + helpers: path.resolve(tests, "helpers"), + + admin: path.resolve(js, "admin"), + user: path.resolve(js, "user"), } -} + }, + + module: { + rules: [ + { + test: /\.js$/, + exclude: /(node_modules|bower_components)/, + use: { + loader: 'babel-loader' + } + }, + { + test: /\.vue$/, + use: { + loader: 'vue-loader' + } + } + ] + } +}; diff --git a/webpackfile.js b/webpackfile.js index 1075e42bf..f773c8d1b 100644 --- a/webpackfile.js +++ b/webpackfile.js @@ -3,52 +3,52 @@ var components = path.resolve(__dirname, "remoteappmanager/static/bower_componen var js = path.resolve(__dirname, "frontend"); module.exports = { - entry: { - admin: path.resolve(js, "admin/main.js"), - user: path.resolve(js, "user/main.js") - }, + entry: { + admin: path.resolve(js, "admin/main.js"), + user: path.resolve(js, "user/main.js") + }, - output: { - path: path.resolve(__dirname, "remoteappmanager/static/dist"), - filename: "[name].js" - }, + output: { + path: path.resolve(__dirname, "remoteappmanager/static/dist"), + filename: "[name].js" + }, - resolve: { - extensions: ["*", ".js", ".vue"], - alias: { - lodash: path.resolve(components, "lodash/dist/lodash"), - jquery: path.resolve(components, "admin-lte/plugins/jQuery/jquery-2.2.3.min"), - vuejs: path.resolve(components, "vue/dist/vue"), - "vue-router": path.resolve(components, "vue-router/dist/vue-router"), - "vue-form": path.resolve(components, "vue-form/dist/vue-form"), + resolve: { + extensions: ["*", ".js", ".vue"], + alias: { + lodash: path.resolve(components, "lodash/dist/lodash"), + jquery: path.resolve(components, "admin-lte/plugins/jQuery/jquery-2.2.3.min"), + vuejs: path.resolve(components, "vue/dist/vue"), + "vue-router": path.resolve(components, "vue-router/dist/vue-router"), + "vue-form": path.resolve(components, "vue-form/dist/vue-form"), - "admin-resources": path.resolve(js, "admin/admin-resources"), - "user-resources": path.resolve(js, "user/user-resources"), - gamodule: path.resolve(js, "gamodule"), - urlutils: path.resolve(js, "urlutils"), - utils: path.resolve(js, "utils"), + "admin-resources": path.resolve(js, "admin/admin-resources"), + "user-resources": path.resolve(js, "user/user-resources"), + gamodule: path.resolve(js, "gamodule"), + urlutils: path.resolve(js, "urlutils"), + utils: path.resolve(js, "utils"), - filters: path.resolve(js, "vue/filters"), - ErrorDialog: path.resolve(js, "vue/ErrorDialog"), - toolkit: path.resolve(js, "vue/toolkit/toolkit"), - } - }, - - module: { - rules: [ - { - test: /\.js$/, - exclude: /(node_modules|bower_components)/, - use: { - loader: 'babel-loader' - } - }, - { - test: /\.vue$/, - use: { - loader: 'vue-loader' - } - } - ] + filters: path.resolve(js, "vue/filters"), + ErrorDialog: path.resolve(js, "vue/ErrorDialog"), + toolkit: path.resolve(js, "vue/toolkit/toolkit"), } -} + }, + + module: { + rules: [ + { + test: /\.js$/, + exclude: /(node_modules|bower_components)/, + use: { + loader: 'babel-loader' + } + }, + { + test: /\.vue$/, + use: { + loader: 'vue-loader' + } + } + ] + } +};