Comparing version 1.4.0 to 1.5.0
"use strict"; | ||
var typings_core_1 = require('typings-core'); | ||
var cli_1 = require('./support/cli'); | ||
function help() { | ||
@@ -8,5 +9,5 @@ return "\ntypings bundle --out <filepath>\n\nOptions:\n [--out|-o] <filepath> The bundled output file path\n [--global|-G] Bundle as a global definition\n"; | ||
function exec(args, options) { | ||
return typings_core_1.bundle(options); | ||
return cli_1.spinner(typings_core_1.bundle(options)); | ||
} | ||
exports.exec = exec; | ||
//# sourceMappingURL=bin-bundle.js.map |
@@ -16,3 +16,3 @@ "use strict"; | ||
if (args.length === 0) { | ||
return typings_core_1.install(options) | ||
return cli_1.spinner(typings_core_1.install(options)) | ||
.then(function (result) { | ||
@@ -34,3 +34,3 @@ var name = result.name, tree = result.tree; | ||
}); | ||
return typings_core_1.installDependenciesRaw(args, options) | ||
return cli_1.spinner(typings_core_1.installDependenciesRaw(args, options)) | ||
.then(function (results) { | ||
@@ -37,0 +37,0 @@ for (var _i = 0, results_1 = results; _i < results_1.length; _i++) { |
@@ -9,3 +9,3 @@ "use strict"; | ||
function exec(args, options) { | ||
return typings_core_1.list(options) | ||
return cli_1.spinner(typings_core_1.list(options)) | ||
.then(function (tree) { | ||
@@ -12,0 +12,0 @@ console.log(cli_1.archifyDependencyTree({ tree: tree, unicode: options.unicode })); |
"use strict"; | ||
var typings_core_1 = require('typings-core'); | ||
var cli_1 = require('./support/cli'); | ||
function help() { | ||
@@ -8,5 +9,5 @@ return "\ntypings prune\n\nOptions:\n [--production] Also prune non-production dependencies\n"; | ||
function exec(args, options) { | ||
return typings_core_1.prune(options); | ||
return cli_1.spinner(typings_core_1.prune(options)); | ||
} | ||
exports.exec = exec; | ||
//# sourceMappingURL=bin-prune.js.map |
"use strict"; | ||
var columnify = require('columnify'); | ||
var typings_core_1 = require('typings-core'); | ||
var cli_1 = require('./support/cli'); | ||
function help() { | ||
@@ -11,3 +12,3 @@ return "\ntypings search [query]\n\nOptions:\n [--name] <name> Search for definitions by exact name (E.g. only \"react\")\n [--source] <source> The registry mirror (E.g. \"npm\", \"bower\", \"env\", \"global\", \"dt\", ...)\n [--offset] <x> Skip first \"x\" results (default: 0)\n [--limit] <x> Limit to \"x\" results (default: 20, max: 100)\n [--order] <order> Direction to sort results (default: \"asc\", enum: \"asc\" or \"desc\")\n [--sort] <column> Order results by a column (E.g. \"versions\", \"name\", ...)\n"; | ||
var name = options.name, source = options.source, offset = options.offset, limit = options.limit, order = options.order, sort = options.sort; | ||
return typings_core_1.search({ name: name, source: source, query: query, offset: offset, limit: limit, order: order, sort: sort }) | ||
return cli_1.spinner(typings_core_1.search({ name: name, source: source, query: query, offset: offset, limit: limit, order: order, sort: sort })) | ||
.then(function (_a) { | ||
@@ -14,0 +15,0 @@ var results = _a.results, total = _a.total; |
@@ -13,5 +13,5 @@ "use strict"; | ||
} | ||
return typings_core_1.uninstallDependencies(args, options); | ||
return cli_1.spinner(typings_core_1.uninstallDependencies(args, options)); | ||
} | ||
exports.exec = exec; | ||
//# sourceMappingURL=bin-uninstall.js.map |
@@ -14,6 +14,6 @@ #!/usr/bin/env node | ||
var pkg = require('../package.json'); | ||
var unicodeConfig = process.env.TYPINGS_CONFIG_UNICODE || process.env.NPM_CONFIG_UNICODE; | ||
var unicodeConfig = process.env['TYPINGS_CONFIG_UNICODE'] || process.env['NPM_CONFIG_UNICODE']; | ||
var argv = minimist(process.argv.slice(2), { | ||
boolean: ['version', 'save', 'saveDev', 'savePeer', 'global', 'verbose', 'production', 'unicode'], | ||
string: ['cwd', 'out', 'name', 'source', 'offset', 'limit', 'sort'], | ||
string: ['cwd', 'out', 'name', 'source', 'offset', 'limit', 'sort', 'loglevel'], | ||
alias: { | ||
@@ -31,3 +31,3 @@ global: ['G'], | ||
unicode: unicodeConfig ? isTrue(unicodeConfig) : hasUnicode(), | ||
production: process.env.NODE_ENV === 'production' | ||
production: process.env['NODE_ENV'] === 'production' | ||
} | ||
@@ -41,2 +41,5 @@ }); | ||
var args = extend(argv, { emitter: emitter, cwd: cwd }); | ||
if (argv.loglevel) { | ||
cli_1.setLoglevel(argv.loglevel); | ||
} | ||
updateNotifier({ pkg: pkg }).notify(); | ||
@@ -72,2 +75,14 @@ exec(args); | ||
}); | ||
emitter.on('resolve', function (_a) { | ||
var src = _a.src, name = _a.name; | ||
cli_1.setStatus("Resolving \"" + name + "\" from \"" + src + "\""); | ||
}); | ||
emitter.on('resolved', function (_a) { | ||
var name = _a.name; | ||
cli_1.setStatus("Resolved \"" + name + "\""); | ||
}); | ||
emitter.on('compiledependency', function (_a) { | ||
var name = _a.name; | ||
cli_1.setStatus("Compiling \"" + name + "\""); | ||
}); | ||
function exec(options) { | ||
@@ -89,4 +104,4 @@ if (options._.length) { | ||
var wrap = wordwrap(4, 80); | ||
console.log("\nUsage: typings <command>\n\nCommands:\n" + wrap(Object.keys(aliases_1.aliases).sort().join(', ')) + "\n\ntypings <command> -h Get help for <command>\ntypings <command> -V Enable verbose logging\n\ntypings --version Print the CLI version\n\ntypings@" + pkg.version + " " + path_1.join(__dirname, '..') + "\n"); | ||
console.log("\nUsage: typings <command>\n\nCommands:\n" + wrap(Object.keys(aliases_1.aliases).sort().join(', ')) + "\n\ntypings <command> -h Get help for <command>\ntypings <command> -V Enable verbose logging\n\ntypings --version Print the CLI version\n [--loglevel] <level> Set the log level (\"debug\", info\", \"warn\", \"error\" or \"silent\")\n\ntypings@" + pkg.version + " " + path_1.join(__dirname, '..') + "\n"); | ||
} | ||
//# sourceMappingURL=bin.js.map |
@@ -7,5 +7,11 @@ import Promise = require('any-promise'); | ||
export declare function log(message: string): void; | ||
export declare function setLoglevel(level: string): number | undefined; | ||
export declare function logInfo(message: string, prefix?: string): void; | ||
export declare function logWarning(message: string, prefix?: string): void; | ||
export declare function logError(message: string, prefix?: string): void; | ||
export declare function setStatus(message: string): void; | ||
export declare function render(): void; | ||
export declare function startSpinner(): void; | ||
export declare function stopSpinner(): void; | ||
export declare function spinner(promise: any): Promise<any>; | ||
export declare function handle(promise: any, options: PrintOptions): Promise<any>; | ||
@@ -12,0 +18,0 @@ export declare function handleError(error: Error, options: PrintOptions): any; |
@@ -5,6 +5,16 @@ "use strict"; | ||
var archy = require('archy'); | ||
var listify = require('listify'); | ||
var logUpdate = require('log-update'); | ||
var elegantSpinner = require('elegant-spinner'); | ||
var truncate = require('cli-truncate'); | ||
var os = require('os'); | ||
var promise_finally_1 = require('promise-finally'); | ||
var pkg = require('../../package.json'); | ||
var statusFrame; | ||
var statusTimeout; | ||
var statusMessage; | ||
function log(message) { | ||
logUpdate.clear(); | ||
console.error(message); | ||
render(); | ||
} | ||
@@ -15,3 +25,22 @@ exports.log = log; | ||
} | ||
var loglevels = { | ||
debug: 0, | ||
info: 1, | ||
warn: 2, | ||
error: 3, | ||
silent: 4 | ||
}; | ||
var loglevel = loglevels['info']; | ||
function setLoglevel(level) { | ||
if (!loglevels.hasOwnProperty(level)) { | ||
logError("invalid log level (options are " + listify(Object.keys(loglevels)) + ")"); | ||
return; | ||
} | ||
return (loglevel = loglevels[level]); | ||
} | ||
exports.setLoglevel = setLoglevel; | ||
function logInfo(message, prefix) { | ||
if (loglevel > loglevels['info']) { | ||
return; | ||
} | ||
var output = message.split(/\r?\n/g).map(function (line) { | ||
@@ -24,2 +53,5 @@ return formatLine(chalk.bgBlack.cyan, 'INFO', line, prefix); | ||
function logWarning(message, prefix) { | ||
if (loglevel > loglevels['warn']) { | ||
return; | ||
} | ||
var output = message.split(/\r?\n/g).map(function (line) { | ||
@@ -32,2 +64,5 @@ return formatLine(chalk.bgYellow.black, 'WARN', line, prefix); | ||
function logError(message, prefix) { | ||
if (loglevel > loglevels['error']) { | ||
return; | ||
} | ||
var output = message.split(/\r?\n/g).map(function (line) { | ||
@@ -39,2 +74,37 @@ return formatLine(chalk.bgBlack.red, 'ERR!', line, prefix); | ||
exports.logError = logError; | ||
function setStatus(message) { | ||
statusMessage = message; | ||
} | ||
exports.setStatus = setStatus; | ||
function render() { | ||
clearInterval(statusTimeout); | ||
if (statusFrame && process.stdout.isTTY) { | ||
var status_1 = chalk.cyan(statusFrame()); | ||
if (statusMessage) { | ||
status_1 += " " + statusMessage; | ||
} | ||
logUpdate(truncate(status_1, process.stdout.columns)); | ||
statusTimeout = setTimeout(render, 50); | ||
} | ||
} | ||
exports.render = render; | ||
function startSpinner() { | ||
statusFrame = elegantSpinner(); | ||
render(); | ||
} | ||
exports.startSpinner = startSpinner; | ||
function stopSpinner() { | ||
clearTimeout(statusTimeout); | ||
statusFrame = undefined; | ||
statusTimeout = undefined; | ||
statusMessage = undefined; | ||
logUpdate.clear(); | ||
logUpdate.done(); | ||
} | ||
exports.stopSpinner = stopSpinner; | ||
function spinner(promise) { | ||
startSpinner(); | ||
return promise_finally_1.default(Promise.resolve(promise), stopSpinner); | ||
} | ||
exports.spinner = spinner; | ||
function handle(promise, options) { | ||
@@ -52,6 +122,6 @@ return Promise.resolve(promise).catch(function (err) { return handleError(err, options); }); | ||
if (options.verbose && error.stack) { | ||
log(''); | ||
logError(''); | ||
logError(error.stack, 'stack'); | ||
} | ||
log(''); | ||
logError(''); | ||
logError(process.cwd(), 'cwd'); | ||
@@ -65,3 +135,3 @@ logError(os.type() + " " + os.release(), 'system'); | ||
} | ||
log(''); | ||
logError(''); | ||
logError('If you need help, you may report this error at:'); | ||
@@ -68,0 +138,0 @@ logError(" <https://github.com/typings/typings/issues>"); |
{ | ||
"name": "typings", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "The TypeScript Definition Manager", | ||
@@ -45,11 +45,15 @@ "main": "dist/bin.js", | ||
"dependencies": { | ||
"any-promise": "^1.0.0", | ||
"any-promise": "^1.3.0", | ||
"archy": "^1.0.0", | ||
"bluebird": "^3.1.1", | ||
"chalk": "^1.0.0", | ||
"cli-truncate": "^0.2.1", | ||
"columnify": "^1.5.2", | ||
"elegant-spinner": "^1.0.1", | ||
"has-unicode": "^2.0.1", | ||
"listify": "^1.0.0", | ||
"log-update": "^1.0.2", | ||
"minimist": "^1.2.0", | ||
"typings-core": "^1.5.0", | ||
"promise-finally": "^2.2.1", | ||
"typings-core": "^1.6.1", | ||
"update-notifier": "^1.0.0", | ||
@@ -61,9 +65,9 @@ "wordwrap": "^1.0.0", | ||
"dependency-check": "^2.5.1", | ||
"nock": "^8.0.0", | ||
"nock": "^9.0.0", | ||
"rimraf": "^2.5.2", | ||
"ts-node": "^1.0.0", | ||
"tslint": "^3.5.0", | ||
"tslint-config-standard": "^1.0.0", | ||
"tslint-config-standard": "^1.5.0", | ||
"typescript": "^2.0.3" | ||
} | ||
} |
{ | ||
"dependencies": { | ||
"any-promise": "github:typings/typed-any-promise#74ba6cf22149ff4de39c2338a9cb84f9ded6f042", | ||
"archy": "github:typings/typed-archy#3706c5e4df4efcc8cec8849a1c493cebd0830bea", | ||
"chalk": "github:typings/typed-chalk#a7e422c5455e70292e5675a727d43a7b05fc3e58", | ||
"cli-truncate": "registry:npm/cli-truncate#0.3.0+20161028200400", | ||
"columnify": "github:typings/typed-columnify#855f119ac0310bc0dc924b7c26dc1426e2aa43a5", | ||
"elegant-spinner": "registry:npm/elegant-spinner#1.0.0+20160723033700", | ||
"has-unicode": "registry:npm/has-unicode#2.0.0+20160826085324", | ||
"listify": "registry:npm/listify#1.0.0+20160211003958", | ||
"log-update": "registry:npm/log-update#1.0.0+20160723033700", | ||
"minimist": "github:typings/typed-minimist#9bfb8ebb1cf82abe2e16b00d6e0f59492224728e", | ||
@@ -20,4 +22,4 @@ "typings-core": "npm:typings-core", | ||
"globalDependencies": { | ||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#48c1e3c1d6baefa4f1a126f188c27c4fefd36bff" | ||
"node": "registry:env/node#6.0.0+20161019193037" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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 3 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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 3 instances in 1 package
69893
611
16
+ Addedcli-truncate@^0.2.1
+ Addedelegant-spinner@^1.0.1
+ Addedlog-update@^1.0.2
+ Addedpromise-finally@^2.2.1
+ Addedansi-escapes@1.4.0(transitive)
+ Addedcli-cursor@1.0.2(transitive)
+ Addedcli-truncate@0.2.1(transitive)
+ Addedelegant-spinner@1.0.1(transitive)
+ Addedexit-hook@1.1.1(transitive)
+ Addedlog-update@1.0.2(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedrestore-cursor@1.0.1(transitive)
+ Addedslice-ansi@0.0.4(transitive)
Updatedany-promise@^1.3.0
Updatedtypings-core@^1.6.1