Build refactor to webpack (#2139)

* Move to webpack build
* Use webpack for building openmct.  Move SCSS to one folder and load
all core css up front.  Remove bower, begin removing gulp in favor
of npm run.
* Uses eslint instead of jshint and jscs.  Merge style checking rules
into .eshintrc.js, carrying over core parts of crockford style and
our adaptations.  Current code base fails to pass the linter, want
to separate linter changes from fixes to linting rules.
* Support for Vue SFC with example
* Remove outdated examples
* Use HTML loader for html (supports relative imports of resources e.g.
images) and raw-loader for when javascript must be loaded as text.
This commit is contained in:
Pete Richards
2018-08-07 14:47:50 -07:00
committed by Andrew Henry
parent 9582fb2b06
commit 0d53898af9
355 changed files with 1910 additions and 3693 deletions

View File

@@ -31,20 +31,20 @@ define([
"./src/controllers/CompositeController",
"./src/controllers/ColorController",
"./src/controllers/DialogButtonController",
"text!./res/templates/controls/autocomplete.html",
"text!./res/templates/controls/checkbox.html",
"text!./res/templates/controls/datetime.html",
"text!./res/templates/controls/select.html",
"text!./res/templates/controls/textfield.html",
"text!./res/templates/controls/numberfield.html",
"text!./res/templates/controls/textarea.html",
"text!./res/templates/controls/button.html",
"text!./res/templates/controls/color.html",
"text!./res/templates/controls/composite.html",
"text!./res/templates/controls/menu-button.html",
"text!./res/templates/controls/dialog.html",
"text!./res/templates/controls/radio.html",
"text!./res/templates/controls/file-input.html",
"./res/templates/controls/autocomplete.html",
"./res/templates/controls/checkbox.html",
"./res/templates/controls/datetime.html",
"./res/templates/controls/select.html",
"./res/templates/controls/textfield.html",
"./res/templates/controls/numberfield.html",
"./res/templates/controls/textarea.html",
"./res/templates/controls/button.html",
"./res/templates/controls/color.html",
"./res/templates/controls/composite.html",
"./res/templates/controls/menu-button.html",
"./res/templates/controls/dialog.html",
"./res/templates/controls/radio.html",
"./res/templates/controls/file-input.html",
'legacyRegistry'
], function (
MCTForm,

View File

@@ -35,8 +35,8 @@ define(
function setText(fileName) {
scope.structure.text = fileName.length > 20 ?
fileName.substr(0, 20) + "..." :
fileName;
fileName.substr(0, 20) + "..." :
fileName;
}
function handleClick() {

View File

@@ -26,7 +26,7 @@
* @namespace platform/forms
*/
define(
["./controllers/FormController", "text!../res/templates/form.html"],
["./controllers/FormController", "../res/templates/form.html"],
function (FormController, formTemplate) {
/**

View File

@@ -26,7 +26,7 @@
define(
[
"./MCTForm",
"text!../res/templates/toolbar.html",
"../res/templates/toolbar.html",
"./controllers/ToolbarController"
],
function (

View File

@@ -33,10 +33,10 @@ define(
function AutocompleteController($scope, $element) {
var key = {
down: 40,
up: 38,
enter: 13
},
down: 40,
up: 38,
enter: 13
},
autocompleteInputElement = $element[0].getElementsByClassName('autocompleteInput')[0];
if ($scope.options[0].name) {
@@ -86,17 +86,17 @@ define(
if ($scope.filteredOptions) {
var keyCode = $event.keyCode;
switch (keyCode) {
case key.down:
incrementOptionIndex();
break;
case key.up:
$event.preventDefault(); // Prevents cursor jumping back and forth
decrementOptionIndex();
break;
case key.enter:
if ($scope.filteredOptions[$scope.optionIndex]) {
fillInputWithString($scope.filteredOptions[$scope.optionIndex].name);
}
case key.down:
incrementOptionIndex();
break;
case key.up:
$event.preventDefault(); // Prevents cursor jumping back and forth
decrementOptionIndex();
break;
case key.enter:
if ($scope.filteredOptions[$scope.optionIndex]) {
fillInputWithString($scope.filteredOptions[$scope.optionIndex].name);
}
}
}
};

View File

@@ -48,9 +48,9 @@ define(
function toGradient(triplet, value) {
return triplet.map(function (v) {
return Math.round(value > 0 ?
(v + (255 - v) * value) :
(v * (1 + value))
);
(v + (255 - v) * value) :
(v * (1 + value))
);
});
}

View File

@@ -44,9 +44,9 @@ define(
min = $scope.datetime.min,
sec = $scope.datetime.sec,
fullDateTime = moment.utc(date, DATE_FORMAT)
.hour(hour || 0)
.minute(min || 0)
.second(sec || 0);
.hour(hour || 0)
.minute(min || 0)
.second(sec || 0);
if (fullDateTime.isValid()) {
$scope.ngModel[$scope.field] = fullDateTime.valueOf();
@@ -97,7 +97,7 @@ define(
// Initialize forms values
updateDateTime(
($scope.ngModel && $scope.field) ?
$scope.ngModel[$scope.field] : undefined
$scope.ngModel[$scope.field] : undefined
);
}

View File

@@ -41,8 +41,8 @@ define(
['getInput']
);
mockScope = jasmine.createSpyObj(
'$scope',
['$watch']
'$scope',
['$watch']
);
mockScope.structure = {text: 'Select File'};

View File

@@ -49,7 +49,7 @@ define([
it("filters options by returning array containing optionId and name", function () {
mockScope.filterOptions('Asia');
var filteredOptions = [{ optionId : 0, name : 'Asia/Dhaka' },
{ optionId : 1, name : 'Asia/Shanghai' }];
{ optionId : 1, name : 'Asia/Shanghai' }];
expect(mockScope.filteredOptions).toEqual(filteredOptions);
});