Comparing version 0.2.5 to 0.2.6
@@ -1,12 +0,2 @@ | ||
interface Options { | ||
outputFormat: 'json' | 'line' | 'vis' | 'graphSON'; | ||
id: 'number' | 'uuid'; | ||
projectRoot?: string; | ||
noContents: boolean; | ||
} | ||
export declare namespace Options { | ||
const defaults: Options; | ||
} | ||
export declare function main(this: void, args: string[]): void; | ||
export declare function run(): void; | ||
export {}; |
@@ -16,7 +16,18 @@ "use strict"; | ||
Options.defaults = { | ||
help: false, | ||
version: false, | ||
outputFormat: 'line', | ||
id: 'number', | ||
projectRoot: undefined, | ||
noContents: false | ||
}; | ||
})(Options = exports.Options || (exports.Options = {})); | ||
Options.descriptions = [ | ||
{ id: 'version', type: 'boolean', alias: 'v', default: false, description: 'output the version number' }, | ||
{ id: 'help', type: 'boolean', alias: 'h', default: false, description: 'output usage information' }, | ||
{ id: 'outputFormat', type: 'string', default: 'line', values: ['line', 'json'], description: 'Specifies the output format. Allowed values are: \'line\' and \'json\'.' }, | ||
{ id: 'id', type: 'string', default: 'number', values: ['number', 'uuid'], description: 'Specifies the id format. Allowed values are: \'number\' and \'uuid\'.' }, | ||
{ id: 'projectRoot', type: 'string', default: undefined, description: 'Specifies the project root. Defaults to the location of the [tj]sconfig.json file.' }, | ||
{ id: 'noContents', type: 'boolean', default: false, description: 'File contents will not be embedded into the dump.' }, | ||
]; | ||
})(Options || (Options = {})); | ||
function loadConfigFile(file) { | ||
@@ -162,8 +173,41 @@ let absolute = path.resolve(file); | ||
function main(args) { | ||
const options = Object.assign(Options.defaults, minimist(process.argv.slice(2), { | ||
string: [ | ||
'outputFormat', 'id', 'projectRoot' | ||
], | ||
boolean: ['noContents'] | ||
})); | ||
let minOpts = { | ||
string: [], | ||
boolean: [], | ||
default: Object.create(null), | ||
alias: Object.create(null) | ||
}; | ||
let longestId = 0; | ||
for (let description of Options.descriptions) { | ||
longestId = Math.max(longestId, description.id.length); | ||
minOpts[description.type] = description.id; | ||
minOpts.default[description.id] = description.default; | ||
if (description.alias !== undefined) { | ||
minOpts.alias[description.id] = [description.alias]; | ||
} | ||
} | ||
const options = Object.assign(Options.defaults, minimist(process.argv.slice(2), minOpts)); | ||
if (options.version) { | ||
console.log(require('../package.json').version); | ||
return; | ||
} | ||
let buffer = []; | ||
if (options.help) { | ||
buffer.push(`Languag Server Index Format tool for TypeScript`); | ||
buffer.push(`Version: ${require('../package.json').version}`); | ||
buffer.push(''); | ||
buffer.push(`Usage: lsif-tsc [options][tsc options]`); | ||
buffer.push(''); | ||
buffer.push(`Options`); | ||
for (let description of Options.descriptions) { | ||
if (description.alias !== undefined) { | ||
buffer.push(` -${description.alias} --${description.id}${' '.repeat(longestId - description.id.length)} ${description.description}`); | ||
} | ||
else { | ||
buffer.push(` --${description.id} ${' '.repeat(longestId - description.id.length)} ${description.description}`); | ||
} | ||
} | ||
console.log(buffer.join('\n')); | ||
return; | ||
} | ||
const config = ts.parseCommandLine(args); | ||
@@ -170,0 +214,0 @@ const idGenerator = createIdGenerator(options); |
{ | ||
"name": "lsif-tsc", | ||
"description": "Tool to create an LSIF dump for TypeScript projects.", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"author": "Microsoft Corporation", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
132468
38
2720
1
13