Add simple -watch command (lime update/build/test <target> -watch)

This commit is contained in:
Joshua Granick
2018-01-12 14:00:52 -08:00
parent b92b7a9a14
commit e02b1cb3c1
12 changed files with 789 additions and 1 deletions

3
.gitignore vendored
View File

@@ -26,4 +26,5 @@ legacy/project/all_objs
legacy/project/obj
.vscode/settings.json
package-lock.json
node_modules
node_modules
!templates/**/node_modules

21
templates/bin/node/watch/node_modules/exec-sh/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Aleksandr Tsertkov <tsertkov@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,89 @@
var
cp = require("child_process"),
merge = require("merge");
var
sh, cmd,
defSpawnOptions = { stdio: "inherit" };
/**
* @summary Get shell program meta for current platform
* @private
* @returns {Object}
*/
function getShell(){
if (process.platform === "win32") {
return { cmd: "cmd", arg: "/C" };
} else {
return { cmd: "sh", arg: "-c" };
}
}
/**
* Callback is called with the output when the process terminates. Output is
* available when true is passed as options argument or stdio: null set
* within given options.
*
* @summary Execute shell command forwarding all stdio
* @param {String|Array} command
* @param {Object|TRUE} [options] spawn() options or TRUE to set stdio: null
* @param {Function} [callback]
* @returns {ChildProcess}
*/
function execSh(command, options, callback){
if (Array.isArray(command)) {
command = command.join(";");
}
if (options === true) {
options = { stdio: null };
}
if (typeof options === "function") {
callback = options;
options = defSpawnOptions;
} else {
options = options || {};
options = merge(true, defSpawnOptions, options);
callback = callback || function(){};
}
var
child,
stdout = "", stderr = "",
shell = getShell();
try {
child = cp.spawn(shell.cmd, [shell.arg, command], options);
} catch (e) {
callback(e, stdout, stderr);
return;
}
if (child.stdout) {
child.stdout.on("data", function(data){
stdout += data;
});
}
if (child.stderr) {
child.stderr.on("data", function(data){
stderr += data;
});
}
child.on("close", function(code){
if (code) {
var e = new Error("Shell command exit with non zero code: " + code);
e.code = code;
callback(e, stdout, stderr);
} else {
callback(null, stdout, stderr);
}
});
return child;
}
module.exports = execSh;

View File

@@ -0,0 +1,74 @@
{
"_from": "exec-sh@^0.2.0",
"_id": "exec-sh@0.2.1",
"_inBundle": false,
"_integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==",
"_location": "/exec-sh",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "exec-sh@^0.2.0",
"name": "exec-sh",
"escapedName": "exec-sh",
"rawSpec": "^0.2.0",
"saveSpec": null,
"fetchSpec": "^0.2.0"
},
"_requiredBy": [
"/watch"
],
"_resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz",
"_shasum": "163b98a6e89e6b65b47c2a28d215bc1f63989c38",
"_spec": "exec-sh@^0.2.0",
"_where": "C:\\Projects\\Personal\\SceneBuilderTest\\node_modules\\watch",
"author": {
"name": "Aleksandr Tsertkov",
"email": "tsertkov@gmail.com"
},
"bugs": {
"url": "https://github.com/tsertkov/exec-sh/issues"
},
"bundleDependencies": false,
"dependencies": {
"merge": "^1.1.3"
},
"deprecated": false,
"description": "Execute shell command forwarding all stdio.",
"devDependencies": {
"coveralls": "^2.11.2",
"istanbul": "^0.3.2",
"jsdoc": "^3.3.0-alpha8",
"jshint": "^2.5.1",
"mocha": "^1.20.1",
"sinon": "^1.10.2"
},
"homepage": "https://github.com/tsertkov/exec-sh#readme",
"keywords": [
"exec",
"spawn",
"terminal",
"console",
"shell",
"command",
"child_process"
],
"license": {
"type": "MIT",
"url": "https://github.com/tsertkov/exec-sh/blob/master/LICENSE"
},
"main": "lib/exec-sh.js",
"name": "exec-sh",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/tsertkov/exec-sh.git"
},
"scripts": {
"cover-test": "istanbul cover --dir artifacts/coverage _mocha -- --reporter spec",
"dev": "mocha --reporter spec --watch",
"jsdoc": "jsdoc --private --destination artifacts/jsdoc lib/",
"jshint": "jshint lib/ example/ test/ package.json",
"test": "npm run cover-test && npm run jshint"
},
"version": "0.2.1"
}

21
templates/bin/node/watch/node_modules/merge/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 yeikos - http://www.yeikos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

22
templates/bin/node/watch/node_modules/merge/bower.json generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "merge",
"version": "1.2.0",
"homepage": "https://github.com/yeikos/js.merge",
"authors": [
"yeikos <yeikos@gmail.com>"
],
"description": "Merge multiple objects into one, optionally creating a new cloned object. Similar to the jQuery.extend but more flexible. Works in Node.js and the browser.",
"main": "merge.js",
"keywords": [
"merge",
"recursive",
"extend",
"clone",
"object",
"browser"
],
"license": "MIT",
"ignore": [
"tests"
]
}

175
templates/bin/node/watch/node_modules/merge/merge.js generated vendored Normal file
View File

@@ -0,0 +1,175 @@
/*!
* @name JavaScript/NodeJS Merge v1.2.0
* @author yeikos
* @repository https://github.com/yeikos/js.merge
* Copyright 2014 yeikos - MIT license
* https://raw.github.com/yeikos/js.merge/master/LICENSE
*/
;(function(isNode) {
/**
* Merge one or more objects
* @param bool? clone
* @param mixed,... arguments
* @return object
*/
var Public = function(clone) {
return merge(clone === true, false, arguments);
}, publicName = 'merge';
/**
* Merge two or more objects recursively
* @param bool? clone
* @param mixed,... arguments
* @return object
*/
Public.recursive = function(clone) {
return merge(clone === true, true, arguments);
};
/**
* Clone the input removing any reference
* @param mixed input
* @return mixed
*/
Public.clone = function(input) {
var output = input,
type = typeOf(input),
index, size;
if (type === 'array') {
output = [];
size = input.length;
for (index=0;index<size;++index)
output[index] = Public.clone(input[index]);
} else if (type === 'object') {
output = {};
for (index in input)
output[index] = Public.clone(input[index]);
}
return output;
};
/**
* Merge two objects recursively
* @param mixed input
* @param mixed extend
* @return mixed
*/
function merge_recursive(base, extend) {
if (typeOf(base) !== 'object')
return extend;
for (var key in extend) {
if (typeOf(base[key]) === 'object' && typeOf(extend[key]) === 'object') {
base[key] = merge_recursive(base[key], extend[key]);
} else {
base[key] = extend[key];
}
}
return base;
}
/**
* Merge two or more objects
* @param bool clone
* @param bool recursive
* @param array argv
* @return object
*/
function merge(clone, recursive, argv) {
var result = argv[0],
size = argv.length;
if (clone || typeOf(result) !== 'object')
result = {};
for (var index=0;index<size;++index) {
var item = argv[index],
type = typeOf(item);
if (type !== 'object') continue;
for (var key in item) {
var sitem = clone ? Public.clone(item[key]) : item[key];
if (recursive) {
result[key] = merge_recursive(result[key], sitem);
} else {
result[key] = sitem;
}
}
}
return result;
}
/**
* Get type of variable
* @param mixed input
* @return string
*
* @see http://jsperf.com/typeofvar
*/
function typeOf(input) {
return ({}).toString.call(input).slice(8, -1).toLowerCase();
}
if (isNode) {
module.exports = Public;
} else {
window[publicName] = Public;
}
})(typeof module === 'object' && module && typeof module.exports === 'object' && module.exports);

View File

@@ -0,0 +1,3 @@
/*! JavaScript/NodeJS Merge v1.2.0 | Copyright 2014 yeikos - MIT license | https://github.com/yeikos/js.merge */
;(function(e){function r(e,t){if(s(e)!=="object")return t;for(var n in t){if(s(e[n])==="object"&&s(t[n])==="object"){e[n]=r(e[n],t[n])}else{e[n]=t[n]}}return e}function i(e,n,i){var o=i[0],u=i.length;if(e||s(o)!=="object")o={};for(var a=0;a<u;++a){var f=i[a],l=s(f);if(l!=="object")continue;for(var c in f){var h=e?t.clone(f[c]):f[c];if(n){o[c]=r(o[c],h)}else{o[c]=h}}}return o}function s(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}var t=function(e){return i(e===true,false,arguments)},n="merge";t.recursive=function(e){return i(e===true,true,arguments)};t.clone=function(e){var n=e,r=s(e),i,o;if(r==="array"){n=[];o=e.length;for(i=0;i<o;++i)n[i]=t.clone(e[i])}else if(r==="object"){n={};for(i in e)n[i]=t.clone(e[i])}return n};if(e){module.exports=t}else{window[n]=t}})(typeof module==="object"&&module&&typeof module.exports==="object"&&module.exports);

View File

@@ -0,0 +1,55 @@
{
"_from": "merge@^1.1.3",
"_id": "merge@1.2.0",
"_inBundle": false,
"_integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=",
"_location": "/merge",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "merge@^1.1.3",
"name": "merge",
"escapedName": "merge",
"rawSpec": "^1.1.3",
"saveSpec": null,
"fetchSpec": "^1.1.3"
},
"_requiredBy": [
"/exec-sh"
],
"_resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz",
"_shasum": "7531e39d4949c281a66b8c5a6e0265e8b05894da",
"_spec": "merge@^1.1.3",
"_where": "C:\\Projects\\Personal\\SceneBuilderTest\\node_modules\\exec-sh",
"author": {
"name": "yeikos",
"url": "http://www.yeikos.com"
},
"bugs": {
"url": "https://github.com/yeikos/js.merge/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Merge multiple objects into one, optionally creating a new cloned object. Similar to the jQuery.extend but more flexible. Works in Node.js and the browser.",
"homepage": "https://github.com/yeikos/js.merge",
"keywords": [
"merge",
"recursive",
"extend",
"clone",
"object",
"browser"
],
"license": "MIT",
"main": "merge.js",
"name": "merge",
"repository": {
"type": "git",
"url": "git+https://github.com/yeikos/js.merge.git"
},
"scripts": {
"test": "cd tests; node index.js"
},
"version": "1.2.0"
}

18
templates/bin/node/watch/node_modules/minimist/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,18 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

236
templates/bin/node/watch/node_modules/minimist/index.js generated vendored Normal file
View File

@@ -0,0 +1,236 @@
module.exports = function (args, opts) {
if (!opts) opts = {};
var flags = { bools : {}, strings : {}, unknownFn: null };
if (typeof opts['unknown'] === 'function') {
flags.unknownFn = opts['unknown'];
}
if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
flags.allBools = true;
} else {
[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
flags.bools[key] = true;
});
}
var aliases = {};
Object.keys(opts.alias || {}).forEach(function (key) {
aliases[key] = [].concat(opts.alias[key]);
aliases[key].forEach(function (x) {
aliases[x] = [key].concat(aliases[key].filter(function (y) {
return x !== y;
}));
});
});
[].concat(opts.string).filter(Boolean).forEach(function (key) {
flags.strings[key] = true;
if (aliases[key]) {
flags.strings[aliases[key]] = true;
}
});
var defaults = opts['default'] || {};
var argv = { _ : [] };
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] === undefined ? false : defaults[key]);
});
var notFlags = [];
if (args.indexOf('--') !== -1) {
notFlags = args.slice(args.indexOf('--')+1);
args = args.slice(0, args.indexOf('--'));
}
function argDefined(key, arg) {
return (flags.allBools && /^--[^=]+$/.test(arg)) ||
flags.strings[key] || flags.bools[key] || aliases[key];
}
function setArg (key, val, arg) {
if (arg && flags.unknownFn && !argDefined(key, arg)) {
if (flags.unknownFn(arg) === false) return;
}
var value = !flags.strings[key] && isNumber(val)
? Number(val) : val
;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), value);
});
}
function setKey (obj, keys, value) {
var o = obj;
keys.slice(0,-1).forEach(function (key) {
if (o[key] === undefined) o[key] = {};
o = o[key];
});
var key = keys[keys.length - 1];
if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
o[key] = value;
}
else if (Array.isArray(o[key])) {
o[key].push(value);
}
else {
o[key] = [ o[key], value ];
}
}
function aliasIsBoolean(key) {
return aliases[key].some(function (x) {
return flags.bools[x];
});
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (/^--.+=/.test(arg)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
var key = m[1];
var value = m[2];
if (flags.bools[key]) {
value = value !== 'false';
}
setArg(key, value, arg);
}
else if (/^--no-.+/.test(arg)) {
var key = arg.match(/^--no-(.+)/)[1];
setArg(key, false, arg);
}
else if (/^--.+/.test(arg)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== undefined && !/^-/.test(next)
&& !flags.bools[key]
&& !flags.allBools
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
setArg(key, next, arg);
i++;
}
else if (/^(true|false)$/.test(next)) {
setArg(key, next === 'true', arg);
i++;
}
else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
else if (/^-[^-]+/.test(arg)) {
var letters = arg.slice(1,-1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
var next = arg.slice(j+2);
if (next === '-') {
setArg(letters[j], next, arg)
continue;
}
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
setArg(letters[j], next.split('=')[1], arg);
broken = true;
break;
}
if (/[A-Za-z]/.test(letters[j])
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j+1] && letters[j+1].match(/\W/)) {
setArg(letters[j], arg.slice(j+2), arg);
broken = true;
break;
}
else {
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
}
}
var key = arg.slice(-1)[0];
if (!broken && key !== '-') {
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
&& !flags.bools[key]
&& (aliases[key] ? !aliasIsBoolean(key) : true)) {
setArg(key, args[i+1], arg);
i++;
}
else if (args[i+1] && /true|false/.test(args[i+1])) {
setArg(key, args[i+1] === 'true', arg);
i++;
}
else {
setArg(key, flags.strings[key] ? '' : true, arg);
}
}
}
else {
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
argv._.push(
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
);
}
if (opts.stopEarly) {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
}
}
Object.keys(defaults).forEach(function (key) {
if (!hasKey(argv, key.split('.'))) {
setKey(argv, key.split('.'), defaults[key]);
(aliases[key] || []).forEach(function (x) {
setKey(argv, x.split('.'), defaults[key]);
});
}
});
if (opts['--']) {
argv['--'] = new Array();
notFlags.forEach(function(key) {
argv['--'].push(key);
});
}
else {
notFlags.forEach(function(key) {
argv._.push(key);
});
}
return argv;
};
function hasKey (obj, keys) {
var o = obj;
keys.slice(0,-1).forEach(function (key) {
o = (o[key] || {});
});
var key = keys[keys.length - 1];
return key in o;
}
function isNumber (x) {
if (typeof x === 'number') return true;
if (/^0x[0-9a-f]+$/i.test(x)) return true;
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}

View File

@@ -0,0 +1,73 @@
{
"_from": "minimist@^1.2.0",
"_id": "minimist@1.2.0",
"_inBundle": false,
"_integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"_location": "/minimist",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "minimist@^1.2.0",
"name": "minimist",
"escapedName": "minimist",
"rawSpec": "^1.2.0",
"saveSpec": null,
"fetchSpec": "^1.2.0"
},
"_requiredBy": [
"/watch"
],
"_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
"_spec": "minimist@^1.2.0",
"_where": "C:\\Projects\\Personal\\SceneBuilderTest\\node_modules\\watch",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"bugs": {
"url": "https://github.com/substack/minimist/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "parse argument options",
"devDependencies": {
"covert": "^1.0.0",
"tap": "~0.4.0",
"tape": "^3.5.0"
},
"homepage": "https://github.com/substack/minimist",
"keywords": [
"argv",
"getopt",
"parser",
"optimist"
],
"license": "MIT",
"main": "index.js",
"name": "minimist",
"repository": {
"type": "git",
"url": "git://github.com/substack/minimist.git"
},
"scripts": {
"coverage": "covert test/*.js",
"test": "tap test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/6..latest",
"ff/5",
"firefox/latest",
"chrome/10",
"chrome/latest",
"safari/5.1",
"safari/latest",
"opera/12"
]
},
"version": "1.2.0"
}