diff options
author | Pete Richards <pete@pete-richards.com> | 2018-08-08 00:47:50 +0300 |
---|---|---|
committer | Andrew Henry <andrew.k.henry@nasa.gov> | 2018-08-08 00:47:50 +0300 |
commit | 0d53898af9797ed8e725619ecf06f88f72d31dcf (patch) | |
tree | b568f87fe087ebd853442d2b98e02ac0a787d40f /openmct.js | |
parent | 9582fb2b06bb656ef3a2298deec8434d9bc8f39b (diff) |
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.
Diffstat (limited to 'openmct.js')
-rw-r--r-- | openmct.js | 114 |
1 files changed, 22 insertions, 92 deletions
diff --git a/openmct.js b/openmct.js index ae6da66a3..1e98ace22 100644 --- a/openmct.js +++ b/openmct.js @@ -19,102 +19,32 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global requirejs,BUILD_CONSTANTS*/ +/*global module,BUILD_CONSTANTS*/ -requirejs.config({ - "paths": { - "legacyRegistry": "src/legacyRegistry", - "angular": "bower_components/angular/angular.min", - "angular-route": "bower_components/angular-route/angular-route.min", - "csv": "bower_components/comma-separated-values/csv.min", - "EventEmitter": "bower_components/eventemitter3/index", - "es6-promise": "bower_components/es6-promise/es6-promise.min", - "moment": "bower_components/moment/moment", - "moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format", - "moment-timezone": "bower_components/moment-timezone/builds/moment-timezone-with-data", - "saveAs": "bower_components/file-saver/FileSaver.min", - "screenfull": "bower_components/screenfull/dist/screenfull.min", - "text": "bower_components/text/text", - "uuid": "bower_components/node-uuid/uuid", - "vue": "node_modules/vue/dist/vue.min", - "zepto": "bower_components/zepto/zepto.min", - "lodash": "bower_components/lodash/lodash", - "d3-selection": "node_modules/d3-selection/dist/d3-selection.min", - "d3-scale": "node_modules/d3-scale/build/d3-scale.min", - "d3-axis": "node_modules/d3-axis/build/d3-axis.min", - "d3-array": "node_modules/d3-array/build/d3-array.min", - "d3-collection": "node_modules/d3-collection/build/d3-collection.min", - "d3-color": "node_modules/d3-color/build/d3-color.min", - "d3-format": "node_modules/d3-format/build/d3-format.min", - "d3-interpolate": "node_modules/d3-interpolate/build/d3-interpolate.min", - "d3-time": "node_modules/d3-time/build/d3-time.min", - "d3-time-format": "node_modules/d3-time-format/build/d3-time-format.min", - "html2canvas": "node_modules/html2canvas/dist/html2canvas.min", - "painterro": "node_modules/painterro/build/painterro.min", - "printj": "node_modules/printj/dist/printj.min" - }, - "shim": { - "angular": { - "exports": "angular" - }, - "angular-route": { - "deps": ["angular"] - }, - "EventEmitter": { - "exports": "EventEmitter" - }, - "moment-duration-format": { - "deps": ["moment"] - }, - "painterro": { - "exports": "Painterro" - }, - "saveAs": { - "exports": "saveAs" - }, - "screenfull": { - "exports": "screenfull" - }, - "zepto": { - "exports": "Zepto" - }, - "lodash": { - "exports": "lodash" - }, - "d3-selection": { - "exports": "d3-selection" - }, - "d3-scale": { - "deps": ["d3-array", "d3-collection", "d3-color", "d3-format", "d3-interpolate", "d3-time", "d3-time-format"], - "exports": "d3-scale" - }, - "d3-axis": { - "exports": "d3-axis" - }, - "dom-to-image": { - "exports": "domtoimage" - } +const matcher = /\/openmct.js$/; +if (document.currentScript) { + let src = document.currentScript.src; + if (src && matcher.test(src)) { + // eslint-disable-next-line no-undef + __webpack_public_path__ = src.replace(matcher, '') + '/'; } -}); - -define([ - './platform/framework/src/Main', - './src/defaultRegistry', - './src/MCT', - './src/plugins/buildInfo/plugin' -], function (Main, defaultRegistry, MCT, buildInfo) { - var openmct = new MCT(); +} +const Main = require('./platform/framework/src/Main'); +const defaultRegistry = require('./src/defaultRegistry'); +const MCT = require('./src/MCT'); +const buildInfo = require('./src/plugins/buildInfo/plugin'); - openmct.legacyRegistry = defaultRegistry; - openmct.install(openmct.plugins.Plot()); +var openmct = new MCT(); - if (typeof BUILD_CONSTANTS !== 'undefined') { - openmct.install(buildInfo(BUILD_CONSTANTS)); - } +openmct.legacyRegistry = defaultRegistry; +openmct.install(openmct.plugins.Plot()); - openmct.on('start', function () { - return new Main().run(defaultRegistry); - }); +if (typeof BUILD_CONSTANTS !== 'undefined') { + openmct.install(buildInfo(BUILD_CONSTANTS)); +} - return openmct; +openmct.on('start', function () { + return new Main().run(defaultRegistry); }); + +module.exports = openmct; |