@good-fences/api
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -7,3 +7,3 @@ #! /usr/bin/env node | ||
*/ | ||
const { goodFences } = require('./index'); | ||
const { goodFences, GoodFencesResultType } = require('./index'); | ||
const { program } = require('commander'); | ||
@@ -13,9 +13,9 @@ | ||
program | ||
.option('-p, --project <string> ', 'tsconfig.json file path, defaults `./tsconfig.json`') | ||
.option('-o, --output <string>', 'path to write found violations') | ||
.option('--baseUrl <string>', "Overrides `compilerOptions.baseUrl` property read from '--project' argument") | ||
.option('--ignoreExternalFences', 'Ignore external fences (e.g. those in `node_modules`)', false) | ||
.option('--ignoredDirs [pathRegexs...]', 'Directories matching given regular expressions are excluded from fence evaluation (e.g. `--ignoreDirs lib` will not evaluate source files in all dirs named `lib`', []) | ||
.arguments('<path> [morePaths...]', 'Dirs to look for fence and source files') | ||
program.parse(process.argv); | ||
.option('-p, --project <string> ', 'tsconfig.json file path, defaults `./tsconfig.json`', 'tsconfig.json') | ||
.option('-o, --output <string>', 'path to write found violations') | ||
.option('--baseUrl <string>', "Overrides `compilerOptions.baseUrl` property read from '--project' argument") | ||
.option('--ignoreExternalFences', 'Ignore external fences (e.g. those in `node_modules`)', false) | ||
.option('--ignoredDirs [pathRegexs...]', 'Files under directories matching given regular expressions are excluded from source file list and will not generate an import map (e.g. `--ignoreDirs lib` will not evaluate source files in all dirs named `lib`)', []) | ||
.arguments('<path> [morePaths...]', 'Dirs to look for fence and source files') | ||
program.parse(process.argv); | ||
@@ -25,13 +25,19 @@ const options = program.opts(); | ||
const result = goodFences({ | ||
paths: args, | ||
const result = goodFences({ | ||
paths: args ?? [], | ||
project: options.project, | ||
baseUrl: options.baseUrl, | ||
errOutputPath: options.errOutputPath, | ||
errOutputPath: options.output, | ||
ignoreExternalFences: options.ignoreExternalFences ? 1 : 0, | ||
ignoredDirs: options.ignoredDirs | ||
}); | ||
result.forEach(r => { | ||
console.error(r.detailedMessage); | ||
}); | ||
result.forEach(r => { | ||
if (r.resultType === GoodFencesResultType.EvaluationError) { | ||
console.warn(r.detailedMessage); | ||
} | ||
if (r.resultType === GoodFencesResultType.Violation) { | ||
console.error(r.detailedMessage); | ||
} | ||
}); |
@@ -10,3 +10,3 @@ /* tslint:disable */ | ||
} | ||
export function goodFences(opts: GoodFencesOptions): Array<GoodFencesError> | ||
export function goodFences(opts: GoodFencesOptions): Array<GoodFencesResult> | ||
export interface GoodFencesOptions { | ||
@@ -20,3 +20,8 @@ paths: Array<string> | ||
} | ||
export class GoodFencesError { | ||
export const enum GoodFencesResultType { | ||
EvaluationError = 0, | ||
Violation = 1 | ||
} | ||
export class GoodFencesResult { | ||
resultType: GoodFencesResultType | ||
message: string | ||
@@ -23,0 +28,0 @@ sourceFile?: string |
@@ -239,6 +239,7 @@ const { existsSync, readFileSync } = require('fs') | ||
const { ExternalFences, goodFences, GoodFencesError } = nativeBinding | ||
const { ExternalFences, goodFences, GoodFencesResultType, GoodFencesResult } = nativeBinding | ||
module.exports.ExternalFences = ExternalFences | ||
module.exports.goodFences = goodFences | ||
module.exports.GoodFencesError = GoodFencesError | ||
module.exports.GoodFencesResultType = GoodFencesResultType | ||
module.exports.GoodFencesResult = GoodFencesResult |
{ | ||
"name": "@good-fences/api", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "index.js", | ||
@@ -38,6 +38,6 @@ "types": "index.d.ts", | ||
"optionalDependencies": { | ||
"@good-fences/api-win32-x64-msvc": "0.0.6", | ||
"@good-fences/api-darwin-x64": "0.0.6", | ||
"@good-fences/api-linux-x64-gnu": "0.0.6" | ||
"@good-fences/api-win32-x64-msvc": "0.0.7", | ||
"@good-fences/api-darwin-x64": "0.0.7", | ||
"@good-fences/api-linux-x64-gnu": "0.0.7" | ||
} | ||
} |
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
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
170625
49
403