From 6366815b03c3cbf28aed5bf1d1e0a42933c0a1c4 Mon Sep 17 00:00:00 2001 From: David Kebler Date: Wed, 11 Jan 2017 15:11:34 -0800 Subject: [PATCH] initial commit --- .gitignore | 2 ++ .jshglobals | 13 ++++++++ .jshintrc | 70 ++++++++++++++++++++++++++++++++++++++++++++ .npmignore | 4 +++ .travis.yml | 14 +++++++++ index.js | 8 +++++ lib/amodule.js | 1 + package.json | 36 +++++++++++++++++++++++ readme.md | 22 ++++++++++++++ test/amodule.test.js | 17 +++++++++++ 10 files changed, 187 insertions(+) create mode 100644 .gitignore create mode 100644 .jshglobals create mode 100644 .jshintrc create mode 100644 .npmignore create mode 100644 .travis.yml create mode 100644 index.js create mode 100644 lib/amodule.js create mode 100644 package.json create mode 100644 readme.md create mode 100644 test/amodule.test.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e61051f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +/coverage/ diff --git a/.jshglobals b/.jshglobals new file mode 100644 index 0000000..db4fe74 --- /dev/null +++ b/.jshglobals @@ -0,0 +1,13 @@ +{ +"globals": { + "Debug" : true, + /* MOCHA */ +"describe" : false, +"it" : false, +"xit" : false, +"before" : false, +"beforeEach" : false, +"after" : false, +"afterEach" : false + } +} diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..29bdf7a --- /dev/null +++ b/.jshintrc @@ -0,0 +1,70 @@ +{ + // https://gist.github.com/connor/1597131 + + // Globals - import repo spectific globals + + "extends": "./.jshglobals", + + // Settings + "passfail" : false, // Stop on first error. + "maxerr" : 100, // Maximum error before stopping. + + // Predefined globals whom JSHint will ignore. + "browser" : true, // Standard browser globals e.g. `window`, `document`. + "node" : true, + "rhino" : false, + "couch" : false, + "wsh" : true, // Windows Scripting Host. + + "jquery" : true, + "prototypejs" : false, + "mootools" : false, + "dojo" : false, + + + // Development. + "debug" : false, // Allow debugger statements e.g. browser breakpoints. + "devel" : true, // Allow developments statements e.g. `console.log();`. + + + // ECMAScript + "esversion" : 6, //use this in new version of jshint + "strict" : false, // Require `use strict` pragma in every file. + "globalstrict" : false, // Allow global "use strict" (also enables 'strict'). + + + // The Good Parts. + "asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons). + "laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. + "bitwise" : true, // Allow bitwise operators (&, |, ^, etc.). + "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. + "curly" : true, // Require {} for every new block or scope. + "eqeqeq" : true, // Require triple equals i.e. `===`. + "eqnull" : false, // Tolerate use of `== null`. + "evil" : false, // Tolerate use of `eval`. + "expr" : false, // Tolerate `ExpressionStatement` as Programs. + "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. + "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` + "latedef" : false, // Prohipit variable use before definition. + "loopfunc" : false, // Allow functions to be defined within loops. + "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. + "regexp" : true, // Prohibit `.` and `[^...]` in regular expressions. + "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. + "scripturl" : true, // Tolerate script-targeted URLs. + "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. + "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. + "undef" : true, // Require all non-global variables be declared before they are used. + + + // Personal styling preferences. + "newcap" : false, // Require capitalization of all constructor functions e.g. `new F()`. + "noempty" : true, // Prohibit use of empty blocks. + "nonew" : true, // Prohibit use of constructors for side-effects. + "nomen" : true, // Prohibit use of initial or trailing underbars in names. + "onevar" : false, // Allow only one `var` statement per function. + "plusplus" : false, // Prohibit use of `++` & `--`. + "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. + "trailing" : true, // Prohibit trailing whitespaces. + "white" : false, // Check against strict whitespace and indentation rules. + "indent" : 2 // Specify indentation spacing +} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..f16fc41 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +tests/ +test/ +*.test.js +testing/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8ffd227 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: node_js + +node_js: + - '4.0' + - '5.0' + - '6.0' + - 'node' + +sudo: false + +script: npm test + +after_success: + - bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" diff --git a/index.js b/index.js new file mode 100644 index 0000000..90ae21c --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +let opts = { + dirname: __dirname + '/lib', + // http://stackoverflow.com/questions/2078915/a-regular-expression-to-exclude-a-word-string + filter: /^(?!index)([^\.].*)\.js?$/, + recursive: false, + merge: true // remove or comment to have each file in /lib be a prop/key in library...see node-require-all +} +module.exports = require('require-all')(opts); diff --git a/lib/amodule.js b/lib/amodule.js new file mode 100644 index 0000000..6615b2d --- /dev/null +++ b/lib/amodule.js @@ -0,0 +1 @@ +module.exports.hello = function (what) { return 'Hello ' + what } diff --git a/package.json b/package.json new file mode 100644 index 0000000..052efb9 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "uci-template-changeme", + "version": "0.0.1", + "description": "A template for a starting a uci package", + "main": "index.js", + "scripts": { + "testw": "./node_modules/.bin/mocha --reporter list --recursive --watch", + "test": "istanbul cover ./node_modules/.bin/_mocha test/ --report lcovonly -- -R spec --recursive && codecov || true" + }, + "author": "David Kebler", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/uCOMmandIt/uci-pkg-template.git" + }, + "keywords": [ + "node.js", + "communication", + "serial", + "utilities", + "helpers" + ], + "bugs": { + "url": "https://github.com/uCOMmandIt/utilities/issues" + }, + "homepage": "https://github.com/uCOMmandIt/utilities#readme", + "dependencies": { + "require-all": "git+https://github.com/dkebler/node-require-all.git#merge" + }, + "devDependencies": { + "chai": "^3.5.0", + "codecov": "^1.0.1", + "istanbul": "^0.4.5", + "mocha": "^3.2.0" + } +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..5780e89 --- /dev/null +++ b/readme.md @@ -0,0 +1,22 @@ +# uCOMmandIt Template Package Repository + + +[![Build Status](https://img.shields.io/travis/uCOMmandIt/uci-pkg-template.svg?branch=master)](https://travis-ci.org/uCOMmandIt/uci-pkg-template) +[![Inline docs](http://inch-ci.org/github/uCOMmandIt/uci-pkg-template.svg?branch=master)](http://inch-ci.org/github/uCOMmandIt/uci-pkg-template) +[![Dependencies](https://img.shields.io/david/uCOMmandIt/uci-pkg-template.svg)](https://david-dm.org/uCOMmandIt/uci-pkg-template) +[![devDependencies](https://img.shields.io/david/dev/uCOMmandIt/uci-pkg-template.svg)](https://david-dm.org/uCOMmandIt/uci-pkg-template?type=dev) +[![codecov](https://img.shields.io/codecov/c/github/uCOMmandIt/uci-pkg-template/master.svg)](https://codecov.io/gh/uCOMmandIt/uci-pkg-template) + +Clone this to get a quick start on a new uci package. It has all the testing ready to go with Travis-CI and code coverage. All the readme badges are included as well + +Clone it for as a starting place for your own package! + +You'll need codecov and travis-ci accounts + +##Steps + +1. Clone repo +2. Edit package.json +3. Edit badge urls changing to your repo path +4. Run npm install +5. Open a github diff --git a/test/amodule.test.js b/test/amodule.test.js new file mode 100644 index 0000000..7d681f9 --- /dev/null +++ b/test/amodule.test.js @@ -0,0 +1,17 @@ +'use strict' + +//time-stamp for use when watching to distinguish reruns in console +// place in alpha first file only +let date = new Date(Date.now()) +console.log(date.getMinutes(), "\:", date.getSeconds()) + +const expect = require('chai').expect, + lib = require('../') + +describe('A template module ', function () { + + it('Should ....', function () { + expect(lib.hello('Forest Gump')).to.equal('Hello Forest Gump') + }) + +})