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

@@ -52,7 +52,7 @@ define(
// Convert to an array if necessary
categories = Array.isArray(categories) ?
categories : [categories];
categories : [categories];
// Store action under all relevant categories
categories.forEach(function (category) {

View File

@@ -62,7 +62,7 @@ define(
CompositionCapability.prototype.add = function (domainObject, index) {
var self = this,
id = typeof domainObject === 'string' ?
domainObject : domainObject.getId(),
domainObject : domainObject.getId(),
model = self.domainObject.getModel(),
composition = model.composition,
oldIndex = composition.indexOf(id);
@@ -104,7 +104,7 @@ define(
}
return this.domainObject.useCapability('mutation', addIdToModel)
.then(contextualize);
.then(contextualize);
};
/**

View File

@@ -82,7 +82,7 @@ define(
parentContext =
parentObject && parentObject.getCapability('context'),
parentPath = parentContext ?
parentContext.getPath() : [this.parentObject];
parentContext.getPath() : [this.parentObject];
return parentPath.concat([this.domainObject]);
};
@@ -102,8 +102,8 @@ define(
this.parentObject.getCapability('context');
return parentContext ?
parentContext.getRoot() :
(this.parentObject || this.domainObject);
parentContext.getRoot() :
(this.parentObject || this.domainObject);
};
return ContextCapability;

View File

@@ -54,8 +54,8 @@ define(
// Intercept requests for a context capability.
contextualObject.getCapability = function (name) {
return name === "context" ?
contextCapability :
domainObject.getCapability.apply(this, arguments);
contextCapability :
domainObject.getCapability.apply(this, arguments);
};
return contextualObject;

View File

@@ -56,8 +56,8 @@ define(
function filterCapabilities(model, id) {
return capabilities.filter(function (capability) {
return capability.appliesTo ?
capability.appliesTo(model, id) :
true;
capability.appliesTo(model, id) :
true;
});
}

View File

@@ -91,10 +91,10 @@ define(
}
return this.doesDelegateCapability(key) ?
promiseChildren().then(
filterObjectsWithCapability(key)
) :
this.$q.when([]);
promiseChildren().then(
filterObjectsWithCapability(key)
) :
this.$q.when([]);
};
/**

View File

@@ -48,8 +48,8 @@ define(
function formatTimestamp(timestamp) {
return typeof timestamp === 'number' ?
(moment.utc(timestamp).format(TIME_FORMAT) + " UTC") :
undefined;
(moment.utc(timestamp).format(TIME_FORMAT) + " UTC") :
undefined;
}
function getProperties() {

View File

@@ -168,9 +168,9 @@ define(
}
return this.persistenceService.readObject(
this.getSpace(),
this.getKey()
).then(updateModel);
this.getSpace(),
this.getKey()
).then(updateModel);
};
/**

View File

@@ -67,7 +67,7 @@ define(
// Load a single object model from any persistence spaces
function loadModel(parsedId) {
return persistenceService
.readObject(parsedId.space, parsedId.key);
.readObject(parsedId.space, parsedId.key);
}
// Ensure that models read from persistence have some
@@ -75,7 +75,7 @@ define(
function addPersistedTimestamp(model) {
if (model && (model.persisted === undefined)) {
model.persisted = model.modified !== undefined ?
model.modified : now();
model.modified : now();
}
return model;
@@ -112,8 +112,8 @@ define(
parsedIds = ids.map(function (id) {
var parts = id.split(":");
return (parts.length > 1) ?
{ id: id, space: parts[0], key: parts.slice(1).join(":") } :
{ id: id, space: defaultSpace, key: id };
{ id: id, space: parts[0], key: parts.slice(1).join(":") } :
{ id: id, space: defaultSpace, key: id };
});
return persistenceService.listSpaces()

View File

@@ -76,8 +76,8 @@ define(
var result = {};
Object.keys(a).forEach(function (k) {
result[k] = b.hasOwnProperty(k) ?
mergeModels(a[k], b[k], (merger || {})[k]) :
a[k];
mergeModels(a[k], b[k], (merger || {})[k]) :
a[k];
});
Object.keys(b).forEach(function (k) {
// Copy any properties not already merged
@@ -93,9 +93,9 @@ define(
}
mergeFunction = (merger && Function.isFunction(merger)) ? merger :
(Array.isArray(modelA) && Array.isArray(modelB)) ? mergeArrays :
(modelA instanceof Object && modelB instanceof Object) ? mergeObjects :
mergeOther;
(Array.isArray(modelA) && Array.isArray(modelB)) ? mergeArrays :
(modelA instanceof Object && modelB instanceof Object) ? mergeObjects :
mergeOther;
return mergeFunction(modelA, modelB);
}

View File

@@ -29,7 +29,7 @@ define(
toModelValue: parseFloat,
toFormValue: function (modelValue) {
return (typeof modelValue === 'number') ?
modelValue.toString(10) : undefined;
modelValue.toString(10) : undefined;
}
},
identity: {

View File

@@ -63,8 +63,8 @@ define(
}
return set[element] ?
false :
(set[element] = true);
false :
(set[element] = true);
}) : array;
}

View File

@@ -149,10 +149,10 @@ define(
// Second, filter by matching capabilities.
return this.views.filter(function (view) {
return viewMatchesType(view, type) && capabilitiesMatch(
domainObject,
view.needs || [],
view.delegation || false
);
domainObject,
view.needs || [],
view.delegation || false
);
});
};

View File

@@ -62,7 +62,7 @@ define(
return {
then: function (callback) {
return value.then ?
value : mockPromise(callback(value));
value : mockPromise(callback(value));
}
};
}

View File

@@ -75,12 +75,12 @@ define(
it("uses instantiate and contextualize to create domain objects", function () {
var mockDomainObj = jasmine.createSpyObj('domainObject', [
'getId',
'getModel',
'getCapability',
'useCapability',
'hasCapability'
]), testModel = { someKey: "some value" };
'getId',
'getModel',
'getCapability',
'useCapability',
'hasCapability'
]), testModel = { someKey: "some value" };
mockInstantiate.and.returnValue(mockDomainObj);
instantiation.instantiate(testModel);
expect(mockInstantiate)

View File

@@ -55,9 +55,9 @@ define(
);
mockProperties = ['a', 'b', 'c'].map(function (k) {
var mockProperty = jasmine.createSpyObj(
'property-' + k,
['getValue', 'getDefinition']
);
'property-' + k,
['getValue', 'getDefinition']
);
mockProperty.getValue.and.returnValue("Value " + k);
mockProperty.getDefinition.and.returnValue({ name: "Property " + k});
return mockProperty;

View File

@@ -173,10 +173,10 @@ define(
describe("unsuccessful persistence", function () {
var sadPromise = {
then: function (callback) {
return asPromise(callback(0), true);
}
};
then: function (callback) {
return asPromise(callback(0), true);
}
};
beforeEach(function () {
mockPersistenceService.createObject.and.returnValue(sadPromise);
});

View File

@@ -102,9 +102,9 @@ define(
it("adds to the active transaction", function () {
expect(mockTransactionService.addToTransaction)
.toHaveBeenCalledWith(
jasmine.any(Function),
jasmine.any(Function)
);
jasmine.any(Function),
jasmine.any(Function)
);
});
it(innerVerb + " immediately commit", function () {

View File

@@ -48,10 +48,11 @@ define(
});
it("throws exceptions on unrecognized conversions", function () {
var caught = false, tmp;
var caught = false;
try {
tmp = new TypePropertyConversion("some-unknown-conversion");
// eslint-disable-next-line
new TypePropertyConversion("some-unknown-conversion");
} catch (e) {
caught = true;
}