Comparing version 0.0.11 to 0.0.12
#!/usr/bin/env node | ||
var doc = ''+ | ||
'Usage: \n'+ | ||
' croc ls [--json] \n'+ | ||
' croc deps [--lenient --json] \n'+ | ||
' croc link [--lenient] \n'+ | ||
' croc install \n'+ | ||
' croc test \n'+ | ||
' croc build \n'+ | ||
' croc publish \n'+ | ||
' croc exec CMD \n'+ | ||
' \n'+ | ||
'Options: \n'+ | ||
' -h --help Show this screen. \n'+ | ||
' --version Show version. \n'+ | ||
' --json Show information in JSON format. \n'+ | ||
' --lenient Ignore that project dependency doesnt satisfies version (semver) \n'; | ||
var doc = '' + | ||
'Usage: \n' + | ||
' croc ls [options] [<package>...] \n' + | ||
' croc deps [options] [<package>...] \n' + | ||
' croc link [--strict] \n' + | ||
' croc install \n' + | ||
' croc test \n' + | ||
' croc build \n' + | ||
' croc publish \n' + | ||
' croc exec CMD [<package>...] \n' + | ||
' croc pexec CMD [<package>...] \n' + | ||
' \n' + | ||
'Options: \n' + | ||
' -h --help Show this screen. \n' + | ||
' --version Show version. \n' + | ||
' --json Show information in JSON format. \n' + | ||
' -c, --changed Show only projects that is changed. \n' + | ||
' -s, --since=SHA Commit to diff against [default: master] \n' + | ||
' --strict Dependencies must statisfy version (semver) \n' | ||
var docopt = require('docopt').docopt; | ||
var args = docopt(doc, { version : require('../package.json').version }); | ||
var docopt = require('docopt').docopt | ||
var args = docopt(doc, { version: require('../package.json').version }) | ||
var list = require('croc-list'); | ||
var deps = require('croc-deps'); | ||
var link = require('croc-link'); | ||
var exec = require('croc-exec'); | ||
var deps = require('croc-deps') | ||
var link = require('croc-link') | ||
var exec = require('croc-exec') | ||
var git = require('croc-git') | ||
var printer = require('../lib/dag-printer.js') | ||
var table = require('text-table'); | ||
var chalk = require('chalk'); | ||
var r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' + | ||
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g'); | ||
var _ansiTrim = function(str) { return str.replace(r, ''); }; | ||
var _print = function(res) { console.log(res); }; | ||
var _printTable = function(tableObj) { | ||
var tbl = tableObj || {}; | ||
tbl.options.stringLength = function(s) { return _ansiTrim(s).length; }; | ||
var thead_und = tbl.thead.map(function(n) { return chalk.underline(n); }); | ||
var t = table([thead_und].concat(tbl.tbody), tbl.options); | ||
_print(t); | ||
}; | ||
var pkgs = deps.packages({strict: args['--strict'], | ||
packages: args['<package>']}) | ||
if (args['--changed']) { | ||
pkgs = git.changed(pkgs, args['--since']) | ||
} | ||
if (args.ls) { | ||
var pkgs = list.packages(); | ||
if (args['--json']) { | ||
_print(pkgs); | ||
printer.packages(pkgs) | ||
} else { | ||
_printTable({ | ||
thead: ['Package', 'Version', 'Location'], | ||
tbody: Object.keys(pkgs).map(function(key) { | ||
var pkg = pkgs[key]; | ||
return [chalk.yellow(pkg.name), pkg.version, pkg.file]; | ||
}), | ||
options: { align: ['l', 'r', 'l'] } | ||
}); | ||
printer.packagesTable(pkgs) | ||
} | ||
} else if (args.deps) { | ||
var order = deps.order({ lenient: args['--lenient'] }); | ||
if (args['--json']) { | ||
_print(order); | ||
printer.dependencies(pkgs) | ||
} else { | ||
var depMap = function(dep) { | ||
var d = dep.split('#'); | ||
return d[0] + chalk.gray('#' + d[1]); | ||
}; | ||
_printTable({ | ||
thead: ['Package', 'Version' ,'Depends on'], | ||
tbody: order.map(function(pkgInfo) { | ||
var pkg = pkgInfo[0]; | ||
var ver = pkgInfo[1]; | ||
var depon = pkgInfo[2]; | ||
return [chalk.yellow(pkg), ver, depon.map(depMap)]; | ||
}), | ||
options: { align: ['l', 'r', 'l'] } | ||
}); | ||
printer.dependenciesTable(pkgs) | ||
} | ||
} else if (args.link) { | ||
link.link({ lenient: args['--lenient'] }); | ||
link.link(pkgs) | ||
} else if (args.test) { | ||
exec.exec('npm test'); | ||
exec.exec(pkgs, 'npm test') | ||
} else if (args.build) { | ||
exec.exec('npm run build'); | ||
exec.exec(pkgs, 'npm run build') | ||
} else if (args.install) { | ||
exec.exec('npm install'); | ||
exec.exec(pkgs, 'npm install') | ||
} else if (args.publish) { | ||
exec.exec('npm show %PKG_NAME% versions --json | grep -q \\"%PKG_VERSION%\\" || npm publish'); | ||
exec.exec(pkgs, 'npm show %PKG_NAME% versions --json | grep -q \\"%PKG_VERSION%\\" || npm publish') | ||
} else if (args.exec) { | ||
exec.exec(args.CMD); | ||
exec.exec(pkgs, args.CMD) | ||
} else if (args.pexec) { | ||
exec.pexec(pkgs, args.CMD) | ||
} |
{ | ||
"name": "croc", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "monolithic repository manager", | ||
@@ -9,3 +9,3 @@ "bin": { | ||
"scripts": { | ||
"test": "echo \"No test is available.\"", | ||
"test": "standard", | ||
"build": "echo \"No need for build.\"" | ||
@@ -18,3 +18,3 @@ }, | ||
"author": "Pavel Fatrdla", | ||
"license": "Unlicense", | ||
"license": "GPL-3.0", | ||
"bugs": { | ||
@@ -28,4 +28,4 @@ "url": "https://github.com/xpavelf/croc/issues" | ||
"croc-exec": "~0.0.2", | ||
"croc-git": "~0.0.1", | ||
"croc-link": "~0.0.2", | ||
"croc-list": "~0.0.2", | ||
"docopt": "~0.6.2", | ||
@@ -32,0 +32,0 @@ "text-table": "~0.2.0" |
@@ -18,17 +18,17 @@ # croc | ||
``` | ||
Usage: | ||
croc ls [--json] | ||
croc deps [--lenient --json] | ||
croc link [--lenient] | ||
croc install | ||
croc test | ||
croc build | ||
croc publish | ||
croc exec CMD | ||
Options: | ||
-h --help Show this screen. | ||
--version Show version. | ||
--json Show information in JSON format. | ||
--lenient Ignore that project dependency doesnt satisfies version (semver) | ||
Usage: | ||
croc ls [options] [<package>...] | ||
croc deps [options] [<package>...] | ||
croc link [--strict] | ||
croc install | ||
croc test | ||
croc build | ||
croc publish | ||
croc exec CMD | ||
Options: | ||
-h --help Show this screen. | ||
--version Show version. | ||
--json Show information in JSON format. | ||
--strict Dependencies must statisfy version (semver) | ||
``` |
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
6462
6
111
1
2
70
+ Addedcroc-git@~0.0.1
+ Addedcroc-git@0.0.6(transitive)
- Removedcroc-list@~0.0.2