From eb2c69284593e0a7b6afd9754abae2c998ee86e3 Mon Sep 17 00:00:00 2001 From: Jiri Tomasek Date: Mon, 7 Mar 2016 09:47:50 +0100 Subject: [PATCH] Upgrade Babel, Webpack and Lodash to latest versions Change-Id: I0999cc9550260f3e94101eb586fe2a5d3202de45 --- gulpfile.js | 2 +- package.json | 16 +- src/__tests__/actions/LoginActions.tests.js | 10 +- src/__tests__/actions/PlansActions.tests.js | 4 +- src/__tests__/components/Login.tests.js | 6 +- src/__tests__/components/nodes/Nodes.tests.js | 11 - .../components/nodes/NodesTable.tests.js | 2 +- .../services/KeystoneApiService.tests.js | 10 +- src/__tests__/services/TempStorage.tests.js | 2 +- .../services/TripleOApiService.tests.js | 3 +- src/__tests__/stores/LoginStore.tests.js | 94 ------- .../stores/ValidationsStore.tests.js | 13 - src/js/components/plan/PlanFileInput.js | 2 +- src/js/constants/APIEndpointUrls.js | 8 +- src/js/constants/GlanceApiConstants.js | 3 - src/js/constants/KeystoneApiConstants.js | 4 +- src/js/data/CapabilitiesMap.js | 257 ------------------ src/js/data/Parameters.js | 65 ----- src/js/index.js | 2 +- src/webpack.tests.js | 2 +- tempstorageworker.webpack.config.js | 9 +- webpack.config.js | 12 +- 22 files changed, 51 insertions(+), 486 deletions(-) delete mode 100644 src/__tests__/stores/LoginStore.tests.js delete mode 100644 src/__tests__/stores/ValidationsStore.tests.js delete mode 100644 src/js/constants/GlanceApiConstants.js delete mode 100644 src/js/data/CapabilitiesMap.js delete mode 100644 src/js/data/Parameters.js diff --git a/gulpfile.js b/gulpfile.js index 31cdc48d..38e7e2fe 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,7 +8,7 @@ var less = require('gulp-less'); // var rename = require('gulp-rename'); var shell = require('gulp-shell'); // var uglify = require('gulp-uglify'); -var webpack = require('gulp-webpack'); +var webpack = require('webpack-stream'); var webpackConfig = require('./webpack.config.js'); var tempStorageWorkerConfig = require('./tempstorageworker.webpack.config.js'); diff --git a/package.json b/package.json index 965fdad3..3ab42707 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,12 @@ "description": "TripleO UI - TripleO-based OpenStack deployment UI", "main": "index.js", "dependencies": { - "babel": "~5.5.8", + "babel-core": "^6.0.0", + "babel-loader": "^6.0.0", + "babel-polyfill": "^6.0.0", + "babel-preset-es2015": "^6.0.0", + "babel-preset-react": "^6.0.0", + "babel-preset-stage-0": "^6.5.0", "bootstrap": "~3.3.5", "classnames": "~2.1.2", "connect-history-api-fallback": "~1.1.0", @@ -15,7 +20,7 @@ "immutable": "~3.7.6", "invariant": "~2.1.1", "keymirror": "~0.1.1", - "lodash": "~3.10.1", + "lodash": "^4.0.0", "normalizr": "^2.0.0", "patternfly": "~2.5.0", "react": "~0.14.1", @@ -34,9 +39,7 @@ "xhr2": "~0.1.2" }, "devDependencies": { - "babel-core": "~5.5.8", - "babel-eslint": "~4.1.6", - "babel-loader": "~5.1.4", + "babel-eslint": "^4.1.6", "browser-sync": "~2.7.12", "eslint": "~1.1.0", "eslint-plugin-react": "~3.2.2", @@ -45,10 +48,9 @@ "gulp-rename": "~1.2.2", "gulp-shell": "~0.4.2", "gulp-uglify": "~1.2.0", - "gulp-webpack": "~1.5.0", + "webpack-stream": "^3.1.0", "ini": "^1.3.4", "jasmine": "~2.3.2", - "jasmine-core": "~2.3.4", "jasmine-immutable-matchers": "^1.0.1", "karma": "~0.13.9", "karma-cli": "~0.1.0", diff --git a/src/__tests__/actions/LoginActions.tests.js b/src/__tests__/actions/LoginActions.tests.js index 5816a3b1..781372cd 100644 --- a/src/__tests__/actions/LoginActions.tests.js +++ b/src/__tests__/actions/LoginActions.tests.js @@ -1,8 +1,8 @@ -const AppDispatcher = require('../../js/dispatchers/AppDispatcher'); -const KeystoneApiService = require('../../js/services/KeystoneApiService'); -const LoginActions = require('../../js/actions/LoginActions'); -const LoginConstants = require('../../js/constants/LoginConstants'); -const TempStorage = require('../../js/services/TempStorage.js'); +import AppDispatcher from '../../js/dispatchers/AppDispatcher'; +import KeystoneApiService from '../../js/services/KeystoneApiService'; +import LoginActions from '../../js/actions/LoginActions'; +import LoginConstants from '../../js/constants/LoginConstants'; +import TempStorage from '../../js/services/TempStorage.js'; let mockKeystoneAccess = { token: { diff --git a/src/__tests__/actions/PlansActions.tests.js b/src/__tests__/actions/PlansActions.tests.js index 88f62016..bbb63e48 100644 --- a/src/__tests__/actions/PlansActions.tests.js +++ b/src/__tests__/actions/PlansActions.tests.js @@ -7,8 +7,8 @@ import { Plan } from '../../js/immutableRecords/plans'; import { planSchema } from '../../js/normalizrSchemas/plans'; import TripleOApiService from '../../js/services/TripleOApiService'; -const PlansActions = require('../../js/actions/PlansActions'); -const plansReducer = require('../../js/reducers/plansReducer'); +import PlansActions from '../../js/actions/PlansActions'; +import plansReducer from '../../js/reducers/plansReducer'; describe('plansReducer default state', () => { describe('default state', () => { diff --git a/src/__tests__/components/Login.tests.js b/src/__tests__/components/Login.tests.js index 72ba302f..541d8cb2 100644 --- a/src/__tests__/components/Login.tests.js +++ b/src/__tests__/components/Login.tests.js @@ -1,9 +1,9 @@ import React from 'react'; import TestUtils from 'react-addons-test-utils'; -const Login = require('../../js/components/Login'); -const LoginActions = require('../../js/actions/LoginActions'); -const LoginStore = require('../../js/stores/LoginStore'); +import Login from '../../js/components/Login'; +import LoginActions from '../../js/actions/LoginActions'; +import LoginStore from '../../js/stores/LoginStore'; let loginInstance; diff --git a/src/__tests__/components/nodes/Nodes.tests.js b/src/__tests__/components/nodes/Nodes.tests.js index 9c46bed0..f49aaa94 100644 --- a/src/__tests__/components/nodes/Nodes.tests.js +++ b/src/__tests__/components/nodes/Nodes.tests.js @@ -2,20 +2,9 @@ import React from 'react'; import TestUtils from 'react-addons-test-utils'; const IronicApiService = require('../../../js/services/IronicApiService'); -// const NodesStore = require('../../../js/stores/NodesStore'); import Nodes from '../../../js/components/nodes/Nodes'; -// let nodesStoreState = { -// nodes: { -// all: [], -// registered: [], -// introspected: [], -// provisioned: [], -// maintenance: [] -// } -// }; - describe('Nodes Component', () => { let NodesVdom, NodesInstance; beforeEach(() => { diff --git a/src/__tests__/components/nodes/NodesTable.tests.js b/src/__tests__/components/nodes/NodesTable.tests.js index 4017dd1b..d76a30b2 100644 --- a/src/__tests__/components/nodes/NodesTable.tests.js +++ b/src/__tests__/components/nodes/NodesTable.tests.js @@ -2,7 +2,7 @@ import React from 'react'; import TestUtils from 'react-addons-test-utils'; import { List } from 'immutable'; -const NodesTable = require('../../../js/components/nodes/NodesTable'); +import NodesTable from '../../../js/components/nodes/NodesTable'; const initialState = { filterString: '', diff --git a/src/__tests__/services/KeystoneApiService.tests.js b/src/__tests__/services/KeystoneApiService.tests.js index 8c1ab1b1..dba40231 100644 --- a/src/__tests__/services/KeystoneApiService.tests.js +++ b/src/__tests__/services/KeystoneApiService.tests.js @@ -1,10 +1,6 @@ -// jest.autoMockOff(); - -// jest.mock('../../js/actions/LoginActions'); - -const KeystoneApiService = require('../../js/services/KeystoneApiService'); -const LoginActions = require('../../js/actions/LoginActions'); -const when = require('when'); +import KeystoneApiService from '../../js/services/KeystoneApiService'; +import LoginActions from '../../js/actions/LoginActions'; +import when from 'when'; describe('KeystoneApiService', () => { xit('logs user in when response is received', () => { diff --git a/src/__tests__/services/TempStorage.tests.js b/src/__tests__/services/TempStorage.tests.js index 9f5963de..80beb55d 100644 --- a/src/__tests__/services/TempStorage.tests.js +++ b/src/__tests__/services/TempStorage.tests.js @@ -1,4 +1,4 @@ -const TempStorage = require('../../js/services/TempStorage.js'); +import TempStorage from '../../js/services/TempStorage.js'; const WORKER_URL = '/js/tripleo_ui_tempstorage_worker.js'; describe('TempStorage', () => { diff --git a/src/__tests__/services/TripleOApiService.tests.js b/src/__tests__/services/TripleOApiService.tests.js index 0d561e2e..93381c0b 100644 --- a/src/__tests__/services/TripleOApiService.tests.js +++ b/src/__tests__/services/TripleOApiService.tests.js @@ -1,5 +1,6 @@ import when from 'when'; -const TripleOApiService = require('../../js/services/TripleOApiService.js'); + +import TripleOApiService from '../../js/services/TripleOApiService.js'; describe('TripleOApiService', () => { diff --git a/src/__tests__/stores/LoginStore.tests.js b/src/__tests__/stores/LoginStore.tests.js deleted file mode 100644 index 09769196..00000000 --- a/src/__tests__/stores/LoginStore.tests.js +++ /dev/null @@ -1,94 +0,0 @@ -// jest.autoMockOff(); - -// jest.mock('../../js/dispatchers/AppDispatcher'); - -const AppDispatcher = require('../../js/dispatchers/AppDispatcher'); -const LoginStore = require('../../js/stores/LoginStore'); -const LoginConstants = require('../../js/constants/LoginConstants'); - -let callback; - -let loggedInState = { - token: 'token', - user: 'admin', - serviceCatalog: 'service catalog', - metadata: 'some metadata' -}; - -// mock actions -let loginUserAction = { - actionType: LoginConstants.LOGIN_USER, - keystoneAccess: loggedInState -}; - -let logoutUserAction = { - actionType: LoginConstants.LOGOUT_USER -}; - -describe('LoginStore', () => { - - describe('An API endpoint URL', () => { - beforeEach(() => { - LoginStore.onLoginUser({ - serviceCatalog: [ - { - name: 'keystone', - endpoints: [ - {publicURL: 'http://192.0.2.1:5000/v2.0'} - ] - }, - { - name: 'swift', - endpoints: [ - {publicURL: 'http://192.0.2.1:8080/v1/AUTH_fb6ecfdf792241718144254ed3ccf34a'} - ] - } - ] - }); - }); - - it('is accessible through the ``getServiceUrl()`` method', () => { - expect(LoginStore.getServiceUrl('keystone')) - .toBe('http://192.0.2.1:5000/v2.0'); - expect(LoginStore.getServiceUrl('swift')) - .toBe('http://192.0.2.1:8080/v1/AUTH_fb6ecfdf792241718144254ed3ccf34a'); - }); - }); - - // beforeEach(() => { - // callback = AppDispatcher.register.mock.calls[0][0]; - // }); - - xit('registers a callback with the dispatcher', function() { - expect(AppDispatcher.register.mock.calls.length).toBe(1); - }); - - xit('sets state to keystoneAccess data when user logs in', () => { - // LoginStore.emitChange = jest.genMockFunction(); - callback(loginUserAction); - expect(LoginStore.state).toEqual({ - token: 'token', - user: 'admin', - serviceCatalog: 'service catalog', - metadata: 'some metadata' - }); - expect(LoginStore.emitChange).toBeCalled(); - }); - - xit('cleans the state when user logs out', () => { - // LoginStore.emitChange = jest.genMockFunction(); - callback(logoutUserAction); - expect(LoginStore.state).toEqual({}); - expect(LoginStore.emitChange).toBeCalled(); - }); - - xit('returns state with getState', () => { - LoginStore.state = loggedInState; - expect(LoginStore.getState()).toEqual(loggedInState); - }); - - xit('provides function to determine if user is logged in', () => { - LoginStore.state = loggedInState; - expect(LoginStore.isLoggedIn()).toEqual(true); - }); -}); diff --git a/src/__tests__/stores/ValidationsStore.tests.js b/src/__tests__/stores/ValidationsStore.tests.js deleted file mode 100644 index 32b0b046..00000000 --- a/src/__tests__/stores/ValidationsStore.tests.js +++ /dev/null @@ -1,13 +0,0 @@ -import ValidationsConstants from '../../js/constants/ValidationsConstants'; -import ValidationsStore from '../../js/stores/ValidationsStore'; - -describe('Validations Store', () => { - it('should call onListStages on LIST_STAGES action', () => { - spyOn(ValidationsStore, 'onListStages').and.callThrough(); - let payload = { actionType: ValidationsConstants.LIST_STAGES, - stages: [ 's1', 's2'] }; - ValidationsStore._registerToActions(payload); - expect(ValidationsStore.onListStages).toHaveBeenCalledWith(payload.stages); - expect(ValidationsStore.state.stages).toEqual(payload.stages); - }); -}); diff --git a/src/js/components/plan/PlanFileInput.js b/src/js/components/plan/PlanFileInput.js index 71fa758a..21f886af 100644 --- a/src/js/components/plan/PlanFileInput.js +++ b/src/js/components/plan/PlanFileInput.js @@ -39,7 +39,7 @@ class PlanFileInput extends React.Component { } }); }; - }(file)); + })(file); reader.readAsText(file); } } diff --git a/src/js/constants/APIEndpointUrls.js b/src/js/constants/APIEndpointUrls.js index b888168b..2ba4d7c7 100644 --- a/src/js/constants/APIEndpointUrls.js +++ b/src/js/constants/APIEndpointUrls.js @@ -6,8 +6,6 @@ let keystoneUrl = appConfig.keystone_url || host + ':5000/v2.0'; let tripleoApiUrl = appConfig.tripleo_api_url || host + ':8585/v1'; let validationsUrl = appConfig.validations_url || host + ':5001/v1'; -export default { - KEYSTONE_URL: keystoneUrl, - TRIPLEOAPI_URL: tripleoApiUrl, - VALIDATIONS_URL: validationsUrl -}; +export const KEYSTONE_URL = keystoneUrl; +export const TRIPLEOAPI_URL = tripleoApiUrl; +export const VALIDATIONS_URL = validationsUrl; diff --git a/src/js/constants/GlanceApiConstants.js b/src/js/constants/GlanceApiConstants.js deleted file mode 100644 index e318faff..00000000 --- a/src/js/constants/GlanceApiConstants.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - GET_IMAGES_PATH: 'images' -}; diff --git a/src/js/constants/KeystoneApiConstants.js b/src/js/constants/KeystoneApiConstants.js index 231b8369..649659aa 100644 --- a/src/js/constants/KeystoneApiConstants.js +++ b/src/js/constants/KeystoneApiConstants.js @@ -1,5 +1,3 @@ import { KEYSTONE_URL } from './APIEndpointUrls'; -export default { - AUTH_URL: KEYSTONE_URL + '/tokens' -}; +export const AUTH_URL = KEYSTONE_URL + '/tokens'; diff --git a/src/js/data/CapabilitiesMap.js b/src/js/data/CapabilitiesMap.js deleted file mode 100644 index 172b729a..00000000 --- a/src/js/data/CapabilitiesMap.js +++ /dev/null @@ -1,257 +0,0 @@ -/*eslint-disable quotes, quote-props, max-len */ - -export default { - "root_template": "overcloud-without-mergepy.yaml", - "topics": [ - { - "title": "Basic Configuration", - "description": null, - "environment_groups": [ - { - "title": null, - "description": "Enable basic configuration required for OpenStack Deployment", - "environments": [ - { - "file": "overcloud-resource-registry-puppet.yaml", - "title": "Default Configuration", - "description": null - } - ] - } - ] - }, - { - "title": "Deployment options", - "description": null, - "environment_groups": [ - { - "title": "High Availability", - "description": "Enables configuration of an Overcloud controller with Pacemaker", - "environments": [ - { - "file": "environments/puppet-pacemaker.yaml", - "title": "Pacemaker", - "description": "Enable configuration of an Overcloud controller with Pacemaker", - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Docker RDO", - "description": "Docker container with heat agents for containerized compute node\n", - "environments": [ - { - "file": "environments/docker-rdo.yaml", - "title": "Docker RDO", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - } - ] - }, - { - "title": "Overlay network Configuration", - "description": null, - "environment_groups": [ - { - "title": "Network Isolation", - "description": "Enable Network Isolation Enable the creation of Neutron networks for isolated Overcloud traffic and configure each role to assign ports (related to that role) on these networks.\n", - "environments": [ - { - "file": "environments/network-isolation.yaml", - "title": "Network Isolation", - "description": "Enable Network Isolation", - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Single nic or Bonding", - "description": "Configure roles to use pair of bonded nics or to use Vlans on a single nic. This option assumes use of Network Isolation.\n", - "environments": [ - { - "file": "environments/net-bond-with-vlans.yaml", - "title": "Bond with Vlans", - "description": "Configure each role to use a pair of bonded nics (nic2 and nic3) and configures an IP address on each relevant isolated network for each role. This option assumes use of Network Isolation.\n", - "requires": [ - "environments/network-isolation.yaml", - "overcloud-resource-registry-puppet.yaml" - ] - }, - { - "file": "environments/net-single-nic-with-vlans.yaml", - "title": "Single nic with Vlans", - "description": "Configure each role to use Vlans on a single nic for each isolated network. This option assumes use of Network Isolation.\n", - "requires": [ - "environments/network-isolation.yaml", - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - } - ] - }, - { - "title": "Neutron Plugin Configuration", - "description": null, - "environment_groups": [ - { - "title": "BigSwitch extensions or Cisco N1KV backend", - "description": null, - "environments": [ - { - "file": "environments/neutron-ml2-bigswitch.yaml", - "title": "BigSwitch extensions", - "description": "Enable Big Switch extensions, configured via puppet\n" - }, - { - "file": "environments/neutron-ml2-cisco-n1kv.yaml", - "title": "Cisco N1KV backend", - "description": "Enable a Cisco N1KV backend, configured via puppet\n", - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Cisco Neutron plugin", - "description": "Enable a Cisco Neutron plugin\n", - "environments": [ - { - "file": "environments/neutron-ml2-cisco-nexus-ucsm.yaml", - "title": "Cisco Neutron plugin", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - } - ] - }, - { - "title": "Storage", - "description": null, - "environment_groups": [ - { - "title": "Cinder NetApp backend", - "description": "Enable a Cinder NetApp backend, configured via puppet\n", - "environments": [ - { - "file": "environments/cinder-netapp-config.yaml", - "title": "Cinder NetApp backend", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Externally managed Ceph", - "description": "Enable the use of an externally managed Ceph cluster\n", - "environments": [ - { - "file": "environments/puppet-ceph-external.yaml", - "title": "Externally managed Ceph", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Ceph Devel", - "description": "Enable a Ceph storage cluster using the controller and 2 ceph nodes. Rbd backends are enabled for Cinder, Glance, and Nova.\n", - "environments": [ - { - "file": "environments/puppet-ceph-devel.yaml", - "title": "Ceph Devel", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Storage Environment", - "description": "Can be used to set up storage backends. Defaults to Ceph used as a backend for Cinder, Glance and Nova ephemeral storage. It configures for example which services will use Ceph, or if any of the services will use NFS. And more. Usually requires to be edited by user first.\n", - "tags": [ - "no-gui" - ], - "environments": [ - { - "file": "environments/storage-environment.yaml", - "title": "Storage Environment", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - } - ] - }, - { - "title": "Utilities", - "description": null, - "environment_groups": [ - { - "title": "Config Debug", - "description": "Enable config management (e.g. Puppet) debugging", - "environments": [ - { - "file": "environments/config-debug.yaml", - "title": "Config Debug", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Disable journal in MongoDb", - "description": "Since, when journaling is enabled, MongoDb will create big journal file it can take time. In a CI environment for example journaling is not necessary.\n", - "environments": [ - { - "file": "environments/mongodb-nojournal.yaml", - "title": "Disable journal in MongoDb", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - }, - { - "title": "Overcloud Steps", - "description": "Specifies hooks/breakpoints where overcloud deployment should stop Allows operator validation between steps, and/or more granular control. Note: the wildcards relate to naming convention for some resource suffixes, e.g see puppet/*-post.yaml, enabling this will mean we wait for a user signal on every *Deployment_StepN resource defined in those files.\n", - "tags": [ - "no-gui" - ], - "environments": [ - { - "file": "environments/overcloud-steps.yaml", - "title": "Overcloud Steps", - "description": null, - "requires": [ - "overcloud-resource-registry-puppet.yaml" - ] - } - ] - } - ] - } - ] -}; diff --git a/src/js/data/Parameters.js b/src/js/data/Parameters.js deleted file mode 100644 index d6923a53..00000000 --- a/src/js/data/Parameters.js +++ /dev/null @@ -1,65 +0,0 @@ -/*eslint-disable quotes, quote-props, max-len */ - -export default { - "NestedParameters": { - "level-1-groups": { - "NestedParameters": { - "0": { - "NestedParameters": { - "level-2-resource": { - "Type": "jdob::Level2", - "Description": "level 2 nested template", - "Parameters": { - "level-2-p2-optional": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": "not set by parent, should be considered a param_default parameter", - "Label": "level-2-p2-optional" - }, - "level-2-p1": { - "Type": "String", - "NoEcho": "false", - "Description": "must be set by parent; should have a value in the nested params list", - "Value": "level-1-set-value", - "Label": "level-2-p1" - } - } - } - }, - "Type": "jdob::Level1", - "Description": "level 1 nested template", - "Parameters": { - "level-1-p1": { - "Type": "String", - "NoEcho": "false", - "Description": "must be set by parent; should have a value in the nested params list", - "Value": "parent-set-value-1", - "Label": "level-1-p1" - }, - "level-1-p2-optional": { - "Default": "", - "Type": "String", - "NoEcho": "false", - "Description": "not set by parent, should be considered a param_default parameter", - "Label": "level-1-p2-optional" - } - } - } - }, - "Type": "OS::Heat::ResourceGroup", - "Description": "No description", - "Parameters": {} - } - }, - "Description": "parent template", - "Parameters": { - "parent-p1": { - "Default": "foo", - "Type": "String", - "NoEcho": "false", - "Description": "parent first parameter", - "Label": "parent-p1" - } - } -}; diff --git a/src/js/index.js b/src/js/index.js index 9e0b34ac..1491b81c 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1,4 +1,4 @@ -import 'babel/polyfill'; +import 'babel-polyfill'; import { Provider } from 'react-redux'; import React from 'react'; diff --git a/src/webpack.tests.js b/src/webpack.tests.js index eb57b53b..8d79ccf3 100644 --- a/src/webpack.tests.js +++ b/src/webpack.tests.js @@ -1,5 +1,5 @@ // *Some* environments (phantomjs) don't have es5 (Function.prototype.bind) -require('babel-core/polyfill'); +require('babel-polyfill'); // this regex should match any files in __tests__ directories var context = require.context('./__tests__/', true, /.+\.js$/); diff --git a/tempstorageworker.webpack.config.js b/tempstorageworker.webpack.config.js index ba507795..6e9baca4 100644 --- a/tempstorageworker.webpack.config.js +++ b/tempstorageworker.webpack.config.js @@ -6,7 +6,14 @@ module.exports = { }, module: { loaders: [ - { test: /\.js$/, include: /src\/js\/workers/, loader: 'babel-loader' }//, + { + test: /\.js$/, + include: /src\/js\/workers/, + loader: 'babel-loader', + query: { + presets: ['es2015', 'stage-0', 'react'] + } + } ] }, node: { diff --git a/webpack.config.js b/webpack.config.js index f5679f14..84878010 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,9 +6,15 @@ module.exports = { }, module: { loaders: [ - { test: /\.js$/, include: /src/, - exclude: /src\/js\/workers/, loader: 'babel-loader' } - // { test: /\.json$/, loader: 'json-loader' } + { + test: /\.js$/, + include: /src/, + exclude: /src\/js\/workers/, + loader: 'babel-loader', + query: { + presets: ['es2015', 'stage-0', 'react'] + } + } ] }, node: {