Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

find-duplicate-strings

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-duplicate-strings - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

lib/cli/cli.d.ts

8

lib/cli/index.d.ts

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

import { Answers } from 'inquirer';
import { Findings } from '../scan';
export declare const outputFindings: (findings: Findings) => void;
export declare const filterFileFormats: ({ scanPath }: Answers) => Promise<Answers>;
export declare const scanDirAndLogFindings: ({ extensions, scanPath }: Answers) => Findings;
export declare function run(): void;
#!/usr/bin/env node
export {};

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

#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = exports.scanDirAndLogFindings = exports.filterFileFormats = exports.outputFindings = void 0;
const commander_1 = require("commander");
const inquirer_1 = require("inquirer");
const scan_1 = require("../scan");
const path_1 = require("path");
const fs_1 = require("fs");
const questions_json_1 = __importDefault(require("./questions.json"));
const scanner = new scan_1.Scanner();
const program = new commander_1.Command();
const prompt = inquirer_1.createPromptModule();
exports.outputFindings = (findings) => {
if (!Object.keys(findings).length) {
console.log('No duplicates where found.');
return;
}
prompt([questions_json_1.default.write]).then(({ writePath }) => {
const filePath = path_1.resolve(process.cwd(), writePath);
const data = JSON.stringify(findings, null, 2);
fs_1.writeFileSync(`${filePath}.json`, data, { encoding: 'utf8' });
});
};
exports.filterFileFormats = ({ scanPath }) => {
return prompt([questions_json_1.default.extensions]).then(({ extensions }) => ({ extensions, scanPath }));
};
exports.scanDirAndLogFindings = ({ extensions, scanPath }) => {
const resolvedPath = path_1.resolve(process.cwd(), scanPath);
if (!fs_1.existsSync(resolvedPath)) {
throw new Error('Directory does not exist, please pass a valid path.');
}
const findings = scanner.scanDir(resolvedPath, extensions);
if (Object.keys(findings).length) {
console.table(findings, ['count']);
}
return findings;
};
function run() {
prompt([questions_json_1.default.scan])
.then(exports.filterFileFormats)
.then(exports.scanDirAndLogFindings)
.then(exports.outputFindings)
.catch((e) => {
console.error(e);
});
}
exports.run = run;
program.action(run);
program.parse(process.argv);
require('./cli');
{
"name": "find-duplicate-strings",
"version": "1.0.2",
"version": "1.0.3",
"description": "Easy to use CLI that finds duplicate strings in a directory and stores them in a external file for easy reference",

@@ -5,0 +5,0 @@ "author": "Erwin Heitzman",

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