mirror of
https://github.com/nasa/openmct.git
synced 2025-02-02 09:18:20 +00:00
[Packaging] Create NPM Package
Create NPM package for OpenMCTWeb. Includes scripts for hosting, running tests, and building documentation.
This commit is contained in:
parent
2e2e7ee876
commit
e7e79f41a7
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,4 +19,3 @@ closed-lib
|
||||
|
||||
# Node dependencies
|
||||
node_modules
|
||||
|
||||
|
10
jsdoc.json
Normal file
10
jsdoc.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"source": {
|
||||
"include": [
|
||||
"example/",
|
||||
"platform/"
|
||||
],
|
||||
"includePattern": "(example|platform)/.+\\.js$",
|
||||
"excludePattern": ".+\\Spec\\.js$|lib/.+"
|
||||
}
|
||||
}
|
56
karma.conf.js
Normal file
56
karma.conf.js
Normal file
@ -0,0 +1,56 @@
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// Base path that will be used to resolve all file patterns.
|
||||
basePath: '',
|
||||
|
||||
// Frameworks to use
|
||||
// Available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['jasmine', 'requirejs'],
|
||||
|
||||
// List of files / patterns to load in the browser.
|
||||
// By default, files are also included in a script tag.
|
||||
files: [
|
||||
'**/moment*',
|
||||
{pattern: 'example/**/*.js', included: false},
|
||||
{pattern: 'platform/**/*.js', included: false},
|
||||
{pattern: 'warp/**/*.js', included: false},
|
||||
'test-main.js'
|
||||
],
|
||||
|
||||
// List of files to exclude.
|
||||
exclude: [
|
||||
'platform/framework/src/Main.js'
|
||||
],
|
||||
|
||||
// Preprocess matching files before serving them to the browser.
|
||||
// https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {},
|
||||
|
||||
// Test results reporter to use
|
||||
// Possible values: 'dots', 'progress'
|
||||
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
// Web server port.
|
||||
port: 9876,
|
||||
|
||||
// Wnable / disable colors in the output (reporters and logs).
|
||||
colors: true,
|
||||
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// Rerun tests when any file changes.
|
||||
autoWatch: true,
|
||||
|
||||
// Specify browsers to run tests in.
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: [
|
||||
'Chrome'
|
||||
],
|
||||
|
||||
// Continuous Integration mode.
|
||||
// If true, Karma captures browsers, runs the tests and exits.
|
||||
singleRun: false
|
||||
});
|
||||
};
|
33
package.json
Normal file
33
package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "open-mct-web",
|
||||
"version": "0.7.2",
|
||||
"description": "The OpenMCTWeb core platform",
|
||||
"dependencies": {
|
||||
"express": "^4.13.1",
|
||||
"minimist": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jasmine-core": "^2.3.0",
|
||||
"jsdoc": "^3.3.2",
|
||||
"jshint": "^2.7.0",
|
||||
"karma": "^0.12.31",
|
||||
"karma-chrome-launcher": "^0.1.8",
|
||||
"karma-cli": "0.0.4",
|
||||
"karma-jasmine": "^0.1.5",
|
||||
"karma-phantomjs-launcher": "^0.1.4",
|
||||
"karma-requirejs": "^0.2.2",
|
||||
"requirejs": "^2.1.17"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"test": "karma start --single-run",
|
||||
"jshint": "jshint platform example || exit 0",
|
||||
"jsdoc": "jsdoc -c jsdoc.json -r -d docs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nasa/openmctweb.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0"
|
||||
}
|
40
test-main.js
Normal file
40
test-main.js
Normal file
@ -0,0 +1,40 @@
|
||||
var allTestFiles = [];
|
||||
var TEST_REGEXP = /(Spec)\.js$/;
|
||||
|
||||
var pathToModule = function(path) {
|
||||
return path.replace(/^\/base\//, '').replace(/\.js$/, '');
|
||||
};
|
||||
|
||||
Object.keys(window.__karma__.files).forEach(function(file) {
|
||||
if (TEST_REGEXP.test(file)) {
|
||||
// Normalize paths to RequireJS module names.
|
||||
allTestFiles.push(pathToModule(file));
|
||||
}
|
||||
});
|
||||
|
||||
// We will be handling es6-promise loading with a shim.
|
||||
allTestFiles.unshift('es6-promise');
|
||||
|
||||
require.config({
|
||||
// Karma serves files from the basePath defined in karma.conf.js
|
||||
baseUrl: '/base',
|
||||
|
||||
paths: {
|
||||
'es6-promise': 'platform/framework/lib/es6-promise-2.0.0.min',
|
||||
'moment-duration-format': 'warp/clock/lib/moment-duration-format'
|
||||
},
|
||||
shim: {
|
||||
'es6-promise': {
|
||||
init: function () {
|
||||
console.log('I was inited!');
|
||||
window.Promise = window.Promise || ES6Promise.Promise;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// dynamically load all test files
|
||||
deps: allTestFiles,
|
||||
|
||||
// we have to kickoff jasmine, as it is asynchronous
|
||||
callback: window.__karma__.start
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user