Skip to content

Commit

Permalink
Merge pull request #558 from mesosphere/refactor/convert-commonjs-to-…
Browse files Browse the repository at this point in the history
…es6-modules

Refactor/convert commonjs to es6 modules
  • Loading branch information
Pierluigi Cau committed Jan 20, 2016
2 parents 6b28cc3 + 916c87c commit f658244
Show file tree
Hide file tree
Showing 158 changed files with 981 additions and 1,003 deletions.
29 changes: 23 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
var autoprefixer = require("gulp-autoprefixer");
var connect = require("gulp-connect");
var header = require('gulp-header');
var header = require("gulp-header");
var browserSync = require("browser-sync");
var eslintFormatter = require("eslint/lib/formatters/stylish");
var gulp = require("gulp");
var gutil = require("gulp-util");
var less = require("gulp-less");
var minifyCSS = require("gulp-minify-css");
var path = require("path");
var fs = require("fs");
var replace = require("gulp-replace");
var uglify = require("gulp-uglify");
var webpack = require("webpack");
Expand Down Expand Up @@ -40,8 +41,17 @@ var files = {
};

var webpackWatch = false;
var configFilePath = path.resolve(dirs.js + "/config/config.js");
if (process.env.GULP_ENV === "development") {
webpackWatch = true;
try {
var devConfigFilePath = path.resolve(dirs.js + "/config/config.dev.js");
fs.accessSync(devConfigFilePath);
configFilePath = devConfigFilePath;
} catch (e) {
console.info("You could copy config.template.js to config.dev.js " +
"to enable a development configuration.");
}
}

var webpackConfig = {
Expand Down Expand Up @@ -83,6 +93,13 @@ var webpackConfig = {
}
]
},
plugins: [
new webpack.NormalModuleReplacementPlugin(/\/config\/config(\.js)?$/,
function (result) {
result.request = configFilePath;
}
)
],
resolve: {
extensions: ["", ".jsx", ".js"]
},
Expand Down Expand Up @@ -159,7 +176,7 @@ gulp.task("minify-js", ["webpack"], function () {

return gulp.src(dirs.dist + "/" + files.mainJs + ".js")
.pipe(uglify())
.pipe(header(banner, { pkg : packageInfo } ))
.pipe(header(banner, {pkg : packageInfo}))
.pipe(gulp.dest(dirs.dist));
});

Expand All @@ -170,10 +187,10 @@ gulp.task("images", function () {

gulp.task("fonts", function () {
return gulp.src([
dirs.ionicons + "/**/*.*",
dirs.sourceSansPro + "/" + files.sourceSansPro,
dirs.sourceSansPro + "/" + files.sourceSansProBold
]).pipe(gulp.dest(dirs.dist + "/" + dirs.fontsDist));
dirs.ionicons + "/**/*.*",
dirs.sourceSansPro + "/" + files.sourceSansPro,
dirs.sourceSansPro + "/" + files.sourceSansProBold
]).pipe(gulp.dest(dirs.dist + "/" + dirs.fontsDist));
});

gulp.task("index", function () {
Expand Down
5 changes: 3 additions & 2 deletions src/js/AppDispatcher.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
var dispatcher = new (require("flux").Dispatcher)();
import {Dispatcher} from "flux";

var dispatcher = new Dispatcher();
dispatcher.dispatchNext = function (obj) {
setTimeout(function () {
dispatcher.dispatch(obj);
});
};

module.exports = dispatcher;
export default dispatcher;
11 changes: 6 additions & 5 deletions src/js/actions/AppVersionsActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var AppVersionsEvents = require("../events/AppVersionsEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import AppVersionsEvents from "../events/AppVersionsEvents";

var AppVersionsActions = {
requestAppVersions: function (appId) {
Expand Down Expand Up @@ -48,4 +49,4 @@ var AppVersionsActions = {
request: ajaxWrapper
};

module.exports = AppVersionsActions;
export default AppVersionsActions;
11 changes: 6 additions & 5 deletions src/js/actions/AppsActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var AppsEvents = require("../events/AppsEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import AppsEvents from "../events/AppsEvents";

var AppsActions = {
requestApps: function () {
Expand Down Expand Up @@ -187,4 +188,4 @@ var AppsActions = {
request: ajaxWrapper
};

module.exports = AppsActions;
export default AppsActions;
8 changes: 4 additions & 4 deletions src/js/actions/DCOSActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var AppDispatcher = require("../AppDispatcher");
var ajaxWrapper = require("../helpers/ajaxWrapper");
var DCOSEvents = require("../events/DCOSEvents");
import AppDispatcher from "../AppDispatcher";
import ajaxWrapper from "../helpers/ajaxWrapper";
import DCOSEvents from "../events/DCOSEvents";

var DCOSActions = {
requestBuildInformation: function (host) {
Expand All @@ -21,4 +21,4 @@ var DCOSActions = {
request: ajaxWrapper
};

module.exports = DCOSActions;
export default DCOSActions;
11 changes: 6 additions & 5 deletions src/js/actions/DeploymentActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var DeploymentEvents = require("../events/DeploymentEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import DeploymentEvents from "../events/DeploymentEvents";

var DeploymentActions = {
requestDeployments: function () {
Expand Down Expand Up @@ -63,4 +64,4 @@ var DeploymentActions = {
request: ajaxWrapper
};

module.exports = DeploymentActions;
export default DeploymentActions;
12 changes: 6 additions & 6 deletions src/js/actions/DialogActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var Util = require("../helpers/Util");
var AppDispatcher = require("../AppDispatcher");
var DialogEvents = require("../events/DialogEvents");
var DialogTypes = require("../constants/DialogTypes");
var dialogScheme = require("../stores/schemes/dialogScheme");
import Util from "../helpers/Util";
import AppDispatcher from "../AppDispatcher";
import DialogEvents from "../events/DialogEvents";
import DialogTypes from "../constants/DialogTypes";
import dialogScheme from "../stores/schemes/dialogScheme";

function showDialog(data) {
var dialog = Util.extendObject(dialogScheme, data,
Expand Down Expand Up @@ -86,4 +86,4 @@ var DialogActions = {
}
};

module.exports = DialogActions;
export default DialogActions;
6 changes: 3 additions & 3 deletions src/js/actions/FormActions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var AppDispatcher = require("../AppDispatcher");
var FormsEvents = require("../events/FormEvents");
import AppDispatcher from "../AppDispatcher";
import FormsEvents from "../events/FormEvents";

var FormActions = {
insert: function (fieldId, value, index = null) {
Expand Down Expand Up @@ -28,4 +28,4 @@ var FormActions = {
}
};

module.exports = FormActions;
export default FormActions;
11 changes: 6 additions & 5 deletions src/js/actions/GroupsActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var GroupsEvents = require("../events/GroupsEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import GroupsEvents from "../events/GroupsEvents";

var GroupsActions = {
scaleGroup: function (groupId, scaleBy) {
Expand Down Expand Up @@ -50,4 +51,4 @@ var GroupsActions = {
request: ajaxWrapper
};

module.exports = GroupsActions;
export default GroupsActions;
11 changes: 6 additions & 5 deletions src/js/actions/InfoActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var InfoEvents = require("../events/InfoEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import InfoEvents from "../events/InfoEvents";

var InfoActions = {
requestInfo: function () {
Expand All @@ -25,4 +26,4 @@ var InfoActions = {
request: ajaxWrapper
};

module.exports = InfoActions;
export default InfoActions;
10 changes: 5 additions & 5 deletions src/js/actions/MesosActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var semver = require("semver");
import semver from "semver";

var AppDispatcher = require("../AppDispatcher");
var JSONPUtil = require("../helpers/JSONPUtil");
var MesosEvents = require("../events/MesosEvents");
import AppDispatcher from "../AppDispatcher";
import JSONPUtil from "../helpers/JSONPUtil";
import MesosEvents from "../events/MesosEvents";

var MesosActions = {
requestVersionInformation: function (host) {
Expand Down Expand Up @@ -76,4 +76,4 @@ var MesosActions = {
request: JSONPUtil.request
};

module.exports = MesosActions;
export default MesosActions;
11 changes: 6 additions & 5 deletions src/js/actions/QueueActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var QueueEvents = require("../events/QueueEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import QueueEvents from "../events/QueueEvents";

var QueueActions = {
requestQueue: function () {
Expand Down Expand Up @@ -44,4 +45,4 @@ var QueueActions = {
request: ajaxWrapper
};

module.exports = QueueActions;
export default QueueActions;
11 changes: 6 additions & 5 deletions src/js/actions/TasksActions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var ajaxWrapper = require("../helpers/ajaxWrapper");
import ajaxWrapper from "../helpers/ajaxWrapper";

var config = require("../config/config");
var AppDispatcher = require("../AppDispatcher");
var TasksEvents = require("../events/TasksEvents");
import config from "../config/config";

import AppDispatcher from "../AppDispatcher";
import TasksEvents from "../events/TasksEvents";

var TasksActions = {
deleteTasks: function (appId, taskIds = []) {
Expand Down Expand Up @@ -57,4 +58,4 @@ var TasksActions = {
request: ajaxWrapper
};

module.exports = TasksActions;
export default TasksActions;
12 changes: 6 additions & 6 deletions src/js/components/AlertDialogComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var React = require("react/addons");
var classNames = require("classnames");
import React from "react/addons";
import classNames from "classnames";

var DialogSeverity = require("../constants/DialogSeverity");
var Util = require("../helpers/Util");
var ModalComponent = require("../components/ModalComponent");
import DialogSeverity from "../constants/DialogSeverity";
import Util from "../helpers/Util";
import ModalComponent from "../components/ModalComponent";

var AlertDialogComponent = React.createClass({
displayName: "AlertDialogComponent",
Expand Down Expand Up @@ -64,4 +64,4 @@ var AlertDialogComponent = React.createClass({
}
});

module.exports = AlertDialogComponent;
export default AlertDialogComponent;
22 changes: 10 additions & 12 deletions src/js/components/AppDebugInfoComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
var React = require("react/addons");
var Moment = require("moment");

var AppsStore = require("../stores/AppsStore");
var AppsActions = require("../actions/AppsActions");
var AppsEvents = require("../events/AppsEvents");
var AppTaskStatsListComponent =
require("../components/AppTaskStatsListComponent");
var TaskMesosUrlComponent = require("../components/TaskMesosUrlComponent");
var UnspecifiedNodeComponent =
require("../components/UnspecifiedNodeComponent");
import React from "react/addons";
import Moment from "moment";

import AppsStore from "../stores/AppsStore";
import AppsActions from "../actions/AppsActions";
import AppsEvents from "../events/AppsEvents";
import AppTaskStatsListComponent from "../components/AppTaskStatsListComponent";
import TaskMesosUrlComponent from "../components/TaskMesosUrlComponent";
import UnspecifiedNodeComponent from "../components/UnspecifiedNodeComponent";

function invalidateValue(value, suffix) {
if (value == null || value === "") {
Expand Down Expand Up @@ -170,4 +168,4 @@ var AppDebugInfoComponent = React.createClass({
}
});

module.exports = AppDebugInfoComponent;
export default AppDebugInfoComponent;
8 changes: 4 additions & 4 deletions src/js/components/AppHealthBarComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var classNames = require("classnames");
var React = require("react/addons");
var AppStatus = require("../constants/AppStatus");
import classNames from "classnames";
import React from "react/addons";
import AppStatus from "../constants/AppStatus";

function roundWorkaround(x) {
return Math.floor(x * 1000) / 1000;
Expand Down Expand Up @@ -64,4 +64,4 @@ var AppHealthBarComponent = React.createClass({

});

module.exports = AppHealthBarComponent;
export default AppHealthBarComponent;
14 changes: 7 additions & 7 deletions src/js/components/AppHealthBarWithTooltipComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var React = require("react/addons");
import React from "react/addons";

var AppHealthBarComponent = require("./AppHealthBarComponent");
var AppHealthDetailComponent = require("./AppHealthDetailComponent");
var PopoverComponent = require("./PopoverComponent");
var Util = require("../helpers/Util");
var HealthStatus = require("../constants/HealthStatus");
import AppHealthBarComponent from "./AppHealthBarComponent";
import AppHealthDetailComponent from "./AppHealthDetailComponent";
import PopoverComponent from "./PopoverComponent";
import Util from "../helpers/Util";
import HealthStatus from "../constants/HealthStatus";

var AppHealthBarWithTooltipComponent = React.createClass({
displayName: "AppHealthBarWithTooltipComponent",
Expand Down Expand Up @@ -62,4 +62,4 @@ var AppHealthBarWithTooltipComponent = React.createClass({
}
});

module.exports = AppHealthBarWithTooltipComponent;
export default AppHealthBarWithTooltipComponent;
Loading

0 comments on commit f658244

Please sign in to comment.