New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leasot

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leasot - npm Package Compare versions

Comparing version 10.1.0 to 10.2.0

dist/cli/common.d.ts

4

dist/cli/cli-reporter.d.ts

@@ -1,3 +0,3 @@

import { ReporterProgramArgs } from './leasot-reporter';
declare const run: (program: ReporterProgramArgs) => void;
import { CommanderStatic } from 'commander';
declare const run: (program: CommanderStatic) => void;
export default run;

@@ -11,22 +11,9 @@ "use strict";

const fs_1 = require("fs");
const __1 = require("..");
const path_1 = require("path");
const concurrencyLimit = 50;
const outputTodos = (todos, program) => {
try {
const output = __1.report(todos, program.reporter);
console.log(output);
}
catch (e) {
console.error(e);
}
if (program.exitNicely) {
process.exit(0);
}
process.exit(todos.length ? 1 : 0);
};
const parseAndReportFiles = (fileGlobs, program) => {
const common_1 = require("./common");
const CONCURRENCY_LIMIT = 50;
const parseAndReportFiles = (fileGlobs, options) => {
// Get all files and their resolved globs
const files = globby_1.default.sync(fileGlobs, {
ignore: program.ignore || [],
ignore: options.ignore || [],
});

@@ -38,3 +25,3 @@ if (!files || !files.length) {

// Parallel read all of the given files
async_1.mapLimit(files, concurrencyLimit, (file, cb) => fs_1.readFile(path_1.resolve(process.cwd(), file), 'utf8', cb), (err, results) => {
async_1.mapLimit(files, CONCURRENCY_LIMIT, (file, cb) => fs_1.readFile(path_1.resolve(process.cwd(), file), 'utf8', cb), (err, results) => {
if (err) {

@@ -49,8 +36,9 @@ console.log(err);

.reduce((items, item) => items.concat(item), []);
outputTodos(todos, program);
common_1.outputTodos(todos, options);
});
};
const run = (program) => {
const options = program.opts();
if (program.args && program.args.length > 0) {
return parseAndReportFiles(program.args, program);
return parseAndReportFiles(program.args, options);
}

@@ -63,3 +51,3 @@ if (process.stdin.isTTY) {

const todos = JSON.parse(content);
outputTodos(todos, program);
common_1.outputTodos(todos, options);
})

@@ -66,0 +54,0 @@ .catch(function (e) {

@@ -1,2 +0,2 @@

import { ProgramArgs } from './leasot';
import { CommanderStatic } from 'commander';
/**

@@ -6,3 +6,3 @@ * @hidden

export declare const getFiletype: (filetype?: string, filename?: string) => string;
declare const run: (program: ProgramArgs) => void;
declare const run: (program: CommanderStatic) => void;
export default run;

@@ -13,2 +13,3 @@ "use strict";

const fs_1 = require("fs");
const common_1 = require("./common");
const DEFAULT_EXTENSION = '.js';

@@ -28,7 +29,7 @@ const CONCURRENCY_LIMIT = 50;

};
const parseContentSync = (content, program, filename) => {
const extension = exports.getFiletype(program.filetype, filename);
__1.associateExtWithParser(program.associateParser);
const parseContentSync = (content, options, filename) => {
const extension = exports.getFiletype(options.filetype, filename);
__1.associateExtWithParser(options.associateParser);
if (!__1.isExtensionSupported(extension)) {
if (program.skipUnsupported) {
if (options.skipUnsupported) {
return [];

@@ -40,26 +41,13 @@ }

const config = {
customTags: program.tags,
customTags: options.tags,
extension: extension,
filename: filename,
withInlineFiles: program.inlineFiles,
withInlineFiles: options.inlineFiles,
};
return __1.parse(content, config);
};
const outputTodos = (todos, { reporter, exitNicely }) => {
try {
const output = __1.report(todos, reporter);
console.log(output);
}
catch (e) {
console.error(e);
}
if (exitNicely) {
process.exit(0);
}
process.exit(todos.length ? 1 : 0);
};
const parseAndReportFiles = (fileGlobs, program) => {
const parseAndReportFiles = (fileGlobs, options) => {
// Get all files and their resolved globs
const files = globby_1.default.sync(fileGlobs, {
ignore: program.ignore || [],
ignore: options.ignore || [],
});

@@ -78,3 +66,3 @@ if (!files || !files.length) {

.map(function (content, index) {
return parseContentSync(content, program, files[index]);
return parseContentSync(content, options, files[index]);
})

@@ -84,8 +72,9 @@ // filter files without any parsed content

.reduce((items, item) => items.concat(item), []);
outputTodos(todos, program);
common_1.outputTodos(todos, options);
});
};
const run = (program) => {
const options = program.opts();
if (program.args && program.args.length > 0) {
return parseAndReportFiles(program.args, program);
return parseAndReportFiles(program.args, options);
}

@@ -98,4 +87,4 @@ if (process.stdin.isTTY) {

.then(function (content) {
const todos = parseContentSync(content, program);
outputTodos(todos, program);
const todos = parseContentSync(content, options);
common_1.outputTodos(todos, options);
})

@@ -102,0 +91,0 @@ .catch(function (e) {

@@ -1,10 +0,1 @@

import commander from 'commander';
import { BuiltinReporters, ReporterName } from '../definitions';
/**
* @hidden
*/
export interface ReporterProgramArgs extends commander.CommanderStatic {
readonly exitNicely?: boolean;
readonly ignore?: string[];
readonly reporter?: BuiltinReporters | ReporterName;
}
export {};

@@ -8,7 +8,6 @@ "use strict";

const cli_reporter_1 = __importDefault(require("./cli-reporter"));
function list(val) {
return val.split(',');
}
const list = (val) => val.split(',');
/* eslint-disable no-console */
commander_1.default
.storeOptionsAsProperties(false)
.description('Report todos and fixmes from json files or stream')

@@ -15,0 +14,0 @@ .version(require('../../package.json').version)

@@ -1,15 +0,1 @@

import commander from 'commander';
import { BuiltinReporters, ExtensionsDb, ReporterName, Tag } from '../definitions';
/**
* @hidden
*/
export interface ProgramArgs extends commander.CommanderStatic {
readonly associateParser?: ExtensionsDb;
readonly exitNicely?: boolean;
readonly filetype?: string;
readonly ignore?: string[];
readonly inlineFiles?: boolean;
readonly reporter?: BuiltinReporters | ReporterName;
readonly skipUnsupported?: boolean;
readonly tags?: Tag[];
}
export {};

@@ -8,6 +8,4 @@ "use strict";

const cli_1 = __importDefault(require("./cli"));
function list(val) {
return val.split(',');
}
function parseAssociateParser(val, req) {
const list = (val) => val.split(',');
const parseAssociateParser = (val, req) => {
const data = val.split(',');

@@ -21,5 +19,6 @@ if (data.length === 0 || data.length > 2) {

return req;
}
};
/* eslint-disable no-console */
commander_1.default
.storeOptionsAsProperties(false)
.description(require('../../package.json').description)

@@ -26,0 +25,0 @@ .version(require('../../package.json').version)

{
"name": "leasot",
"description": "Parse and output TODOs and FIXMEs from comments in your files",
"version": "10.1.0",
"version": "10.2.0",
"author": "Gilad Peleg <gilad@giladpeleg.com> (https://www.giladpeleg.com)",

@@ -11,5 +11,5 @@ "bin": {

"dependencies": {
"async": "^3.1.0",
"chalk": "^3.0.0",
"commander": "^4.1.0",
"async": "^3.2.0",
"chalk": "^4.0.0",
"commander": "^5.0.0",
"eol": "^0.9.1",

@@ -25,18 +25,18 @@ "get-stdin": "^7.0.0",

"devDependencies": {
"@types/async": "^3.0.3",
"@types/async": "^3.2.0",
"@types/lodash": "^4.14.149",
"@types/mocha": "^7.0.1",
"@types/node": "^13.1.4",
"@types/mocha": "^7.0.2",
"@types/node": "^13.11.0",
"@types/text-table": "^0.2.1",
"gh-pages": "^2.1.1",
"husky": "^4.0.0",
"gh-pages": "^2.2.0",
"husky": "^4.2.3",
"jsdoc-to-markdown": "^5.0.3",
"lint-staged": "^10.0.1",
"mocha": "^7.0.0",
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"lint-staged": "^10.1.1",
"mocha": "^7.1.1",
"prettier": "^2.0.2",
"rimraf": "^3.0.2",
"should": "^13.2.3",
"ts-node": "^8.5.4",
"typedoc": "^0.16.2",
"typescript": "^3.7.4"
"ts-node": "^8.8.1",
"typedoc": "^0.17.3",
"typescript": "^3.8.3"
},

@@ -86,10 +86,8 @@ "engines": {

"*.yml": [
"prettier --write",
"git add"
"prettier --write"
],
"*.ts": [
"prettier --write",
"git add"
"prettier --write"
]
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc