ts-pkg-installer
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -21,2 +21,4 @@ // ts-pkg-installer.ts | ||
var path = require('path'); | ||
// There is no DTS for this package, but we will promisify it later. | ||
var readPackageJson = require('read-package-json'); | ||
var util = require('./util'); | ||
@@ -37,3 +39,3 @@ BluePromise.longStackTraces(); | ||
// Define the CLI. | ||
commander.option('-f, --config-file <path>', 'Config file [' + defaultOptions.configFile + ']', defaultOptions.configFile).option('-n, --dry-run', 'Dry run (display what would happen without taking action)').option('-v, --verbose', 'Verbose logging').version('1.0.0'); | ||
commander.option('-f, --config-file <path>', 'Config file [' + defaultOptions.configFile + ']', defaultOptions.configFile).option('-n, --dry-run', 'Dry run (display what would happen without taking action)').option('-v, --verbose', 'Verbose logging'); | ||
var debugNamespace = 'ts-pkg-installer'; | ||
@@ -70,2 +72,3 @@ var dlog = debug(debugNamespace); | ||
})(); | ||
var readPackageJsonAsync = BluePromise.promisify(readPackageJson); | ||
// ## fsExistsAsync | ||
@@ -507,19 +510,32 @@ // Special handling for fs.exists, which does not conform to Node.js standards for async interfaces. | ||
})(); | ||
// Parse command line arguments. | ||
commander.parse(process.argv); | ||
dlog('commander:\n' + JSON.stringify(commander, null, 2)); | ||
if (commander.args.length !== 0) { | ||
process.stderr.write('Unexpected arguments.\n'); | ||
commander.help(); | ||
} | ||
else { | ||
// Retrieve the options (which are stored as undeclared members of the command object). | ||
var options = new Options(commander); | ||
var mgr = new TypeScriptPackageInstaller(options); | ||
mgr.main().catch(function (err) { | ||
dlog(err.toString()); | ||
process.stderr.write(__filename + ': ' + err.toString() + '\n'); | ||
process.exit(1); | ||
// Set the version of this tool based on package.json. | ||
function setVersion() { | ||
var packageJsonFile = path.join(__dirname, '..', 'package.json'); | ||
return readPackageJsonAsync(packageJsonFile).then(function (packageJson) { | ||
var version = packageJson.version; | ||
dlog('Version:', version); | ||
commander.version(version); | ||
return; | ||
}); | ||
} | ||
// Determine the version before parsing command-line. | ||
setVersion().then(function () { | ||
// Parse command line arguments. | ||
commander.parse(process.argv); | ||
dlog('commander:\n' + JSON.stringify(commander, null, 2)); | ||
if (commander.args.length !== 0) { | ||
process.stderr.write('Unexpected arguments.\n'); | ||
commander.help(); | ||
} | ||
else { | ||
// Retrieve the options (which are stored as undeclared members of the command object). | ||
var options = new Options(commander); | ||
var mgr = new TypeScriptPackageInstaller(options); | ||
mgr.main().catch(function (err) { | ||
dlog(err.toString()); | ||
process.stderr.write(__filename + ': ' + err.toString() + '\n'); | ||
process.exit(1); | ||
}); | ||
} | ||
}); | ||
//# sourceMappingURL=ts-pkg-installer.js.map |
@@ -28,2 +28,5 @@ // ts-pkg-installer.ts | ||
// There is no DTS for this package, but we will promisify it later. | ||
var readPackageJson = require('read-package-json'); | ||
import util = require('./util'); | ||
@@ -53,4 +56,3 @@ | ||
.option('-n, --dry-run', 'Dry run (display what would happen without taking action)') | ||
.option('-v, --verbose', 'Verbose logging') | ||
.version('1.0.0'); | ||
.option('-v, --verbose', 'Verbose logging'); | ||
@@ -126,2 +128,8 @@ var debugNamespace = 'ts-pkg-installer'; | ||
// ## readPackageJsonAsync | ||
interface IReadPackageJsonAsync { | ||
(packageFile: string): BluePromise<string>; | ||
} | ||
var readPackageJsonAsync: IReadPackageJsonAsync = <IReadPackageJsonAsync> BluePromise.promisify(readPackageJson); | ||
// ## fsExistsAsync | ||
@@ -664,19 +672,36 @@ // Special handling for fs.exists, which does not conform to Node.js standards for async interfaces. | ||
// Parse command line arguments. | ||
commander.parse(process.argv); | ||
dlog('commander:\n' + JSON.stringify(commander, null, 2)); | ||
if (commander.args.length !== 0) { | ||
process.stderr.write('Unexpected arguments.\n'); | ||
commander.help(); | ||
} else { | ||
// Retrieve the options (which are stored as undeclared members of the command object). | ||
var options = new Options(commander); | ||
var mgr = new TypeScriptPackageInstaller(options); | ||
mgr.main() | ||
.catch((err: Error) => { | ||
dlog(err.toString()); | ||
process.stderr.write(__filename + ': ' + err.toString() + '\n'); | ||
process.exit(1); | ||
// Set the version of this tool based on package.json. | ||
function setVersion(): BluePromise<void> { | ||
var packageJsonFile: string = path.join(__dirname, '..', 'package.json'); | ||
return readPackageJsonAsync(packageJsonFile) | ||
.then((packageJson: any): void => { | ||
var version: string = packageJson.version; | ||
dlog('Version:', version); | ||
commander.version(version); | ||
return; | ||
}); | ||
} | ||
// Determine the version before parsing command-line. | ||
setVersion() | ||
.then((): void => { | ||
// Parse command line arguments. | ||
commander.parse(process.argv); | ||
dlog('commander:\n' + JSON.stringify(commander, null, 2)); | ||
if (commander.args.length !== 0) { | ||
process.stderr.write('Unexpected arguments.\n'); | ||
commander.help(); | ||
} else { | ||
// Retrieve the options (which are stored as undeclared members of the command object). | ||
var options = new Options(commander); | ||
var mgr = new TypeScriptPackageInstaller(options); | ||
mgr.main() | ||
.catch((err: Error) => { | ||
dlog(err.toString()); | ||
process.stderr.write(__filename + ': ' + err.toString() + '\n'); | ||
process.exit(1); | ||
}); | ||
} | ||
}); |
{ | ||
"name": "ts-pkg-installer", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "TypeScript package installer", | ||
@@ -40,4 +40,5 @@ "main": "bin/ts-pkg-installer.js", | ||
"mkdirp": "^0.5.0", | ||
"read-package-json": "^1.3.2", | ||
"source-map-support": "^0.2.9" | ||
} | ||
} |
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
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
91196
1379
8
+ Addedread-package-json@^1.3.2
+ Addedgithub-url-from-git@1.5.0(transitive)
+ Addedgithub-url-from-username-repo@1.0.2(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedjju@1.4.0(transitive)
+ Addedjson-parse-helpfulerror@1.0.3(transitive)
+ Addednormalize-package-data@1.0.3(transitive)
+ Addedread-package-json@1.3.3(transitive)
+ Addedsemver@4.3.6(transitive)