Comparing version 2017.3.10 to 2017.3.16
@@ -19,3 +19,2 @@ #!/usr/bin/env node | ||
/* istanbul ignore next */ | ||
// run shared js-env code - pre-init | ||
@@ -47,2 +46,9 @@ (function () { | ||
local.local = local.apidoc = local; | ||
// init exports | ||
if (local.modeJs === 'browser') { | ||
local.global.utility2_apidoc = local; | ||
} else { | ||
module.exports = local; | ||
module.exports.__dirname = __dirname; | ||
} | ||
}()); | ||
@@ -52,4 +58,4 @@ | ||
// run shared js-env code - pre-function | ||
/* istanbul ignore next */ | ||
// run shared js-env code - pre-function | ||
(function () { | ||
@@ -84,4 +90,8 @@ local.assert = function (passed, message) { | ||
try { | ||
require(module); | ||
} catch (ignore) { | ||
require(process.cwd() + '/node_modules/' + module); | ||
} catch (errorCaught) { | ||
try { | ||
require(module); | ||
} catch (ignore) { | ||
} | ||
} | ||
@@ -301,3 +311,3 @@ [ | ||
{{/if env.npm_package_homepage}}\n\ | ||
>{{env.npm_package_nameAlias}} (v{{env.npm_package_version}})</a>\n\ | ||
>{{env.npm_package_name}} (v{{env.npm_package_version}})</a>\n\ | ||
</h1>\n\ | ||
@@ -355,5 +365,5 @@ <div class="apidocSectionDiv"><a\n\ | ||
{{#if env.npm_package_homepage}} \ | ||
[{{env.npm_package_nameAlias}} (v{{env.npm_package_version}})]({{env.npm_package_homepage}}) \ | ||
[{{env.npm_package_name}} (v{{env.npm_package_version}})]({{env.npm_package_homepage}}) \ | ||
{{#unless env.npm_package_homepage}} \ | ||
{{env.npm_package_nameAlias}} (v{{env.npm_package_version}}) \ | ||
{{env.npm_package_name}} (v{{env.npm_package_version}}) \ | ||
{{/if env.npm_package_homepage}} \ | ||
@@ -522,5 +532,4 @@ \n\ | ||
// init options | ||
options = local.objectSetDefault(options, {}); | ||
options.dir = local.moduleDirname(options.dir); | ||
options = local.objectSetDefault(options, { | ||
local.objectSetDefault(options, { | ||
packageJson: JSON.parse(readExample('package.json')) | ||
@@ -530,4 +539,3 @@ }); | ||
npm_package_homepage: options.packageJson.homepage, | ||
npm_package_nameAlias: options.packageJson.nameAlias || | ||
options.packageJson.name, | ||
npm_package_name: options.packageJson.name, | ||
npm_package_version: options.packageJson.version | ||
@@ -556,4 +564,4 @@ } }, 2); | ||
// init moduleMain | ||
moduleMain = options.moduleDict[options.env.npm_package_nameAlias] = | ||
options.moduleDict[options.env.npm_package_nameAlias] || require(options.dir); | ||
moduleMain = options.moduleDict[options.env.npm_package_name] = | ||
options.moduleDict[options.env.npm_package_name] || require(options.dir); | ||
// init circularList - builtin | ||
@@ -601,4 +609,4 @@ Object.keys(process.binding('natives')).forEach(function (key) { | ||
}()); | ||
module = options.moduleExtraDict[options.env.npm_package_nameAlias] = | ||
options.moduleExtraDict[options.env.npm_package_nameAlias] || {}; | ||
module = options.moduleExtraDict[options.env.npm_package_name] = | ||
options.moduleExtraDict[options.env.npm_package_name] || {}; | ||
(options.libFileList || []).forEach(function (file) { | ||
@@ -623,6 +631,6 @@ try { | ||
// normalize moduleMain | ||
moduleMain = options.moduleDict[options.env.npm_package_nameAlias] = | ||
moduleMain = options.moduleDict[options.env.npm_package_name] = | ||
local.objectSetDefault({}, moduleMain); | ||
Object.keys(options.moduleDict).forEach(function (key) { | ||
if (key.indexOf(options.env.npm_package_nameAlias + '.') !== 0) { | ||
if (key.indexOf(options.env.npm_package_name + '.') !== 0) { | ||
return; | ||
@@ -729,4 +737,4 @@ } | ||
// run node js-env code - post-init | ||
/* istanbul ignore next */ | ||
// run node js-env code - post-init | ||
case 'node': | ||
@@ -736,5 +744,2 @@ // require modules | ||
local.path = require('path'); | ||
// init exports | ||
module.exports = module['./lib.apidoc.js'] = local; | ||
module.exports.__dirname = __dirname; | ||
// run the cli | ||
@@ -741,0 +746,0 @@ if (module !== require.main || local.global.utility2_rollup) { |
@@ -80,2 +80,9 @@ /* | ||
local.local = local.db = local; | ||
// init exports | ||
if (local.modeJs === 'browser') { | ||
local.global.utility2_db = local; | ||
} else { | ||
module.exports = local; | ||
module.exports.__dirname = __dirname; | ||
} | ||
}()); | ||
@@ -177,7 +184,8 @@ | ||
local.objectSetOverride = function (arg, overrides, depth) { | ||
local.objectSetOverride = function (arg, overrides, depth, env) { | ||
/* | ||
* this function will recursively set overrides for items the arg | ||
* this function will recursively set overrides for items in the arg | ||
*/ | ||
arg = arg || {}; | ||
env = env || (typeof process === 'object' && process.env) || {}; | ||
overrides = overrides || {}; | ||
@@ -202,7 +210,7 @@ Object.keys(overrides).forEach(function (key) { | ||
!Array.isArray(overrides2))) { | ||
local.objectSetOverride(arg2, overrides2, depth - 1); | ||
local.objectSetOverride(arg2, overrides2, depth - 1, env); | ||
return; | ||
} | ||
// else set arg[key] with overrides[key] | ||
arg[key] = arg === local.env | ||
arg[key] = arg === env | ||
// if arg is env, then overrides falsey value with empty string | ||
@@ -1558,10 +1566,2 @@ ? overrides2 || '' | ||
// run browser js-env code - post-init | ||
case 'browser': | ||
// init exports | ||
local.global.utility2_db = local; | ||
break; | ||
// run node js-env code - post-init | ||
@@ -1571,7 +1571,4 @@ case 'node': | ||
local.fs = require('fs'); | ||
// init exports | ||
module.exports = module['./lib.db.js'] = local; | ||
local.__dirname = __dirname; | ||
break; | ||
} | ||
}()); |
@@ -45,2 +45,9 @@ #!/usr/bin/env node | ||
local.local = local.github_crud = local; | ||
// init exports | ||
if (local.modeJs === 'browser') { | ||
local.global.utility2_github_crud = local; | ||
} else { | ||
module.exports = local; | ||
module.exports.__dirname = __dirname; | ||
} | ||
}()); | ||
@@ -431,5 +438,2 @@ | ||
local.path = require('path'); | ||
// init exports | ||
module.exports = module['./lib.github_crud.js'] = local; | ||
module.exports.__dirname = __dirname; | ||
// run the cli | ||
@@ -436,0 +440,0 @@ if (module !== require.main || local.global.utility2_rollup) { |
@@ -484,22 +484,10 @@ /*jslint | ||
/* jslint-ignore-end */ | ||
// init exports | ||
if (local.modeJs === 'browser') { | ||
local.global.utility2_sjcl = local.sjcl; | ||
} else { | ||
module.exports = local.sjcl; | ||
module.exports.__dirname = __dirname; | ||
} | ||
}()); | ||
switch (local.modeJs) { | ||
// run browser js-env code - post-init | ||
case 'browser': | ||
// init exports | ||
local.global.utility2_sjcl = local.sjcl; | ||
break; | ||
// run node js-env code - post-init | ||
case 'node': | ||
// init exports | ||
module.exports = module['./lib.sjcl.js'] = local.sjcl; | ||
module.exports.__dirname = __dirname; | ||
break; | ||
} | ||
}()); |
@@ -45,2 +45,9 @@ #!/usr/bin/env node | ||
local.local = local.uglifyjs = local; | ||
// init exports | ||
if (local.modeJs === 'browser') { | ||
local.global.utility2_uglifyjs = local; | ||
} else { | ||
module.exports = local; | ||
module.exports.__dirname = __dirname; | ||
} | ||
}()); | ||
@@ -649,10 +656,2 @@ | ||
// run browser js-env code - post-init | ||
case 'browser': | ||
// init exports | ||
local.global.utility2_uglifyjs = local; | ||
break; | ||
/* istanbul ignore next */ | ||
@@ -667,5 +666,2 @@ // run node js-env code - post-init | ||
local.url = require('url'); | ||
// init exports | ||
module.exports = module['./lib.uglifyjs.js'] = local; | ||
module.exports.__dirname = __dirname; | ||
// run the cli | ||
@@ -672,0 +668,0 @@ if (module !== require.main || local.global.utility2_rollup) { |
@@ -1,1 +0,67 @@ | ||
{"author":"kai zhu <kaizhu256@gmail.com>","bin":{"utility2":"lib.utility2.sh","utility2-apidoc":"lib.apidoc.js","utility2-github-crud":"lib.github_crud.js","utility2-istanbul":"lib.istanbul.js","utility2-jslint":"lib.jslint.js","utility2-uglifyjs":"lib.uglifyjs.js"},"description":"the zero-dependency swiss-army-knife tool for building, testing, and deploying webapps","devDependencies":{"electron-lite":"kaizhu256/node-electron-lite#alpha"},"engines":{"node":">=4.0"},"homepage":"https://github.com/kaizhu256/node-utility2","keywords":["browser","build","busybox","ci","code-coverage","continuous-integration","deploy","docker","electron","headless-browser","istanbul","jscover","jscoverage","phantomjs","slimerjs","swiss-army-knife","test","test-coverage","travis","travis-ci","utility2","webapp"],"license":"MIT","main":"lib.utility2.js","name":"busyweb","nameAlias":"utility2","nameOriginal":"utility2","os":["darwin","linux"],"readmeParse":"1","repository":{"type":"git","url":"https://github.com/kaizhu256/node-utility2.git"},"scripts":{"build-ci":"./lib.utility2.sh shReadmeTest build_ci.sh","env":"env","heroku-postbuild":"./lib.utility2.sh shDeployHeroku","postinstall":"if [ -f lib.utility2.npm_scripts.sh ]; then ./lib.utility2.npm_scripts.sh postinstall; fi","publish-alias":"VERSION=$(npm info $npm_package_name version); for ALIAS in busybox busybox2 busyweb test-lite; do ./lib.utility2.sh shNpmPublishAs . $ALIAS $VERSION; ./lib.utility2.sh shNpmTestPublished $ALIAS || exit $?; done","start":"export PORT=${PORT:-8080} && if [ -f assets.app.js ]; then node assets.app.js; return; fi && export npm_config_mode_auto_restart=1 && ./lib.utility2.sh shRun shIstanbulCover test.js","test":"export PORT=$(./lib.utility2.sh shServerPortRandom) && export PORT_REPL=$(./lib.utility2.sh shServerPortRandom) && export npm_config_mode_auto_restart=1 && ./lib.utility2.sh test test.js"},"version":"2017.3.10"} | ||
{ | ||
"author": "kai zhu <kaizhu256@gmail.com>", | ||
"bin": { | ||
"utility2": "lib.utility2.sh", | ||
"utility2-apidoc": "lib.apidoc.js", | ||
"utility2-github-crud": "lib.github_crud.js", | ||
"utility2-istanbul": "lib.istanbul.js", | ||
"utility2-jslint": "lib.jslint.js", | ||
"utility2-uglifyjs": "lib.uglifyjs.js" | ||
}, | ||
"description": "the zero-dependency swiss-army-knife tool for building, testing, and deploying webapps", | ||
"devDependencies": { | ||
"electron-lite": "kaizhu256/node-electron-lite#alpha" | ||
}, | ||
"engines": { | ||
"node": ">=4.0" | ||
}, | ||
"homepage": "https://github.com/kaizhu256/node-utility2", | ||
"keywords": [ | ||
"browser", | ||
"build", | ||
"busybox", | ||
"ci", | ||
"code-coverage", | ||
"continuous-integration", | ||
"deploy", | ||
"docker", | ||
"electron", | ||
"headless-browser", | ||
"istanbul", | ||
"jscover", | ||
"jscoverage", | ||
"phantomjs", | ||
"slimerjs", | ||
"swiss-army-knife", | ||
"test", | ||
"test-coverage", | ||
"travis", | ||
"travis-ci", | ||
"utility2", | ||
"webapp" | ||
], | ||
"license": "MIT", | ||
"main": "lib.utility2.js", | ||
"name": "busyweb", | ||
"nameAlias": "utility2", | ||
"nameOriginal": "utility2", | ||
"os": [ | ||
"darwin", | ||
"linux" | ||
], | ||
"readmeParse": "1", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/kaizhu256/node-utility2.git" | ||
}, | ||
"scripts": { | ||
"build-ci": "./lib.utility2.sh shReadmeTest build_ci.sh", | ||
"env": "env", | ||
"heroku-postbuild": "./lib.utility2.sh shDeployHeroku", | ||
"postinstall": "if [ -f lib.utility2.npm_scripts.sh ]; then ./lib.utility2.npm_scripts.sh postinstall; fi", | ||
"publish-alias": "VERSION=$(npm info $npm_package_name version); for ALIAS in busybox busybox2 busyweb test-lite; do ./lib.utility2.sh shNpmPublishAs . $ALIAS $VERSION; eval ./lib.utility2.sh shNpmTestPublished $ALIAS || exit $?; done", | ||
"start": "(set -e; export PORT=${PORT:-8080}; if [ -f assets.app.js ]; then node assets.app.js; exit; fi; export npm_config_mode_auto_restart=1; ./lib.utility2.sh shRun shIstanbulCover test.js)", | ||
"test": "(set -e; export PORT=$(./lib.utility2.sh shServerPortRandom); export PORT_REPL=$(./lib.utility2.sh shServerPortRandom); export npm_config_mode_auto_restart=1; ./lib.utility2.sh test test.js)" | ||
}, | ||
"version": "2017.3.16" | ||
} |
@@ -1,3 +0,2 @@ | ||
utility2 | ||
======== | ||
# utility2 | ||
the zero-dependency swiss-army-knife tool for building, testing, and deploying webapps | ||
@@ -32,7 +31,7 @@ | ||
#### todo | ||
- use remote credentials | ||
- use github oauth - https://stackoverflow.com/questions/18027115/committing-via-travis-ci-failing | ||
- add npm script publish-deprecate | ||
- shFileTrimLeft example.* before shBuildGithubUpload | ||
- allow server-side stdout to be streamed to webapps | ||
- split function testRun into file lib.test.js | ||
- rename test.js -> test.$npm_package_nameAlias.js | ||
- add utility2.middlewareLimit | ||
@@ -42,5 +41,11 @@ - add server stress test using electron | ||
#### change since 31c8c1e9 | ||
- npm publish 2017.3.10 | ||
- fix build in beta branch | ||
#### change since 22302d24 | ||
- npm publish 2017.3.16 | ||
- add function buildNpmdoc and buildTest | ||
- automate building and publishing of npmdoc's | ||
- commit tag 'npm publish' will publish package in alpha-branch and promote to beta | ||
- harden shell-function shPasswordEnvUnset | ||
- remove '|| return \$?' from shell-scripts when possible to fix 'set -e' failing to exit on error | ||
- rename function onErrorAssert -> onErrorThrow | ||
- partially revert npm_package_nameAlias back to npm_package_name | ||
- none | ||
@@ -243,4 +248,4 @@ | ||
// post-init | ||
// run browser js-env code - post-init | ||
/* istanbul ignore next */ | ||
// run browser js-env code - post-init | ||
case 'browser': | ||
@@ -384,4 +389,4 @@ local.testRunBrowser = function (event) { | ||
// run node js-env code - post-init | ||
/* istanbul ignore next */ | ||
// run node js-env code - post-init | ||
case 'node': | ||
@@ -403,3 +408,3 @@ // export local | ||
<meta name="viewport" content="width=device-width, initial-scale=1">\n\ | ||
<title>{{env.npm_package_nameAlias}} (v{{env.npm_package_version}})</title>\n\ | ||
<title>{{env.npm_package_name}} (v{{env.npm_package_version}})</title>\n\ | ||
<style>\n\ | ||
@@ -456,3 +461,3 @@ /*csslint\n\ | ||
utility2-comment -->\n\ | ||
{{env.npm_package_nameAlias}} (v{{env.npm_package_version}})\n\ | ||
{{env.npm_package_name}} (v{{env.npm_package_version}})\n\ | ||
<!-- utility2-comment\n\ | ||
@@ -566,2 +571,3 @@ </a>\n\ | ||
npm_package_description: 'example module', | ||
npm_package_name: 'example', | ||
npm_package_nameAlias: 'example', | ||
@@ -580,2 +586,4 @@ npm_package_version: '0.0.1' | ||
return 'example module'; | ||
case 'npm_package_name': | ||
return 'example'; | ||
case 'npm_package_nameAlias': | ||
@@ -699,7 +707,7 @@ return 'example'; | ||
"postinstall": "if [ -f lib.utility2.npm_scripts.sh ]; then ./lib.utility2.npm_scripts.sh postinstall; fi", | ||
"publish-alias": "VERSION=$(npm info $npm_package_name version); for ALIAS in busybox busybox2 busyweb test-lite; do ./lib.utility2.sh shNpmPublishAs . $ALIAS $VERSION; ./lib.utility2.sh shNpmTestPublished $ALIAS || exit $?; done", | ||
"start": "export PORT=${PORT:-8080} && if [ -f assets.app.js ]; then node assets.app.js; return; fi && export npm_config_mode_auto_restart=1 && ./lib.utility2.sh shRun shIstanbulCover test.js", | ||
"test": "export PORT=$(./lib.utility2.sh shServerPortRandom) && export PORT_REPL=$(./lib.utility2.sh shServerPortRandom) && export npm_config_mode_auto_restart=1 && ./lib.utility2.sh test test.js" | ||
"publish-alias": "VERSION=$(npm info $npm_package_name version); for ALIAS in busybox busybox2 busyweb test-lite; do ./lib.utility2.sh shNpmPublishAs . $ALIAS $VERSION; eval ./lib.utility2.sh shNpmTestPublished $ALIAS || exit $?; done", | ||
"start": "(set -e; export PORT=${PORT:-8080}; if [ -f assets.app.js ]; then node assets.app.js; exit; fi; export npm_config_mode_auto_restart=1; ./lib.utility2.sh shRun shIstanbulCover test.js)", | ||
"test": "(set -e; export PORT=$(./lib.utility2.sh shServerPortRandom); export PORT_REPL=$(./lib.utility2.sh shServerPortRandom); export npm_config_mode_auto_restart=1; ./lib.utility2.sh test test.js)" | ||
}, | ||
"version": "2017.3.10" | ||
"version": "2017.3.16" | ||
} | ||
@@ -720,3 +728,3 @@ ``` | ||
# docker build -f tmp/README.Dockerfile.base -t kaizhu256/node-utility2:base . | ||
# docker build -f "tmp/README.Dockerfile.$DOCKER_TAG" -t "$GITHUB_REPO:$DOCKER_TAG" . || | ||
# docker build -f "tmp/README.Dockerfile.$DOCKER_TAG" -t "$GITHUB_REPO:$DOCKER_TAG" . | ||
# https://hub.docker.com/_/node/ | ||
@@ -853,8 +861,8 @@ FROM debian:stable-slim | ||
# save screen-capture | ||
(export MODE_BUILD=testExampleJs && | ||
export modeBrowserTest=screenCapture && | ||
export url="/tmp/app/tmp/build/coverage.html/app/example.js.html" && | ||
shBrowserTest && | ||
export url="$npm_config_dir_build/test-report.html" && | ||
shBrowserTest) || return $? | ||
(export MODE_BUILD=testExampleJs | ||
export modeBrowserTest=screenCapture | ||
export url="/tmp/app/tmp/build/coverage.html/app/example.js.html" | ||
shBrowserTest | ||
export url="$npm_config_dir_build/test-report.html" | ||
shBrowserTest) | ||
shReadmeTest example.sh | ||
@@ -872,4 +880,5 @@ shNpmTestPublished | ||
# init env | ||
. ./lib.utility2.sh && shBuildCi | ||
# run shBuildCi | ||
. ./lib.utility2.sh | ||
shBuildCi | ||
``` | ||
@@ -876,0 +885,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2302886
16
39614
878
74
24